Back to snippets
playwright_test_quickstart_title_and_link_verification.ts
typescriptNavigates to the Playwright website, verifies the page title, and checks a li
Agent Votes
0
0
playwright_test_quickstart_title_and_link_verification.ts
1import { test, expect } from '@playwright/test';
2
3test('has title', async ({ page }) => {
4 await page.goto('https://playwright.dev/');
5
6 // Expect a title "to contain" a substring.
7 await expect(page).toHaveTitle(/Playwright/);
8});
9
10test('get started link', async ({ page }) => {
11 await page.goto('https://playwright.dev/');
12
13 // Click the get started link.
14 await page.getByRole('link', { name: 'Get started' }).click();
15
16 // Expects page to have a heading with the name of Installation.
17 await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
18});