|
1 | 1 | import { type Locator, type Page, expect } from '@playwright/test';
|
2 | 2 |
|
3 |
| -class PlaywrightScenarioPage { |
| 3 | +import BasePage from './base-page'; |
| 4 | +import manageTrainScheduleTranslation from '../../public/locales/fr/operationalStudies/manageTrainSchedule.json'; |
| 5 | + |
| 6 | +const trainAddedTranslation = manageTrainScheduleTranslation.trainAdded; |
| 7 | + |
| 8 | +class PlaywrightScenarioPage extends BasePage { |
4 | 9 | readonly getScenarioUpdateBtn: Locator;
|
5 | 10 |
|
6 | 11 | readonly getScenarioDeleteConfirmBtn: Locator;
|
@@ -57,10 +62,6 @@ class PlaywrightScenarioPage {
|
57 | 62 |
|
58 | 63 | readonly getReturnSimulationResultBtn: Locator;
|
59 | 64 |
|
60 |
| - readonly getToastSNCF: Locator; |
61 |
| - |
62 |
| - readonly getToastSNCFTitle: Locator; |
63 |
| - |
64 | 65 | readonly getPathfindingState: Locator;
|
65 | 66 |
|
66 | 67 | readonly getSearchByTrigramButton: Locator;
|
@@ -92,6 +93,8 @@ class PlaywrightScenarioPage {
|
92 | 93 | readonly getSuccessBtn: Locator;
|
93 | 94 |
|
94 | 95 | constructor(readonly page: Page) {
|
| 96 | + super(page); |
| 97 | + |
95 | 98 | this.getRollingStockSelector = page.getByTestId('rollingstock-selector-empty');
|
96 | 99 | this.getScenarioUpdateBtn = page.getByTitle('Modifier le scénario');
|
97 | 100 | this.getScenarioDeleteConfirmBtn = page
|
@@ -134,8 +137,6 @@ class PlaywrightScenarioPage {
|
134 | 137 | .locator('.scenario-timetable-trains')
|
135 | 138 | .locator('.scenario-timetable-train');
|
136 | 139 | this.getReturnSimulationResultBtn = page.getByTestId('return-simulation-result');
|
137 |
| - this.getToastSNCF = page.getByTestId('toast-SNCF'); |
138 |
| - this.getToastSNCFTitle = this.getToastSNCF.getByTestId('toast-SNCF-title'); |
139 | 140 | this.getPathfindingState = page.locator('.pathfinding-state-main-container');
|
140 | 141 | this.getTimetableList = page.locator('.scenario-timetable-train-with-right-bar');
|
141 | 142 | this.getTrainEditBtn = page.locator('.scenario-timetable-train-buttons-update');
|
@@ -241,12 +242,8 @@ class PlaywrightScenarioPage {
|
241 | 242 | await this.getReturnSimulationResultBtn.click();
|
242 | 243 | }
|
243 | 244 |
|
244 |
| - async checkToastSNCFTitle() { |
245 |
| - await expect(this.getToastSNCFTitle).not.toBeEmpty(); |
246 |
| - } |
247 |
| - |
248 |
| - async checkToastSNCFBody(text: string | RegExp) { |
249 |
| - await expect(this.getToastSNCF.locator('.toast-body')).toHaveText(text); |
| 245 | + async checkTrainHasBeenAdded() { |
| 246 | + this.checkLastToastTitle(trainAddedTranslation); |
250 | 247 | }
|
251 | 248 |
|
252 | 249 | getBtnByName(name: string | RegExp) {
|
|
0 commit comments