-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-6037 E2E tests on navigation through simulation
- Loading branch information
Showing
14 changed files
with
230 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { When } from '@cucumber/cucumber'; | ||
import { ScenarioWorld } from './setup/world'; | ||
import { waitFor } from '../support/wait-for-behavior'; | ||
import moment from 'moment'; | ||
|
||
When(/^I observe the "([^"]*)" time$/, | ||
async function (this: ScenarioWorld, timeLabel: string) { | ||
const { | ||
screen: { page }, | ||
globalConfig: { simulatorDateFormat }, | ||
globalStateManager | ||
} = this; | ||
|
||
await waitFor(async() => { | ||
const name = `${timeLabel} time`; | ||
const locator = await page.getByRole("heading", { name, exact: true }); | ||
const dateString = await locator.textContent(); | ||
if (dateString) { | ||
const originalTime = moment(dateString, simulatorDateFormat).toDate(); | ||
globalStateManager.appendValue(name, originalTime); | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class GlobalStateManager { | ||
private state: Record<string, any[]>; | ||
|
||
constructor() { | ||
this.state = {}; | ||
} | ||
|
||
appendValue(key: string, incredmentalValue: any): void { | ||
this.state[key] = this.state[key] || []; | ||
this.state[key].push(incredmentalValue); | ||
} | ||
|
||
popValue(key: string): any { | ||
return this.state[key].pop(); | ||
} | ||
|
||
getValue(key: string): any { | ||
const values = this.state[key]; | ||
return values[values.length - 1]; | ||
} | ||
|
||
// method to get value by key | ||
get(key: string): any[] { | ||
return this.state[key]; | ||
} | ||
|
||
// method to set value by key | ||
set(key: string, value: any[]): void { | ||
this.state[key] = value; | ||
} | ||
} | ||
|
||
export default GlobalStateManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1967,6 +1967,11 @@ mkdirp@^2.1.5: | |
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.6.tgz" | ||
integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== | ||
|
||
moment@^2.29.4: | ||
version "2.29.4" | ||
resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz" | ||
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== | ||
|
||
[email protected]: | ||
version "2.1.2" | ||
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" | ||
|
Oops, something went wrong.