File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
2
const { test, expect } = require ( '@playwright/test' ) ;
3
3
4
- test ( 'homepage has title and links to intro page ' , async ( { page } ) => {
4
+ test ( 'has title' , async ( { page } ) => {
5
5
await page . goto ( 'https://playwright.dev/' ) ;
6
6
7
7
// Expect a title "to contain" a substring.
8
8
await expect ( page ) . toHaveTitle ( / P l a y w r i g h t / ) ;
9
+ } ) ;
9
10
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/' ) ;
15
13
16
14
// Click the get started link.
17
- await getStarted . click ( ) ;
18
-
15
+ await page . getByRole ( 'link' , { name : 'Get started' } ) . click ( ) ;
16
+
19
17
// Expects the URL to contain intro.
20
18
await expect ( page ) . toHaveURL ( / .* i n t r o / ) ;
21
19
} ) ;
Original file line number Diff line number Diff line change 1
1
import { test , expect } from '@playwright/test' ;
2
2
3
- test ( 'homepage has title and links to intro page ' , async ( { page } ) => {
3
+ test ( 'has title' , async ( { page } ) => {
4
4
await page . goto ( 'https://playwright.dev/' ) ;
5
5
6
6
// Expect a title "to contain" a substring.
7
7
await expect ( page ) . toHaveTitle ( / P l a y w r i g h t / ) ;
8
+ } ) ;
8
9
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/' ) ;
14
12
15
13
// Click the get started link.
16
- await getStarted . click ( ) ;
14
+ await page . getByRole ( 'link' , { name : 'Get started' } ) . click ( ) ;
17
15
18
16
// Expects the URL to contain intro.
19
17
await expect ( page ) . toHaveURL ( / .* i n t r o / ) ;
You can’t perform that action at this time.
0 commit comments