Skip to content
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

Question:What is the Priority of Tags stated in the playwright BDD run command vs Playwright Config using grep #142

Open
RichardCariven opened this issue Apr 24, 2024 · 1 comment
Labels
question Further information is requested

Comments

@RichardCariven
Copy link

RichardCariven commented Apr 24, 2024

I have my tests split up by Tag into Smoke, Regression, and Dev which I then use different run commands to kick off based on the environment/situation

Eg.

"e2e:smoke": "npx bddgen --tags '@smoke' && npx playwright test --reporter=line",
"e2e:regression": "npx bddgen --tags '@regression' && npx playwright test --reporter=line",

However I now also want to use the Grep functionality in playwright config to set up certain tests to be mobile or web, or both,

{
     grep:[/@web/, /@all/],
     name: "chromium",
     use: { ...devices["Desktop Chrome"] },
   },
   {
     grep:[/@web/,/@all/],
     name: "webkit",
     use: { ...devices["Desktop Safari"] },
   },
   {
     name: "Iphone",
     grep:[/@mobile/,/@all/],
     use: { ...devices["iPhone SE"] },
   },
However, I want to make sure that I still only run my Smoke or Regression tests 

For instance below, I want to be able to only run the Smoke or Regression test, and then only run that against the Mobile device, not have both tests run for every mobile test.

@smoke
 @mobile 
 Scenario: some smoke test 
 
 @regression
 @mobile 
 Scenario: some regression test

Does Playwright BDD filter out tests via tags first and then run the playwright.config filter against each test. Or will it just run all the tests that are tagged regardless of if the tag is in the Playwright BDD run command, or the Playwright Config?

is there an alternative way you would suggest setting up these kinds of scenarios?

@RichardCariven RichardCariven added the question Further information is requested label Apr 24, 2024
@vitalets
Copy link
Owner

Tags passed to bddgen command filter which features/scenarios will be generated.
Tags passed to playwright grep filter which of generated tests will run.

For this example:

@smoke
@mobile 
Scenario: some smoke test 

@regression
@mobile 
Scenario: some regression test

Command to run smoke on mobile should be:

npx bddgen --tags '@smoke' && npx playwright test --project=Iphone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants