@@ -36,6 +36,7 @@ export interface ConsistFields {
36
36
}
37
37
const EXPECT_TO_PASS_TIMEOUT = 90_000 ; // Since toPass ignores custom expect timeouts, this timeout is set to account for all actions within the function.
38
38
const MINIMUM_SIMULATION_NUMBER = 1 ;
39
+
39
40
class STDCMPage {
40
41
readonly page : Page ;
41
42
@@ -65,6 +66,14 @@ class STDCMPage {
65
66
66
67
readonly addViaButton : Locator ;
67
68
69
+ readonly anteriorLinkedTrainContainer : Locator ;
70
+
71
+ readonly anteriorAddLinkedPathButton : Locator ;
72
+
73
+ readonly posteriorLinkedTrainContainer : Locator ;
74
+
75
+ readonly posteriorAddLinkedPathButton : Locator ;
76
+
68
77
readonly launchSimulationButton : Locator ;
69
78
70
79
readonly originChField : Locator ;
@@ -175,6 +184,16 @@ class STDCMPage {
175
184
this . speedLimitTagField = page . locator ( '#speed-limit-by-tag-selector' ) ;
176
185
this . maxSpeedField = page . locator ( '#maxSpeed' ) ;
177
186
this . addViaButton = page . locator ( '.stdcm-vias-list button .stdcm-card__body.add-via' ) ;
187
+ this . anteriorLinkedTrainContainer = page . locator (
188
+ '.stdcm-linked-train-search-container.anterior-linked-train'
189
+ ) ;
190
+ this . anteriorAddLinkedPathButton =
191
+ this . anteriorLinkedTrainContainer . locator ( '.add-linked-train' ) ;
192
+ this . posteriorLinkedTrainContainer = page . locator (
193
+ '.stdcm-linked-train-search-container.posterior-linked-train'
194
+ ) ;
195
+ this . posteriorAddLinkedPathButton =
196
+ this . posteriorLinkedTrainContainer . locator ( '.add-linked-train' ) ;
178
197
this . launchSimulationButton = page . getByTestId ( 'launch-simulation-button' ) ;
179
198
this . originChField = this . originCard . locator ( '[id^="id"][id$="-ch"]' ) ;
180
199
this . destinationChField = this . destinationCard . locator ( '[id^="id"][id$="-ch"]' ) ;
@@ -299,6 +318,8 @@ class STDCMPage {
299
318
this . consistCard ,
300
319
this . originCard ,
301
320
this . addViaButton ,
321
+ this . anteriorAddLinkedPathButton ,
322
+ this . posteriorAddLinkedPathButton ,
302
323
this . destinationCard ,
303
324
this . mapContainer ,
304
325
this . launchSimulationButton ,
@@ -309,7 +330,7 @@ class STDCMPage {
309
330
}
310
331
311
332
// Verify all input fields are empty
312
- async verifyAllFieldsEmpty ( ) {
333
+ async verifyAllDefaultPageFields ( ) {
313
334
const emptyFields = [
314
335
this . tractionEngineField ,
315
336
this . towedRollingStockField ,
@@ -321,20 +342,28 @@ class STDCMPage {
321
342
this . originChField ,
322
343
this . destinationChField ,
323
344
] ;
345
+ const { arrivalDate, arrivalTime, tolerance, speedLimitTag } = DEFAULT_DETAILS ;
324
346
for ( const field of emptyFields ) await expect ( field ) . toHaveValue ( '' ) ;
325
- await expect ( this . speedLimitTagField ) . toHaveValue ( '__PLACEHOLDER__' ) ;
347
+ await expect ( this . originArrival ) . toHaveValue ( ORIGIN_DETAILS . arrivalType . default ) ;
348
+ await expect ( this . destinationArrival ) . toHaveValue ( DESTINATION_DETAILS . arrivalType . default ) ;
349
+ await expect ( this . speedLimitTagField ) . toHaveValue ( speedLimitTag ) ;
350
+ await expect ( this . dateOriginArrival ) . toHaveValue ( arrivalDate ) ;
351
+ await expect ( this . timeOriginArrival ) . toHaveValue ( arrivalTime ) ;
352
+ await expect ( this . toleranceOriginArrival ) . toHaveValue ( tolerance ) ;
326
353
}
327
354
328
355
// Add a via card, verify fields, and delete it
329
- async addAndDeleteEmptyVia ( ) {
356
+ async addAndDeletedDefaultVia ( ) {
330
357
await this . addViaButton . click ( ) ;
331
358
await expect ( this . getViaCI ( 1 ) ) . toHaveValue ( '' ) ;
332
359
await expect ( this . getViaCH ( 1 ) ) . toHaveValue ( '' ) ;
360
+ await expect ( this . getViaType ( 1 ) ) . toHaveValue ( VIA_STOP_TYPES . PASSAGE_TIME ) ;
333
361
await this . viaIcon . hover ( ) ;
334
362
await expect ( this . viaDeleteButton ) . toBeVisible ( ) ;
335
363
await this . viaDeleteButton . click ( ) ;
336
364
await expect ( this . getViaCI ( 1 ) ) . not . toBeVisible ( ) ;
337
365
await expect ( this . getViaCH ( 1 ) ) . not . toBeVisible ( ) ;
366
+ await expect ( this . getViaType ( 1 ) ) . not . toBeVisible ( ) ;
338
367
}
339
368
340
369
// Verify the origin suggestions when searching for north
0 commit comments