Sourced from playwright's releases.
v1.42.0
New APIs
Test tags
New tag syntax for adding tags to the tests (@-tokens in the test title are still supported).
test('test customer login', { tag: ['@fast', '@login'] }, async ({ page }) => { // ... });
Use
--grep
command line option to run only tests with certain tags.npx playwright test --grep @fast
Annotating skipped tests
New annotation syntax for test annotations allows annotating the tests that do not run.
test('test full report', { annotation: [ { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/23180' }, { type: 'docs', description: 'https://playwright.dev/docs/test-annotations#tag-tests' }, ], }, async ({ page }) => { // ... });
page.addLocatorHandler()
New method page.addLocatorHandler() registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears.
// Setup the handler. await page.addLocatorHandler( page.getByRole('heading', { name: 'Hej! You are in control of your cookies.' }), async () => { await page.getByRole('button', { name: 'Accept all' }).click(); }); // Write the test as usual. await page.goto('https://www.ikea.com/'); await page.getByRole('link', { name: 'Collection of blue and white' }).click(); await expect(page.getByRole('heading', { name: 'Light and easy' })).toBeVisible();
... (truncated)
e7f0635
cherry-pick(#29692):
docs: better addLocatorHandler example in release notes ...8709a3a
cherry-pick(#29687):
chore: fix docs roll for functions without args follow-u...aa9f6fb
cherry-pick(#29669):
chore: strengthen linting (#29674)f5899c1
chore: set version to 1.42.0 (#29671)77e1b02
docs: 1.42 release notes (#29666)c1421bc
docs: typescript compiler invocation before tests (#29667)bd8d044
feat(uimode) uses relative paths to establish websocket connection (#29617)5602826
devops: add a hint how to create a repro (#29665)015a1bc
feat(ct): double unmounting component throws error (#29650)303d7fd
chore(ct): vue resolve internal type errors (#29649)