forked from Azure-Samples/contoso-real-estate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-basic.spec.ts
39 lines (27 loc) · 1.2 KB
/
01-basic.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { test, expect } from '@playwright/test';
// Here, "/" maps to the BASE_URL defined in playwright.config.ts "use"
// Other routes can thus be mapped to relative paths from BASE_URL
test('homepage has VISIBLE "Developer Guide" title in banner', async ({ page }) => {
await page.goto('/');
await page.getByRole('heading', { name: '/Developer Guide/' })
.isVisible();
});
test('homepage has CLICKABLE "Explore The Guide" link in banner', async ({ page }) => {
// Go to the default BASE_URL (referenced by "/")
await page.goto('/');
await page.getByRole('link', { name: 'Explore The Guide 🔎' })
.isVisible();
});
test('clicking "Explore The Guide" link in banner takes us elsewhere', async ({ page }) => {
// Go to the default BASE_URL (referenced by "/")
await page.goto('/');
await page.getByRole('link', { name: 'Explore The Guide 🔎' })
.click();
await expect(page).toHaveURL('/intro');
});
test('site has a VALID /api route with specified banner title', async ({ page }) => {
// Go to the default BASE_URL (referenced by "/")
await page.goto('/api');
await page.getByRole('heading', { name: '/Contoso Real Estate API/' })
.isVisible();
});