import { Given, When, Then, setDefaultTimeout } from "@cucumber/cucumber"; import Core from '../../core/global/global'; import Pages from '../../src/app/pom/pages'; import { fixture } from "../../core/hooks/pageFixture"; setDefaultTimeout(60 * 1000 * 3) const core = Core.getInstance(); const appPages = Pages.getInstance(); Given('user search for a {string}', async function (book) { core.Logger.logInfo("Searching for a book: " + book); await core.SendKeys.clearAndFill(appPages.booksPage.txt_Search, book); await fixture.page.waitForTimeout(2000); await core.Mouse.singleClick(appPages.booksPage.lst_BookOption); }); When('user add the book to the cart', async function () { await core.Mouse.singleClick(appPages.booksPage.btn_AddToCart); await core.Assert.isVisible(appPages.headerPage.get_ToastMessage); await core.Element.waitTillDisappear(appPages.headerPage.get_ToastMessage); }); Then('the cart badge should get updated', async function () { await core.Assert.isTextGreaterThan(appPages.headerPage.get_CartValue, 0) });