-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathhearings-list.spec.js
More file actions
68 lines (57 loc) · 2.3 KB
/
Copy pathhearings-list.spec.js
File metadata and controls
68 lines (57 loc) · 2.3 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { expect, test } from '@playwright/test';
test.describe('Hearing list page', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/hearings/list?lang=fi');
});
test('should have correct title', async ({ page }) => {
await expect(page).toHaveTitle(/.*kuulemiset/);
});
test('should display all headings', async ({ page }) => {
await expect(
page.getByRole('heading', { name: 'Kaikki kuulemiset' })
).toBeVisible();
});
test('should have search controls visibility', async ({ page }) => {
await expect.soft(page.getByText('Etsi otsikoista')).toBeVisible();
await expect.soft(page.getByText('Hae aiheista')).toBeVisible();
await expect
.soft(page.getByRole('button', { name: 'Etsi', exact: true }))
.toBeEnabled();
});
test('should perform a search', async ({ page }) => {
const searchTextInput = page.getByRole('searchbox', {
name: 'Etsi otsikoista',
});
// Check the default state of the select input
const input = page.locator('#formControlsSearchText input');
await expect.soft(input).toHaveValue('');
// Perform a search and validate the input value
const SEARCH_TEXT = 'Hello';
await searchTextInput.fill(SEARCH_TEXT);
await expect(searchTextInput).toHaveValue(SEARCH_TEXT);
});
test('swedish translations', async ({ page }) => {
await page.goto('/hearings/list?lang=sv');
await expect(page).toHaveTitle(/.*Alla höranden/);
await expect(
page.getByRole('heading', { name: 'Alla höranden' })
).toBeVisible();
await expect
.soft(page.getByRole('button', { name: 'Sök', exact: true }))
.toBeEnabled();
await expect.soft(page.getByText('Sök bland rubrikerna')).toBeVisible();
await expect.soft(page.getByText('Sök bland ämnena')).toBeVisible();
});
test('english translations', async ({ page }) => {
await page.goto('/hearings/list?lang=en');
await expect(page).toHaveTitle(/.*All hearings/);
await expect(
page.getByRole('heading', { name: 'All hearings' })
).toBeVisible();
await expect
.soft(page.getByRole('button', { name: 'Search', exact: true }))
.toBeEnabled();
await expect.soft(page.getByText('Search from titles')).toBeVisible();
await expect.soft(page.getByText('Search labels')).toBeVisible();
});
});