Closed marcinlesek closed 6 months ago
Playwright allow us to run specific test files (less useful for us):
npx playwright test tests/file.ts
Run specific test from line 42 in file:
42
file
npx playwright test file.ts:42
What is more interesting here, we can run tests based on title searching with regular expression:
npx playwright test -g "test title 123"
The most interesting thing, is option to list all the tests, but not run them (useful for creating test lists scope?):
npx playwright test --list
Programatically, we can add .only to test function to run only that test:
.only
test
test.only('my single test', async ({ page }) => { // Run only focused tests in the entire project. });
Next thing is option to tag tests (directly in test title or indirectly, in details object):
import { test, expect } from '@playwright/test'; test('my test title 1', { tag: '@fast', }, async ({ page }) => { // ... }); test('my test title 2 @slow', async ({ page }) => { // ... });
It allows also to add array of tags to tag property and run them with -g flag (grep):
tag
-g
grep
npx playwright test --grep @fast
Playwright allow us to run specific test files (less useful for us):
Run specific test from line
42
infile
:What is more interesting here, we can run tests based on title searching with regular expression:
The most interesting thing, is option to list all the tests, but not run them (useful for creating test lists scope?):
Programatically, we can add
.only
totest
function to run only that test:Next thing is option to tag tests (directly in test title or indirectly, in details object):
It allows also to add array of tags to
tag
property and run them with-g
flag (grep
):