test('Should click on main menu [Snapshot]', async t => { await t.rightClick('body'); const snapshot = await getContextMenuItem(['Test']); await clickOnContextMenuItem(snapshot); await t.expect(checkContextMenuClicked()).ok(); });
fixture`Test checkout summary page` .beforeEach(async t => { await t.resizeWindow(1366, 768); await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CART, products: [PRODUCTS.BACKPACK], }); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); await MenuPage.open(); });
test('should validate that we can go from the cart to the checkout page', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CART, }); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); await CartSummaryPage.goToCheckout(); await t.expect(CheckoutPersonalInfoPage.isScreenDisplayed()).ok(); });
test('Should click on main menu [Selector]', async t => { await t.click('body'); await clickOnMainMenuItem(['Test', 'Click']); await t.expect(checkMainMenuClicked()).ok(); });
test('should validate that we can continue shopping', async t => { await CheckoutSummaryPage.finishCheckout(); await t.expect(CheckoutCompletePage.isScreenDisplayed()).ok(); });
fixture`Test checkout overview page` .beforeEach(async t => { await t.resizeWindow(1366, 768); await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CHECKOUT_PERSONAL_INFO, }); await t.expect(CheckoutPersonalInfoPage.isScreenDisplayed()).ok(); });
test('Take screenshot', async t => { var screenshotName = getTempFileName({ template: 'screenshot-XXXXXX.png' }); var screenshotPath = path.join('.screenshots', screenshotName); await t.takeScreenshot(screenshotName); await t.expect(statSync(screenshotPath).isFile()).ok(); });
test('should validate that we can cancel the first checkout', async t => { await t.expect(CartSummaryPage.isScreenDisplayed()).notOk(); await CheckoutPersonalInfoPage.cancelCheckout(); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); });
test('should validate we get an error if we don not provide all personal information', async t => { // It doesn't matter which error we check here, all error states should have been tested in a UT // Reason for selecting this one is that it triggers multiple fields and thus triggers the state await CheckoutPersonalInfoPage.submitPersonalInfo(PERSONAL_INFO.NO_POSTAL_CODE); await t.expect(CheckoutPersonalInfoPage.isScreenDisplayed()).ok(); await t.expect(CheckoutPersonalInfoPage.getErrorMessage()).eql('Error: Postal Code is required'); });
test('should be able to open the cart summary page', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.SWAG_ITEMS, }); // The actual test await AppHeaderPage.openCart(); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); });
test('Should click on main menu [Snapshot]', async t => { await t.click('body'); const snapshot = await getMainMenuItem(['Test', 'Click']); await clickOnMainMenuItem(snapshot); await t.expect(checkMainMenuClicked()).ok(); });
test('Should click on main menu [Selector]', async t => { await t.rightClick('body'); await clickOnContextMenuItem(['Test']); await t.expect(checkContextMenuClicked()).ok(); });
fixture`Test checkout summary page` .beforeEach(async t => { await t.resizeWindow(1366, 768); await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CHECKOUT_SUMMARY, products: [PRODUCTS.BACKPACK], }); await t.expect(CheckoutSummaryPage.isScreenDisplayed()).ok(); });
test('should validate that we can continue shopping', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CHECKOUT_COMPLETE, }); await t.expect(CheckoutCompletePage.isScreenDisplayed()).ok(); });
test('should validate that we can continue shopping', async t => { await setTestContext({ baseUrl: LoginPage.url, user: LOGIN_USERS.STANDARD, path: PAGES.CART, }); await t.expect(CartSummaryPage.isScreenDisplayed()).ok(); await CartSummaryPage.continueShopping(); await t.expect(SwagOverviewPage.isScreenDisplayed()).ok(); });