Skip to content

Add ability to get skipped tests when using getTestList for static analysis #6398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 20, 2021

Conversation

flora8984461
Copy link
Contributor

@flora8984461 flora8984461 commented Jul 19, 2021

Purpose

Describe the problem you want to address or the feature you want to implement.

I have opened an issue #6238, and I was suggested to open a PR. The purpose is to add property of "isSkipped" when using getTypeScriptTestList / getTypeScriptTestListFromCode and getTestList / getTestListFromCode when I just want to do a static analysis without actually running the tests.

Approach

Describe how your changes address the issue or implement the desired functionality in as much detail as possible.

  1. Add property "isSkipped" in Class Fixture, Class Test and formatFnData().
  2. Add check if the test / fixture is skipped by a new function getSkippedInfo().
  3. Pass the isSkipped property in analyze() for fixture and test.

References

Provide a link to the existing issue(s), if any.

#6238

Pre-Merge TODO

I think the test "src/compiler/test-file/test-file-parser-base.js" includes the test I need, and I made the required updates.
I have run the following tests on my local,

gulp test-server - all pass, except for some existing "errored after" from the master branch
gulp test-functional-local - some screenshots not stable pass, and encounter `Error: Port 1337 is occupied by another process.` which exists in master branch
gulp test-client-local - there seem to be some existing failure from the master branch

And I found the link on Contributing Guide https://github.com/DevExpress/testcafe/blob/master/docs/articles/documentation/reference/command-line-interface.md#file-pathglob-pattern and https://github.com/DevExpress/testcafe/blob/master/docs/articles/documentation/reference/command-line-interface.md cannot be reached now.

I am opening PR for review to double-check if I am missing anything and looking for feedback on my approach. Thank you so much!

  • Write tests for your proposed changes
  • Make sure that existing tests do not fail
    marking this since the tests including my changes have passed.

Hi @AlexSkorkin @AlexKamaev @miherlosev Would you mind helping review and approve running workflows? Thanks! I cannot add reviewers.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 19, 2021
@flora8984461 flora8984461 temporarily deployed to authentication July 19, 2021 22:59 Inactive
@flora8984461 flora8984461 marked this pull request as ready for review July 20, 2021 00:52
@flora8984461 flora8984461 temporarily deployed to CI July 21, 2021 08:46 Inactive
@miherlosev
Copy link
Collaborator

miherlosev commented Jul 21, 2021

Hi @flora8984461
Thank you for contributing to TestCafe. We will review this PR.

Also, I fixed the broken links on the Contribution guide page.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 21, 2021
@AlexKamaev
Copy link
Contributor

It seems that the PR is not finished yet.
I reviewed the following test:

it('Hooks in test file', function () {
        const expectedStructure = [
            [
                new Fixture('fixture1', 0, 23, new Loc(1, 0, 1, 23), {},
                    [
                        new Test('fixture1test1', 26, 111, new Loc(3, 0, 9, 2), {}),
                    ]
                ),
               ...
            ],
        ];
        
        return testJSFilesParser('./data/test-suites/fixture-and-test-hooks', expectedStructure);

And alsoI had a look at the testfile:

fixture `fixture1`.skip;
    test.before(async t => {
})
('fixture1test1', async t => {
}).after(async t => {
});

In the test file, fixture1 is skipped. However, in the test it is not skipped, and the test passes. This means that the test is incorrect. But the test passes - this means that the parser does not work correctly with this usage scenario.

Please take a look at other tests. There may be similar cases as well. We can merge this PR only if we are sure that all cases are covered.

@flora8984461
Copy link
Contributor Author

Thank you so much for your review. I will update my PR soon.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 27, 2021
@flora8984461
Copy link
Contributor Author

flora8984461 commented Jul 28, 2021

Still have some issue with typescript's get-test-list, working on it...
Will add more test cases later

@flora8984461 flora8984461 temporarily deployed to authentication July 29, 2021 02:35 Inactive
@flora8984461
Copy link
Contributor Author

Hi @AlexKamaev , thank you so much for helping review, I found some miss. I made the fix and added several new test cases in the testfile in fixture-and-test-hooks. Would you mind helping review again? I wonder if there is any better way to do it and if there are any other cases I can consider testing. Thanks!

@flora8984461 flora8984461 temporarily deployed to CI July 29, 2021 07:44 Inactive
@AlexKamaev
Copy link
Contributor

@flora8984461
I checked your approach. I'm afraid it does not look reliable. I found one more case when the skip property is not applied:

fixture
    .beforeEach(async t => {})
    .before(async t => {})
    ('fixture5');

test
    .skip // <-------------------------------------
    .before(async t => {})
    .after(async t => {})
    `fixture5test1`

I would like to see one special method that will detect if the skip is applied instead of putting a lot of currentSkip = true expressions in different places of code. Unfortunately, I cannot give you more detailed recommendations on this PR.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 29, 2021
@flora8984461
Copy link
Contributor Author

Thanks for your feedback. I think I might need more time to make it a better way. I prefer one special method that will detect if the skip is applied too. Let me convert it to draft and work on it more.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 29, 2021
@flora8984461 flora8984461 marked this pull request as draft July 29, 2021 13:21
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 30, 2021
@flora8984461 flora8984461 temporarily deployed to authentication August 2, 2021 16:34 Inactive
@AlexKamaev AlexKamaev temporarily deployed to CI August 10, 2021 14:10 Inactive
@AlexKamaev AlexKamaev temporarily deployed to authentication August 10, 2021 16:38 Inactive
@AlexKamaev AlexKamaev temporarily deployed to CI August 11, 2021 12:47 Inactive
@AndreyBelym AndreyBelym marked this pull request as draft August 16, 2021 10:30
@AndreyBelym
Copy link
Contributor

LGTM but should be rebased and merged only after the patch release.

@flora8984461
Copy link
Contributor Author

@AlexKamaev @AndreyBelym

Thank you so much for your time and for helping me refractory. I will do the rebase, or do you prefer doing it?

And when is the patch release?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 16, 2021
@AlexKamaev
Copy link
Contributor

@flora8984461 I do not have enough permissions to do rebase in your branch. If you grant me permissions, I can do the rebase, or you can do it yourself. At present, we cannot give you precise estimation about the next release date.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 17, 2021
@flora8984461 flora8984461 temporarily deployed to authentication August 17, 2021 13:12 Inactive
@flora8984461
Copy link
Contributor Author

@AlexKamaev Thanks, sorry I forgot about the access. I did a rebase and sent you an invite as a collaborator on my forked branch (I think that can grant rebase access?) just in case there will be more need updates / rebase.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 17, 2021
@AlexKamaev AlexKamaev marked this pull request as ready for review August 18, 2021 07:10
@flora8984461 flora8984461 temporarily deployed to CI August 18, 2021 07:11 Inactive
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 18, 2021
@miherlosev miherlosev merged commit a0f6d7a into DevExpress:master Aug 20, 2021
@AlexSkorkin AlexSkorkin mentioned this pull request Jul 11, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants