use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ApicurioSteps method removeWarning.
@ExcludeFromSelectorReports
@When("^remove warning via apicurio gui$")
public void removeWarning() {
$(Elements.WARNING_ICON).shouldBe(visible).click();
// there isn't really a nice way how to wait as the box is there all the time, we are waiting for different items to show
TestUtils.sleepForJenkinsDelayIfHigher(10);
SelenideElement firstProblemElement = $(Elements.PROBLEMS_CONTAINER).shouldBe(visible).$$(Elements.VALIDATION_PROBLEM).get(2);
assertThat(firstProblemElement).isNotNull();
assertThat(firstProblemElement.text()).containsIgnoringCase("Operation Summary should be less than 120 characters");
try {
firstProblemElement.shouldBe(visible).$(By.tagName("a")).shouldBe(visible).click();
} catch (org.openqa.selenium.StaleElementReferenceException e) {
$(Elements.PROBLEMS_CONTAINER).shouldBe(visible).$$(Elements.VALIDATION_PROBLEM).get(0).shouldBe(visible).$(By.tagName("a")).shouldBe(visible).click();
}
$(Elements.WARNING_ICON).shouldBe(visible).click();
$(Elements.INFO_SECTION).shouldBe(visible).$(TextFormElements.SUMMARY).shouldBe(visible).click();
SelenideElement input = $(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible);
try {
input.clear();
input.sendKeys("Short description");
} catch (org.openqa.selenium.StaleElementReferenceException e) {
$(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible).clear();
$(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible).sendKeys("Short description");
}
$(Elements.INFO_SECTION).$(TextFormElements.SAVE).shouldBe(visible).click();
$(Elements.WARNING_ICON).shouldBe(visible).getText();
assertThat($(Elements.WARNING_ICON).shouldBe(visible).getText()).containsIgnoringCase("57");
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ApicurioSteps method clickOnApicurioButton.
@When("^click on the \"([^\"]*)\" apicurio button*$")
public void clickOnApicurioButton(String buttonTitle) {
SelenideElement button = getApicurioButton(buttonTitle);
log.info("apicurio button found *{}*", button.toString());
button.shouldBe(visible, enabled).shouldNotHave(attribute("disabled")).click();
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ExtensionSteps method uploadExtensionFromFile.
/**
* Uploads an extension from any relative path
*
* @param extensionName
* @param extensionPath
* @throws Throwable
*/
@When("^upload extension with name \"([^\"]*)\" from relative path \"([^\"]*)\"$")
public void uploadExtensionFromFile(String extensionName, String extensionPath) throws Throwable {
String techExtensionUrl = extensionPath + extensionName;
Path techExtensionJar = Paths.get(techExtensionUrl).toAbsolutePath();
UploadFile.uploadFile($(By.tagName("input")).should(exist), techExtensionJar.toFile());
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class DataMapperSteps method combineDataMapperStep.
@When("COMBINE using Step {int} and strategy {string} into {string} and sources")
public void combineDataMapperStep(int fromStep, String strategy, String targetField, DataTable sourceMappingData) {
DataMapperStepDefinition newDmStep = new DataMapperStepDefinition();
newDmStep.setFromStep(fromStep);
newDmStep.setInputFields(sourceMappingData.transpose().asList(String.class));
newDmStep.setOutputFields(Collections.singletonList(targetField));
newDmStep.setMappingType(MappingType.COMBINE);
newDmStep.setStrategy(SeparatorType.valueOf(strategy));
super.getSteps().getLastStepDefinition().getDataMapperDefinition().getDataMapperStepDefinition().add(newDmStep);
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class DataMapperSteps method addTransformation.
@When("add {string} transformation on {string} field with id {string} with properties")
public void addTransformation(String transformation, String target, String id, DataTable properties) {
try {
Class<?> c = Class.forName("io.atlasmap.v2." + StringUtils.capitalize(transformation));
Constructor<?> cons = c.getConstructor();
Object t = cons.newInstance();
Map<String, String> stringProperties = properties.asMap(String.class, String.class);
for (Map.Entry<String, String> entry : stringProperties.entrySet()) {
Field f = c.getDeclaredField(entry.getKey());
f.setAccessible(true);
f.set(t, entry.getValue());
}
Map<String, Map<String, List<Object>>> transformations = super.getSteps().getLastStepDefinition().getDataMapperDefinition().getLastDatamapperStepDefinition().getTransformations();
transformations.computeIfAbsent(target, v -> new HashMap<>());
transformations.get(target).computeIfAbsent(id, v -> new ArrayList<>());
transformations.get(target).get(id).add(t);
} catch (Exception e) {
fail("Unable to create atlasmap class for " + transformation, e);
}
}
Aggregations