import { Button } from '@contour/fet/lib/elements/button'; import { When } from '@cucumber/cucumber'; import { ContourAlert } from '../../elements/contourAlert'; import ContourSpinner from '../../elements/contourSpinner'; import * as glue from './glue'; import { refreshPageIfBnoIsNotAvailable } from './glue/refreshPageIfBnoIsNotAvailable'; When(/^I click on the button "([^"]+)?"."([^"]+)?" and confirm$/, async (page, element) => { const clickButton = new Button(contourfet.getPageElement(page, element)); const confirmButton = new Button(contourfet.getPageElement('actionButton', 'confirmButton')); await clickButton.clickElement(); await confirmButton.clickElement(); await confirmButton.checkIsDisplayed(true); }); When(/^I click on the button "([^"]+)?"."([^"]+)?" and submit$/, async (page, element) => { const clickButton = new Button(contourfet.getPageElement(page, element)); const submitButton = new Button(contourfet.getPageElement('actionButton', 'submitButton')); await clickButton.clickElement(); await submitButton.clickElement(); await submitButton.checkIsDisplayed(true); }); When( /^I set the following value into following (inputfield|contourNumbericInput|contourSelect) in page "([^"]+)?"$/, glue.setInputFieldFromDataTable ); When(/^I wait until loading icon is hidden$/, async () => { await new ContourSpinner().waitForLoadingToComplete(); }); When('I click on the button {string} in alert', async (btnLabel: string) => { await new ContourAlert().clickButtonByLabelTxt(btnLabel); }); When(/^I refresh page if BNO is not available$/, refreshPageIfBnoIsNotAvailable); When(/^I reload the current page$/, async () => { await browser.refresh(); }); When(/^I scroll to and click element "([^"]+)?"."([^"]+)?"$/, glue.scrollToAndClick);