import { Given, Then, When } from '@wdio/cucumber-framework'; import { expect } from '@wdio/globals'; import { getElement } from '../selectors/actionHelper.js'; Given('the user is on the login page', async () => { await browser.url('/login'); }); When(/^the user logs in with (\\w+) and (.+)$/, async (username: string, password: string) => { await (await getElement('loginPage.inputUsername')).setValue(username); await (await getElement('loginPage.inputPassword')).setValue(password); await (await getElement('loginPage.submitButton')).click(); }); Then('the user should see a flash message containing {string}', async (message: string) => { await expect(await getElement('securePage.flashAlert')).toHaveText(expect.stringContaining(message)); }); Then('the login form should no longer be visible', async () => { await getElement('loginPage.inputUsername', false); });