Skip to content

Commit 2ab2b84

Browse files
authored
chore: update examples (#71)
1 parent 38ad371 commit 2ab2b84

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

assets/example.spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
// @ts-check
22
const { test, expect } = require('@playwright/test');
33

4-
test('homepage has title and links to intro page', async ({ page }) => {
4+
test('has title', async ({ page }) => {
55
await page.goto('https://playwright.dev/');
66

77
// Expect a title "to contain" a substring.
88
await expect(page).toHaveTitle(/Playwright/);
9+
});
910

10-
// create a locator
11-
const getStarted = page.getByRole('link', { name: 'Get started' });
12-
13-
// Expect an attribute "to be strictly equal" to the value.
14-
await expect(getStarted).toHaveAttribute('href', '/docs/intro');
11+
test('get started link', async ({ page }) => {
12+
await page.goto('https://playwright.dev/');
1513

1614
// Click the get started link.
17-
await getStarted.click();
18-
15+
await page.getByRole('link', { name: 'Get started' }).click();
16+
1917
// Expects the URL to contain intro.
2018
await expect(page).toHaveURL(/.*intro/);
2119
});

assets/example.spec.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
import { test, expect } from '@playwright/test';
22

3-
test('homepage has title and links to intro page', async ({ page }) => {
3+
test('has title', async ({ page }) => {
44
await page.goto('https://playwright.dev/');
55

66
// Expect a title "to contain" a substring.
77
await expect(page).toHaveTitle(/Playwright/);
8+
});
89

9-
// create a locator
10-
const getStarted = page.getByRole('link', { name: 'Get started' });
11-
12-
// Expect an attribute "to be strictly equal" to the value.
13-
await expect(getStarted).toHaveAttribute('href', '/docs/intro');
10+
test('get started link', async ({ page }) => {
11+
await page.goto('https://playwright.dev/');
1412

1513
// Click the get started link.
16-
await getStarted.click();
14+
await page.getByRole('link', { name: 'Get started' }).click();
1715

1816
// Expects the URL to contain intro.
1917
await expect(page).toHaveURL(/.*intro/);

0 commit comments

Comments
 (0)