use of com.github.noraui.application.model.logogame.Logos in project NoraUi by NoraUi.
the class LogoGameSteps method checkThatAllBrandsIsNotProhibited.
/**
* A check that all brands are not prohibited, because any minors can not play with alcohol and tobacco brands.
*
* @param jsonLogos
* Serialized Json representation of all logos (all brands)
* @throws TechnicalException
* is throws if you have a technical error (format, configuration, datas, ...) in NoraUi.
* @throws FailureException
* if the scenario encounters a functional error
*/
@Lorsque("Je vérifie que toutes les marques '(.*)' ne sont pas interdites")
@Given("I check that all brands '(.*)' are not prohibited")
public void checkThatAllBrandsIsNotProhibited(String jsonLogos) throws TechnicalException, FailureException {
Logos logos = new Logos();
logos.deserialize(jsonLogos);
for (int i = 0; i < logos.size(); i++) {
if (ProhibitedBrands.getAlcool().contains(logos.get(i).getBrand()) || ProhibitedBrands.getTabaco().contains(logos.get(i).getBrand())) {
new Result.Failure<>(logos.get(i).getBrand(), Messages.format("Brand « %s » is prohibited.", logos.get(i).getBrand()), false, logos.get(i).getNid(), Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
}
}
}
use of com.github.noraui.application.model.logogame.Logos 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