release notes
release notes
Published 5/20/2023
MinorContains breaking changes
UI Mode now shows steps, fixtures and attachments:
New property testProject.teardown to specify a project that needs to run after this
and all dependent projects have finished. Teardown is useful to cleanup any resources acquired by this project.
A common pattern would be a setup dependency with a corresponding teardown:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'setup',
testMatch: /global.setup\.ts/,
teardown: 'teardown',
},
{
name: 'teardown',
testMatch: /global.teardown\.ts/,
},
{
name: 'chromium',
use: devices['Desktop Chrome'],
dependencies: ['setup'],
},
{
name: 'firefox',
use: devices['Desktop Firefox'],
dependencies: ['setup'],
},
{
name: 'webkit',
use: devices['Desktop Safari'],
dependencies: ['setup'],
},
],
});
New method expect.configure to create pre-configured expect instance with its own defaults such as timeout and soft.
const slowExpect = expect.configure({ timeout: 10000 });
await slowExpect(locator).toHaveText('Submit');
// Always do soft assertions.
const softExpect = expect.configure({ soft: true });
New options stderr and stdout in testConfig.webServer to configure output handling:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
// Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
},
});
New locator.and() to create a locator that matches both locators.
const button = page.getByRole('button').and(page.getByTitle('Subscribe'));
New events browserContext.on('console') and browserContext.on('dialog') to subscribe to any dialogs
and console messages from any page from the given browser context. Use the new methods consoleMessage.page()
and dialog.page() to pin-point event source.
npx playwright test no longer works if you install both playwright and @playwright/test. There's no need
to install both, since you can always import browser automation APIs from @playwright/test directly:
// automation.ts
import { chromium, firefox, webkit } from '@playwright/test';
/* ... */
Node.js 14 is no longer supported since it reached its end-of-life on April 30, 2023.
This version was also tested against the following stable channels:
release notes
Published 5/20/2023
MinorContains breaking changes
UI Mode now shows steps, fixtures and attachments:
New property testProject.teardown to specify a project that needs to run after this
and all dependent projects have finished. Teardown is useful to cleanup any resources acquired by this project.
A common pattern would be a setup dependency with a corresponding teardown:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'setup',
testMatch: /global.setup\.ts/,
teardown: 'teardown',
},
{
name: 'teardown',
testMatch: /global.teardown\.ts/,
},
{
name: 'chromium',
use: devices['Desktop Chrome'],
dependencies: ['setup'],
},
{
name: 'firefox',
use: devices['Desktop Firefox'],
dependencies: ['setup'],
},
{
name: 'webkit',
use: devices['Desktop Safari'],
dependencies: ['setup'],
},
],
});
New method expect.configure to create pre-configured expect instance with its own defaults such as timeout and soft.
const slowExpect = expect.configure({ timeout: 10000 });
await slowExpect(locator).toHaveText('Submit');
// Always do soft assertions.
const softExpect = expect.configure({ soft: true });
New options stderr and stdout in testConfig.webServer to configure output handling:
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
// Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
},
});
New locator.and() to create a locator that matches both locators.
const button = page.getByRole('button').and(page.getByTitle('Subscribe'));
New events browserContext.on('console') and browserContext.on('dialog') to subscribe to any dialogs
and console messages from any page from the given browser context. Use the new methods consoleMessage.page()
and dialog.page() to pin-point event source.
npx playwright test no longer works if you install both playwright and @playwright/test. There's no need
to install both, since you can always import browser automation APIs from @playwright/test directly:
// automation.ts
import { chromium, firefox, webkit } from '@playwright/test';
/* ... */
Node.js 14 is no longer supported since it reached its end-of-life on April 30, 2023.
This version was also tested against the following stable channels:
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.