import { WebElement } from '@contour/fet/lib/elements'; import { Then } from '@cucumber/cucumber'; import KEYPRESS from '../../enum/keyPress'; import SideMenu from '../../pages/sideMenu/sideMenu.page'; import * as glue from './glue'; Then(/^I stop to debug$/, glue.debug); Then(/^I scroll to element "([^"]+)?"."([^"]+)?" and check with reference image "([^"]+)?"$/, glue.scrollToAndCheckVR); Then(/^I can see the page as following screenshots$/, glue.checkScreenshots); Then(/^I expect element "([^"]+)?"."([^"]+)?" matches the text "([^"]+)?"$/, glue.checkElementMatchText); Then( /^I expect (error|informational|success|warning) banner matches the text "([^"]+)?"$/, glue.checkBannerTextMatches ); Then(/^user is redirected to (forgot password|reset password|login|home|companySettings) page$/, glue.assertPage); Then(/^I press the (enter|esc) key$/, async (key) => { if (key == KEYPRESS.ENTER) { await browser.keys('\uE007'); } else { await browser.keys('\uE00C'); } }); Then(/(importParty|exportParty) refresh the browser$/, async (party) => { await browser.refresh(); if (party == 'exportParty') { const sideMenuPage = new SideMenu(); await sideMenuPage.getDcExportButton().clickElement(); } }); Then( /(importParty|exportParty) refreshes the browser until the (main|amendment) status matches the text "([^"]+)?"$/, glue.checkStatusAfterRefresh ); Then(/I reload the browser session$/, async () => { await browser.reloadSession(); }); Then('I click button with label {string}', async function (labelTxt: string) { await new WebElement(`//button[.='${labelTxt}']`).clickElement(); }); Then(/(importParty|exportParty) navigates to home page$/, async (party) => { const sideMenuPage = new SideMenu(); await sideMenuPage.getDcImportButton().clickElement(); if (party && party == 'exportParty') { await sideMenuPage.getDcExportButton().clickElement(); } });