Skip to content

Filtering spec files with use of cucumber compile#10690

Merged
christian-bromann merged 6 commits intowebdriverio:mainfrom
tamil777selvan:main
Jul 10, 2023
Merged

Filtering spec files with use of cucumber compile#10690
christian-bromann merged 6 commits intowebdriverio:mainfrom
tamil777selvan:main

Conversation

@tamil777selvan
Copy link
Member

@tamil777selvan tamil777selvan commented Jul 9, 2023

Proposed changes

Filtering spec files with use of cucumber compile. This fixes the issue of skipping spec if we need to filter test with tags on Feature and Scenario level.
Screenshot 2023-07-09 at 4 05 29 PM
Screenshot 2023-07-09 at 4 08 06 PM

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 9, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@christian-bromann
Copy link
Member

Thanks for raising the PR. Using Cucumber interfaces for this is a fantastic idea. Do you think this would also fix #10644 ?

It seems like some tests are failing:

 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Feature level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at root Scenario level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Rule level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Scenario within Rule
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by non-existent tag
TypeError: newId is not a function
 ❯ pickleStep node_modules/@cucumber/gherkin/src/pickles/compile.ts:258:9
 ❯ node_modules/@cucumber/gherkin/src/pickles/compile.ts:122:19
 ❯ compileScenario node_modules/@cucumber/gherkin/src/pickles/compile.ts:119:21
 ❯ node_modules/@cucumber/gherkin/src/pickles/compile.ts:42:7
 ❯ Proxy.compile node_modules/@cucumber/gherkin/src/pickles/compile.ts:28:20
 ❯ Proxy.shouldRun packages/wdio-cucumber-framework/src/utils.ts:254:21
    252|     }
    253| 
    254|     const pickles = compile(doc, '', IdGenerator.incrementing())
       |                     ^
    255|     const tags = pickles.map((pickle) => pickle.tags.map((tag) => tag.…
    256|     return tags.some((tag) => tagParser.evaluate(tag))
 ❯ packages/wdio-cucumber-framework/src/index.ts:190:71

@tamil777selvan
Copy link
Member Author

tamil777selvan commented Jul 10, 2023

Thanks for raising the PR. Using Cucumber interfaces for this is a fantastic idea. Do you think this would also fix #10644 ?

It seems like some tests are failing:

 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Feature level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at root Scenario level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Rule level
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by tag at Scenario within Rule
 FAIL  packages/wdio-cucumber-framework/tests/adapter.test.ts > CucumberAdapter > can run when filtering by non-existent tag
TypeError: newId is not a function
 ❯ pickleStep node_modules/@cucumber/gherkin/src/pickles/compile.ts:258:9
 ❯ node_modules/@cucumber/gherkin/src/pickles/compile.ts:122:19
 ❯ compileScenario node_modules/@cucumber/gherkin/src/pickles/compile.ts:119:21
 ❯ node_modules/@cucumber/gherkin/src/pickles/compile.ts:42:7
 ❯ Proxy.compile node_modules/@cucumber/gherkin/src/pickles/compile.ts:28:20
 ❯ Proxy.shouldRun packages/wdio-cucumber-framework/src/utils.ts:254:21
    252|     }
    253| 
    254|     const pickles = compile(doc, '', IdGenerator.incrementing())
       |                     ^
    255|     const tags = pickles.map((pickle) => pickle.tags.map((tag) => tag.…
    256|     return tags.some((tag) => tagParser.evaluate(tag))
 ❯ packages/wdio-cucumber-framework/src/index.ts:190:71

Thank you for your comment and for recognising the use of Cucumber interfaces. This should fix #10644. Also I have added tests for both use case.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just awesome, thanks a lot! ❤️

LGTM 👍

@christian-bromann christian-bromann merged commit 10d8c04 into webdriverio:main Jul 10, 2023
@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants