Skip to content

Commit b8d5082

Browse files
committed
Example test case update
1 parent aa2e224 commit b8d5082

File tree

1 file changed

+8
-3
lines changed
  • example/features/step-definitions

1 file changed

+8
-3
lines changed

example/features/step-definitions/steps.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Given, When, Then } from '@wdio/cucumber-framework'
1+
import { Given, When, Then, After } from '@wdio/cucumber-framework'
22
import { browser, expect } from '@wdio/globals'
33

44
import LoginPage from '../pageobjects/login.page.js'
@@ -8,6 +8,10 @@ const pages = {
88
login: LoginPage
99
} as const
1010

11+
After(async () => {
12+
await browser.reloadSession()
13+
})
14+
1115
Given(/^I am on the (\w+) page$/, async (page: keyof typeof pages) => {
1216
await pages[page].open()
1317
})
@@ -17,8 +21,9 @@ When(/^I login with (\w+) and (.+)$/, async (username, password) => {
1721
})
1822

1923
Then(/^I should see a flash message saying (.*)$/, async (message) => {
20-
await expect(SecurePage.flashAlert).toBeExisting()
21-
await expect(SecurePage.flashAlert).toHaveText(message)
24+
const el = await SecurePage.flashAlert
25+
await expect(el).toBeExisting()
26+
await expect(el).toHaveText(expect.stringContaining(message))
2227
await browser.pause(15000)
2328
})
2429

0 commit comments

Comments
 (0)