use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.
the class CommonSteps method doOAuthValidation.
@ExcludeFromSelectorReports
private void doOAuthValidation(String type) {
WebDriver driver = WebDriverRunner.getWebDriver();
// store the current window handle
String winHandleBefore = driver.getWindowHandle();
log.info("Current window handle identifier: " + winHandleBefore);
// close additional browser windows
if (driver.getWindowHandles().size() > 1) {
log.error("There is more than one window opened!");
closeAdditionalBrowserWindows(winHandleBefore);
}
// Perform the click operation that opens new window
clickOnButton("Connect " + type);
// we need to wait for an oauth window to open after button click
waitForAdditionalWindow();
// Switch to new window opened
for (String winHandle : driver.getWindowHandles()) {
if (winHandle.equalsIgnoreCase(winHandleBefore)) {
continue;
}
log.info("Found another windows handle: " + winHandle);
driver.switchTo().window(winHandle);
}
// need to wait a bit until window is able to return url
waitForWindowToShowUrl();
waitTillPageIsLoaded();
if ("firefox".equalsIgnoreCase(TestConfiguration.syndesisBrowser())) {
WebDriverRunner.getWebDriver().manage().window().setSize(new Dimension(1920, 1080));
}
switch(type) {
case "Twitter":
waitForCallbackRedirect("twitter");
fillAndValidateTwitter();
break;
case "Salesforce":
waitForCallbackRedirect("salesforce");
fillAndValidateSalesforce();
break;
case "Gmail":
loginToGoogleIfNeeded("QE Google Mail");
break;
case "Google Calendar":
loginToGoogleIfNeeded("QE Google Calendar");
break;
case "SAP Concur":
waitForCallbackRedirect("concursolutions");
fillAndValidateConcur();
break;
case "Google Sheets":
loginToGoogleIfNeeded("QE Google Sheets");
break;
default:
fail("Unknown oauth option: " + type);
}
// Switch back to original browser (first window)
driver.switchTo().window(winHandleBefore);
waitForCallbackRedirect("review");
// close hanging windows
closeAdditionalBrowserWindows(winHandleBefore);
if ("firefox".equalsIgnoreCase(TestConfiguration.syndesisBrowser())) {
WebDriverRunner.getWebDriver().manage().window().setSize(new Dimension(1920, 1080));
}
}
use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.
the class ApicurioSteps method verifyOperations.
@ExcludeFromSelectorReports
@Then("^check that apicurio shows (\\d+) imported operations$")
public void verifyOperations(int expectedCount) {
SelenideElement operations = $(Elements.PAGE_ROOT).shouldBe(visible).find(Elements.NUMBER_OPERATIONS);
assertThat(operations).isNotNull();
assertThat(operations.getText()).containsIgnoringCase(Integer.toString(expectedCount)).containsIgnoringCase("operations");
}
use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.
the class ApicurioSteps method removeOperation.
@ExcludeFromSelectorReports
@When("^remove an operation via apicurio gui$")
public void removeOperation() {
$(Elements.PATH_SECTION).shouldBe(visible).$(Elements.OPERATION).shouldBe(visible).click();
$(Elements.OPERATION_KEBAB).shouldBe(visible).click();
SelenideElement kebabMenu = $(Elements.OPERATION_KEBAB_MENU);
try {
kebabMenu.$(Elements.OPERATION_KEBAB_MENU_DELETE).shouldBe(visible).click();
} catch (org.openqa.selenium.StaleElementReferenceException e) {
$(Elements.OPERATION_KEBAB_MENU).$(Elements.OPERATION_KEBAB_MENU_DELETE).shouldBe(visible).click();
}
}
use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.
the class ApicurioSteps method verifyWarnings.
@ExcludeFromSelectorReports
@Then("^check that apicurio shows (\\d+) warnings$")
public void verifyWarnings(int expectedCount) {
SelenideElement operations = $(Elements.WARNINGS).shouldBe(visible);
assertThat(operations).isNotNull();
assertThat(operations.getText()).containsIgnoringCase(Integer.toString(expectedCount));
}
use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.
the class ApicurioSteps method addSecuritySchema.
@ExcludeFromSelectorReports
@When("^add security schema (BASIC|API Key|OAuth 2) via apicurio gui$")
public void addSecuritySchema(String schemeType) {
// child span element selected so the click is inside of the element
$(Elements.SECURITY_SECTION).shouldBe(visible).$(By.tagName("span")).click();
$(Elements.SECURITY_SECTION).shouldBe(visible).$(Elements.BUTTON_ADD_SCHEME).shouldBe(visible).click();
SelenideElement nameInput = $(SecurityPageElements.NAME).shouldBe(visible);
try {
nameInput.sendKeys("ImmovableName");
} catch (org.openqa.selenium.StaleElementReferenceException e) {
$(SecurityPageElements.NAME).shouldBe(visible).sendKeys("ImmovableName");
}
// select security option
$(SecurityPageElements.EDITOR).shouldBe(visible).$(SecurityPageElements.SECURITY_TYPE_DROPDOWN).shouldBe(visible).click();
$(SecurityPageElements.EDITOR).shouldBe(visible).$(SecurityPageElements.SECURITY_DROPDOWN_MENU).shouldBe(visible).$(By.xpath(".//a[contains(text(), \"" + schemeType + "\")]")).shouldBe(visible).click();
if ("API Key".equalsIgnoreCase(schemeType)) {
$(By.className("apiKey-auth")).find(By.id("in20")).click();
$(By.className("apiKey-auth")).findAll("li").filter(text("HTTP header")).first().click();
$(By.id("name20")).sendKeys("headerName");
}
if ("OAuth 2".equalsIgnoreCase(schemeType)) {
$(By.id("flow")).shouldBe(visible).click();
$(By.id("flow")).shouldBe(visible).parent().$(By.xpath(".//a[contains(text(), \"Access Code\")]")).shouldBe(visible).click();
$(By.id("authorizationUrl")).sendKeys("http://syndesis.io");
$(By.id("tokenUrl")).sendKeys("https://hihi.com");
}
ElementsCollection saveButtons = $(SecurityPageElements.ACTION_HEADER).shouldBe(visible).$$(SecurityPageElements.SAVE);
assertThat(saveButtons.size()).isEqualTo(1);
saveButtons.get(0).shouldBe(visible).click();
$(Elements.BUTTON_ADD_REQUIREMENT).shouldBe(visible).click();
try {
OpenShiftWaitUtils.waitFor(() -> $(SecurityPageElements.SECURITY_REQUIREMENT).exists(), 60 * 1000L);
} catch (InterruptedException | TimeoutException e) {
fail("Security requirement was not found.");
}
ElementsCollection items = $$(SecurityPageElements.SECURITY_REQUIREMENT_ITEMS).shouldBe(sizeGreaterThanOrEqual(1)).filterBy(text("ImmovableName"));
assertThat(items).hasSize(1);
items.first().click();
saveButtons = $(SecurityPageElements.ACTION_HEADER).shouldBe(visible).$$(SecurityPageElements.SAVE);
assertThat(saveButtons.size()).isEqualTo(1);
saveButtons.get(0).shouldBe(visible).click();
}
Aggregations