v1.40.0
Test Generator Update
New tools to generate assertions:
- "Assert visibility" tool generates expect(locator).toBeVisible().
- "Assert value" tool generates expect(locator).toHaveValue(value).
- "Assert text" tool generates expect(locator).toContainText(text).
Here is an example of a generated test with assertions:
import { test, expect } from '@playwright/test';
test('test', async ({ page }) => {
await page.goto('https://playwright.dev/');
await page.getByRole('link', { name: 'Get started' }).click();
await expect(page.getByLabel('Breadcrumbs').getByRole('list')).toContainText('Installation');
await expect(page.getByLabel('Search')).toBeVisible();
await page.getByLabel('Search').click();
await page.getByPlaceholder('Search docs').fill('locator');
await expect(page.getByPlaceholder('Search docs')).toHaveValue('locator');
});
New APIs
- Option
reason
in page.close(), browserContext.close() and browser.close(). Close reason is reported for all operations interrupted by the closure. - Option
firefoxUserPrefs
in browserType.launchPersistentContext(userDataDir).
Other Changes
- Methods download.path() and download.createReadStream() throw an error for failed and cancelled downloads.
- Playwright docker image now comes with Node.js v20.
Browser Versions
- Chromium 120.0.6099.28
- Mozilla Firefox 119.0
- WebKit 17.4
This version was also tested against the following stable channels:
- Google Chrome 119
- Microsoft Edge 119