import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import { expect } from "@playwright/test"; import { fixture } from "../../core/hooks/pageFixture"; import Core from '../../core/global/global'; import Pages from '../../src/app/pom/pages'; setDefaultTimeout(60 * 1000 * 3) const core = Core.getInstance(); const appPages = Pages.getInstance(); Given('User navigates to the application', async function () { await core.Browser.navigateTo(process.env.BASEURL) }) Given('User click on the login link', async function () { await core.Mouse.singleClick(appPages.headerPage.lnk_Login); }); Given('User enter the username as {string}', async function (username) { await core.SendKeys.clearAndFill(appPages.loginPage.txt_Username, username); }); Given('User enter the password as {string}', async function (password) { await core.SendKeys.clearAndFillPassword(appPages.loginPage.pwd_Password, password); }) When('User click on the login button', async function () { await fixture.page.waitForTimeout(2000); await core.Mouse.clickButtonAndWait(appPages.loginPage.btn_Login); }); Then('Login should be success', async function () { await core.Assert.isVisible(appPages.headerPage.lnk_LoggedInUserName); await core.Assert.getText(appPages.headerPage.lnk_LoggedInUserName); }) Then('Login should fail', async function () { await core.Assert.isVisible(appPages.loginPage.lbl_ErrorMessage); });