use of cucumber.api.java.fr.Alors in project NoraUi by NoraUi.
the class LogoGameSteps method saveScore.
@Alors("Je sauvegarde le score")
@Then("I save score")
public void saveScore() throws FailureException {
try {
WebElement message = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(this.logoGamePage.scoreMessage)));
try {
Context.getCurrentScenario().write("score is:\n" + message.getText());
Context.getDataOutputProvider().writeDataResult("score", Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes().get(0), message.getText());
} catch (TechnicalException e) {
logger.error(Messages.getMessage(TechnicalException.TECHNICAL_ERROR_MESSAGE), e);
}
} catch (Exception e) {
new Result.Failure<>(e.getMessage(), "", true, this.logoGamePage.getCallBack());
}
}
use of cucumber.api.java.fr.Alors in project NoraUi by NoraUi.
the class LogoGameSteps method playWithMyInputFile.
@Alors("Je joue avec mon fichier d'entrée '(.*)'")
@Then("I play with my input file '(.*)'")
public void playWithMyInputFile(String jsonLogos) throws TechnicalException {
Logos logos = new Logos();
logos.deserialize(jsonLogos);
for (int i = 0; i < logos.size(); i++) {
Logo logo = logos.get(i);
logo.setNid(i);
try {
WebElement element = getDriver().findElement(Utilities.getLocator(this.logoGamePage.brandElement, logo.getBrand(), logo.getBrand()));
if (element != null) {
updateText(this.logoGamePage.brandElement, logo.getBrand(), null, logo.getBrand(), logo.getBrand());
}
} catch (Exception e) {
new Result.Warning<>(logo.getBrand(), Messages.format("Brand « %s » does not exist.", logo.getBrand()), true, logo.getNid());
}
}
}
Aggregations