mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 14:11:50 +03:00
parent
c8f3c65d22
commit
4dac4772ca
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user