-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsteps.ts
More file actions
29 lines (22 loc) · 810 Bytes
/
steps.ts
File metadata and controls
29 lines (22 loc) · 810 Bytes
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
import { Given, When, Then, After } from '@wdio/cucumber-framework'
import { browser, expect } from '@wdio/globals'
import LoginPage from '../pageobjects/login.page.js'
import SecurePage from '../pageobjects/secure.page.js'
const pages = {
login: LoginPage
} as const
After(async () => {
await browser.reloadSession()
})
Given(/^I am on the (\w+) page$/, async (page: keyof typeof pages) => {
await pages[page].open()
})
When(/^I login with (\w+) and (.+)$/, async (username, password) => {
await LoginPage.login(username, password)
})
Then(/^I should see a flash message saying (.*)$/, async (message) => {
const el = await SecurePage.flashAlert
await expect(el).toBeExisting()
await expect(el).toHaveText(expect.stringContaining(message))
await browser.pause(15000)
})