I have grouped my tests in playwright. My test grouping looks as following
test.describe('API Test Suite', ()=> {
test("get users @smoke", async ({request}) => {
//Test here
})
test("get countries @integration", async ({request}) => {
//Test here
})
});
I can grep them using tags e.g. @smoke/@integration but I wonder how can I filter them out based on their test group i.e "API Test Suite" in this scenario and run them.
You may directly use tag inside describe title as well like @API mentioned below:
test.describe('@API Test Suite', ()=> {
test("get users @smoke", async ({request}) => {
//Test here
})
test("get countries @integration", async ({request}) => {
//Test here
})
});
npx playwright test --grep "API Test Suite"
//Run tests containing the @API Test Suite tag AND do not contain the @readonly tag
npx playwright test --grep "@API Test Suite" --grep-invert "@readonly"