I'm refactoring my script and am currently doing the following;
When("I click the button {string}", (buttonID, next) => {
pageElement = driver.findElement(By.id(buttonID));
driver.wait(until.elementIsVisible(pageElement), 10000);
pageElement.click();
next();
});
And("I click the button {string}", (buttonID, next) => {
pageElement = driver.findElement(By.id(buttonID));
driver.wait(until.elementIsVisible(pageElement), 10000);
pageElement.click();
next();
});
I am doing this because of readability purposes, i have a scenario where 'And' is more readable and also scenarios where 'When' is more applicable.
I've seen the following..
@Then("^(?:it's do something|it's do another thing)$");
Which allows for multiple scenario names to be used for the same function but sadly, i'm looking for the opposite.
Any help would be greatly appreciated.