Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs(intro): Fix writing assertions snippet (#8372)
Anish Karandikar4dac4772ca85
diff --git a/docs/src/intro-js.md b/docs/src/intro-js.mdindex 4c91499da0..db57da7440 100644--- a/docs/src/intro-js.md+++ b/docs/src/intro-js.md@@ -100,17 +100,17 @@ test('my test', async ({ page }) => {await page.goto('https://playwright.dev/');// Expect a title "to contain" a substring.- await expect(page).toHaveTitle('Playwright');+ await expect(page).toHaveTitle(/Playwright/);// Expect an attribute "to be strictly equal" to the value.- await expect(page.locator('text=Get Started')).toHaveAttribute('href', '/docs/intro');+ await expect(page.locator('text=Get Started').first()).toHaveAttribute('href', '/docs/intro');// Expect an element "to be visible".- await expect(page.locator('text=Learn more')).toBeVisible();+ await expect(page.locator('text=Learn more').first()).toBeVisible();await page.click('text=Get Started');// Expect some text to be visible on the page.- await expect(page.locator('text=System requirements')).toBeVisible();+ await expect(page.locator('text=System requirements').first()).toBeVisible();// Compare screenshot with a stored reference.expect(await page.screenshot()).toMatchSnapshot('get-started.png');@@ -125,17 +125,17 @@ test('my test', async ({ page }) => {await page.goto('https://playwright.dev/');// Expect a title "to contain" a substring.- await expect(page).toHaveTitle('Playwright');+ await expect(page).toHaveTitle(/Playwright/);// Expect an attribute "to be strictly equal" to the value.- await expect(page.locator('text=Get Started')).toHaveAttribute('href', '/docs/intro');+ await expect(page.locator('text=Get Started').first()).toHaveAttribute('href', '/docs/intro');// Expect an element "to be visible".- await expect(page.locator('text=Learn more')).toBeVisible();+ await expect(page.locator('text=Learn more').first()).toBeVisible();await page.click('text=Get Started');// Expect some text to be visible on the page.- await expect(page.locator('text=System requirements')).toBeVisible();+ await expect(page.locator('text=System requirements').first()).toBeVisible();// Compare screenshot with a stored reference.expect(await page.screenshot()).toMatchSnapshot('get-started.png');