Hi all I am working with Playwright and I have different projects inside defined in my playwright.config.ts (the data is fake because for privacy policies I can't share any of my work obviously).
projects: [ { name: 'Carlino-Qa', use: { ...devices['Desktop Edge'], channel: 'msedge', baseURL: 'https://qa.carlino.com/', }, retries: 1, },
{
name: 'Carlino-Dev',
use: {
...devices['Desktop Edge'],
channel: 'msedge',
baseURL: 'https://dev.carlino.com/'
},
retries: 1,
},
{
name: 'Carlino-Portugal',
** testMatch: '@portugal'**
use: {
...devices['Desktop Edge'],
channel: 'msedge',
baseURL: 'https://qa.carlino.portugal.com/'
},
},
],
Note: my yml file is configured in such a way that when I manually run a workflow in github, I can tell it which project should run
I want to execute my test cases in Github for Carlino-Portugal project, and when the execution starts I want to execute just only the test cases that has the @portugal tag.
I know that testMatch: is only able to match with folders and not tags. And I know that grep can be used, but can I use grep option for an individual project?
How can I configure my project to indicate that only test cases with this tag will run when it is executed?
Do you have any other strategies to recommend?
Thank you very much !
I tried npx playwright test --grep=@portugal and it worked. I tried npx playwright test --project='Carlino-Portugal' and it works only when testMatch attribute is not defined for tags. I tried to execute in github carlino-portugal project but it started the execution for every test case because the filter was not working
Instead of using testmatch for filtering the test cases that should be executed on my project. I used GREP in this way.
I tried using grep: '@tagexample' and it didn't work. So after having this configuration, Github executes Carlino-Portugal project and all the test cases that has got this tag. Hope it's clear for you too :)
Don't forget, you should have your .yml file configured if you want to execute an specific project in Github.