-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy path001-home-page.spec.ts
59 lines (49 loc) · 2.13 KB
/
001-home-page.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import HomePage from './pages/home-page-model';
import { test, expect } from './playwright-fixture';
import enTranslations from '../public/locales/en/home/home.json';
import frTranslations from '../public/locales/fr/home/home.json';
test.describe('Home page OSRD', () => {
let homePage: HomePage;
test.beforeEach('Navigate to the home page', async ({ page }) => {
homePage = new HomePage(page);
await homePage.goToHomePage();
});
test.afterEach('Returns to the home page', async () => {
await homePage.backToHomePage();
});
/** *************** Test 1 **************** */
test('Verify the links for different pages in Home Page', async ({ OSRDLanguage }) => {
// Determine the correct translations based on the selected language
const translations = OSRDLanguage === 'English' ? enTranslations : frTranslations;
// List of expected links on the home page
const expectedLinks = [
translations.operationalStudies,
translations.stdcm,
translations.editor,
translations.rollingStockEditor,
translations.map,
];
// Verify that the displayed links match the expected ones
await expect(homePage.linksTitle).toHaveText(expectedLinks);
});
/** *************** Test 2 **************** */
test('Verify redirection to to the Operational Studies page', async () => {
await homePage.goToOperationalStudiesPage();
await expect(homePage.page).toHaveURL(/.*\/operational-studies/); // Check the URL
});
/** *************** Test 3 **************** */
test('Verify redirection toto the Map page', async () => {
await homePage.goToCartoPage();
await expect(homePage.page).toHaveURL(/.*\/map/);
});
/** *************** Test 4 **************** */
test('Verify redirection to to the Infrastructure editor page', async () => {
await homePage.goToEditorPage();
await expect(homePage.page).toHaveURL(/.*\/editor\/*/);
});
/** *************** Test 5 **************** */
test('Verify redirection to to the STDCM page', async ({ context }) => {
const stdcmPage = await homePage.goToSTDCMPage(context);
await expect(stdcmPage).toHaveURL(/.*\/stdcm/);
});
});