use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ApicurioSteps method setParametersTypes.
/**
* Table parameters:
* Type of dropdown --> type | of | as | required
* Value of dropdown --> Array | String | Integer | ...
* Page where dropdown is located --> path | operations | datatypes
* Section where dropdown is located --> query | header | response | request body
* Boolean if dropdown is in Responses section --> true it is , false otherwise
* Number of response --> 100 | 200 | 404 | ...
*/
@When("set parameters types")
public void setParametersTypes(DataTable table) {
for (List<String> dataRow : table.cells()) {
String buttonId = ApicurioUtils.getButtonId(dataRow.get(0));
SelenideElement page = ApicurioUtils.getPageElement(dataRow.get(2));
By section = By.cssSelector("responses-section");
if (Boolean.parseBoolean(dataRow.get(4))) {
ApicurioUtils.selectResponse(dataRow.get(5));
} else {
ApicurioUtils.openCollapsedSection(page, section);
}
ApicurioUtils.setDropDownValue(buttonId, dataRow.get(1), page.$(section));
}
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ApicurioSteps method setDescriptionPathParameter.
/**
* @param page can only have values "path" and "operations"
*/
@When("^set description \"([^\"]*)\" for path parameter \"([^\"]*)\" on \"([^\"]*)\" page")
public void setDescriptionPathParameter(String description, String parameter, String page) {
SelenideElement root = ApicurioUtils.getPageElement(page);
ApicurioUtils.openPathDescription(parameter, root);
ApicurioUtils.setValueInTextArea(description, root.$(PathElements.PARAMETERS_SECTION));
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class ApicurioSteps method setPathParameterTypeForPathParameter.
/**
* @param page can only have values "path" and "operations"
*/
@When("^set path parameter type \"([^\"]*)\" for path parameter \"([^\"]*)\" on \"([^\"]*)\" page")
public void setPathParameterTypeForPathParameter(String type, String parameter, String page) {
SelenideElement root = ApicurioUtils.getPageElement(page);
ApicurioUtils.openPathTypes(parameter, root);
SelenideElement parameterElement = root.$(PathElements.PARAMETERS_SECTION).$$(PathElements.PATH_PARAMETERS_ROW).filter(text(parameter)).first();
ApicurioUtils.setDropDownValue(ApicurioUtils.Buttons.PROPERTY_TYPE.getButtonId(), type, parameterElement);
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class UpgradeSteps method getUpgradeVersions.
@When("^prepare upgrade$")
public void getUpgradeVersions() {
Syndesis syndesis = ResourceFactory.get(PreviousSyndesis.class);
// If it is a prod build, we can use released images from registry.redhat.io
if (TestUtils.isProdBuild()) {
// If it is a prod build and the version is null, it means it was started by test-runner, so skip it as for prod upgrade there is a
// separate job
assumeThat(TestConfiguration.upgradePreviousVersion()).isNotNull();
String majorMinorMavenVersion = getMajorMinor(TestConfiguration.upgradePreviousVersion());
String major = StringUtils.substringBefore(majorMinorMavenVersion, ".");
// From 1.10 we need to make 1.7, so parse the decimal part to integer and subtract 3
int minor = Integer.parseInt(StringUtils.substringAfter(majorMinorMavenVersion, ".")) - 3;
// Parse the previous tag from maven artifacts
syndesis.setOperatorImage(RELEASED_OPERATOR_IMAGE + ":" + major + "." + minor);
TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_CURRENT_VERSION, TestConfiguration.syndesisVersion());
// Previous version needs to be specified manually via system properties
} else {
assumeThat(TestConfiguration.syndesisInstallVersion()).as("Upgrade tests need to have " + TestConfiguration.SYNDESIS_INSTALL_VERSION + " property set!").isNotNull();
// List all the tags from docker hub
List<String> tags = new ArrayList<>();
int page = 0;
boolean nextPage = false;
do {
String tagUrl = String.format(DOCKER_HUB_SYNDESIS_TAGS_URL, ++page);
JSONObject response = new JSONObject(HTTPUtils.doGetRequest(tagUrl).getBody());
response.getJSONArray("tags").forEach(tag -> tags.add(((JSONObject) tag).getString("name")));
nextPage = response.getBoolean("has_additional");
} while (nextPage);
Collections.sort(tags);
String previousTag = getPreviousVersion(getMajorMinor(TestConfiguration.syndesisInstallVersion()), tags);
if (!previousTag.isEmpty()) {
TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_PREVIOUS_VERSION, previousTag);
syndesis.setOperatorImage(UPSTREAM_OPERATOR_IMAGE + ":" + previousTag);
} else {
fail("Unable to find previous version for " + TestConfiguration.syndesisInstallVersion());
}
TestConfiguration.get().overrideProperty(TestConfiguration.SYNDESIS_UPGRADE_CURRENT_VERSION, TestConfiguration.syndesisInstallVersion());
}
// We want to deploy "previous" version first
syndesis.setCrdUrl(getClass().getClassLoader().getResource("upgrade/syndesis-crd-previous.yaml").toString());
log.info("Upgrade properties:");
log.info(" Previous version: " + TestConfiguration.upgradePreviousVersion());
log.info(" Current version: " + TestConfiguration.upgradeCurrentVersion());
}
use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.
the class UpgradeSteps method deploySyndesis.
@When("deploy previous Syndesis CR {string}")
public void deploySyndesis(String crFile) {
Syndesis syndesis = ResourceFactory.get(PreviousSyndesis.class);
syndesis.setCrUrl(getClass().getClassLoader().getResource("upgrade/" + crFile).toString());
ResourceFactory.create(PreviousSyndesis.class);
}
Aggregations