-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnav-menu.spec.js
executable file
·37 lines (33 loc) · 1.33 KB
/
nav-menu.spec.js
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
import {test, expect} from '@playwright/test';
test.describe('test regular viewport', () => {
test('test english button', async ({page}) => {
await page.goto('/', {waitUntil: 'networkidle'});
await page.getByRole('button', {name: 'Sprache wechseln'}).click();
await page.getByRole('menuitem', {name: 'English'}).waitFor();
await page.getByRole('menuitem', {name: 'English'}).click();
await page.waitForURL('**/en/', {waitUntil: 'networkidle'});
await expect(page).toHaveURL(/.*en.*/);
});
test('test sub menu in bottom nav', async ({page}) => {
await page.goto('/', {waitUntil: 'networkidle'});
await page.getByRole('link', {name: 'Über uns'}).hover();
await page.getByRole('link', {name: 'Partner'}).click();
await expect(page.getByRole('link', {name: 'Über uns'})).toHaveCSS(
'color',
'rgb(56, 99, 162)',
);
});
});
test.describe('test iPhone SE viewport', () => {
test.use({viewport: {width: 375, height: 667}});
test('mobile nav menu', async ({page}) => {
await page.goto('/', {waitUntil: 'networkidle'});
await page.getByRole('button').click();
await page
.getByRole('navigation', {name: 'Main'})
.getByRole('link', {name: 'Blog'})
.click();
await page.waitForNavigation({url: '**/blog/'});
await expect(page).toHaveURL(/.*blog.*/);
});
});