You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2014/10/22 17:29:00 UTC
[2/3] git commit: [SYNCOPE-570] Applying provided patch
[SYNCOPE-570] Applying provided patch
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c6adbef3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c6adbef3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c6adbef3
Branch: refs/heads/master
Commit: c6adbef3ceef989551beabfff3658d0fea92fba9
Parents: 2674037
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Oct 22 17:28:25 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Oct 22 17:28:25 2014 +0200
----------------------------------------------------------------------
.../apache/syncope/console/AbstractTest.java | 35 +-
.../syncope/console/AccessTestITCase.java | 73 ++--
.../console/ConfigurationTestITCase.java | 428 ++++++++++---------
.../syncope/console/ConnInstanceTestITCase.java | 180 ++++----
.../syncope/console/EditProfileTestITCase.java | 65 +--
.../syncope/console/ReportTestITCase.java | 113 ++---
.../syncope/console/ResourceTestITCase.java | 117 ++---
.../apache/syncope/console/RoleTestITCase.java | 185 ++++----
.../syncope/console/SchemaTestITCase.java | 45 +-
.../apache/syncope/console/TaskTestITCase.java | 87 ++--
.../apache/syncope/console/UserTestITCase.java | 160 +++----
11 files changed, 807 insertions(+), 681 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/AbstractTest.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/AbstractTest.java b/console/src/test/java/org/apache/syncope/console/AbstractTest.java
index 3c40df4..f48f6ae 100644
--- a/console/src/test/java/org/apache/syncope/console/AbstractTest.java
+++ b/console/src/test/java/org/apache/syncope/console/AbstractTest.java
@@ -18,21 +18,23 @@
*/
package org.apache.syncope.console;
-import com.thoughtworks.selenium.Selenium;
-import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = { "classpath:consoleContext.xml" })
+@ContextConfiguration(locations = {"classpath:consoleContext.xml"})
public abstract class AbstractTest extends TestCase {
/**
@@ -46,9 +48,9 @@ public abstract class AbstractTest extends TestCase {
protected static final String BASE_URL = "http://localhost:9080/syncope-console/";
- protected Selenium selenium;
-
protected WebDriver seleniumDriver;
+
+ protected WebDriverWait wait;
@Override
@Before
@@ -56,21 +58,24 @@ public abstract class AbstractTest extends TestCase {
super.setUp();
seleniumDriver = new FirefoxDriver();
- selenium = new WebDriverBackedSelenium(seleniumDriver, BASE_URL);
-
- selenium.open("/syncope-console/");
- selenium.type("name=userId", ADMIN);
- selenium.type("name=password", PASSWORD);
- selenium.click("name=:submit");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//img[@alt='Logout']\");", "60000");
+ seleniumDriver.get(BASE_URL);
+ wait = new WebDriverWait(seleniumDriver, 6);
+
+ WebElement element = seleniumDriver.findElement(By.name("userId"));
+ element.sendKeys(ADMIN);
+ element = seleniumDriver.findElement(By.name("password"));
+ element.sendKeys(PASSWORD);
+ seleniumDriver.findElement(By.name(":submit")).click();
+
+ (new WebDriverWait(seleniumDriver, 6))
+ .until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt='Logout']")));
}
@Override
@After
public void tearDown() throws Exception {
- selenium.click("css=img[alt=\"Logout\"]");
- selenium.stop();
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Logout\"]")).click();
+ seleniumDriver.quit();
super.tearDown();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/AccessTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/AccessTestITCase.java b/console/src/test/java/org/apache/syncope/console/AccessTestITCase.java
index 8d8a90a..3e140d8 100644
--- a/console/src/test/java/org/apache/syncope/console/AccessTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/AccessTestITCase.java
@@ -19,63 +19,62 @@
package org.apache.syncope.console;
import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
public class AccessTestITCase extends AbstractTest {
@Test
public void clickAround() {
- selenium.click("css=img[alt=\"Schema\"]");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Schema\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']/ul/li[2]/a")));
- selenium.click("//div[@id='tabs']/ul/li[2]/a");
- selenium.waitForCondition("selenium.isElementPresent(\"xpath=//div[@id='uschema']/div/div/span/ul/li[2]/a\");",
- "30000");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a")).click();
- selenium.click("//div[@id='uschema']/div/div/span/ul/li[2]/a");
- selenium.click("//div[@id='uschema']/div/div/span/ul/li[3]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[@id='uschema']/div/div/span/ul/li[2]/a")));
- selenium.click("//div[@id='tabs']/ul/li[3]/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='uschema']/div/div/span/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='uschema']/div/div/span/ul/li[3]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='mschema']/div/div/span/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='mschema']/div/div/span/ul/li[3]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- selenium.click("//div[@id='mschema']/div/div/span/ul/li[2]/a");
- selenium.click("//div[@id='mschema']/div/div/span/ul/li[3]/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='rschema']/div/div/span/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='rschema']/div/div/span/ul/li[3]/a")).click();
- selenium.click("//div[@id='tabs']/ul/li[4]/a");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Users\"]")).click();
- selenium.click("//div[@id='rschema']/div/div/span/ul/li[2]/a");
- selenium.click("//div[@id='rschema']/div/div/span/ul/li[3]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[3]/ul/li[2]/a/span")));
+ seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a/span")).click();
- selenium.click("css=img[alt=\"Users\"]");
- selenium.waitForPageToLoad("30000");
- selenium.click("link=Search");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Roles\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt=\"Resources\"]")));
- selenium.click("css=img[alt=\"Roles\"]");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt=\"TODO\"]")));
- selenium.click("css=img[alt=\"Resources\"]");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"TODO\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt=\"Reports\"]")));
- selenium.click("css=img[alt=\"TODO\"]");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Reports\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//img[@alt=\"Configuration\"]")));
- selenium.click("css=img[alt=\"Reports\"]");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.click("css=img[alt=\"Configuration\"]");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']/ul/li[2]/a/span")));
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//div[@id='tabs']/ul/li[2]/a/span\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a/span")).click();
- selenium.click("//div[@id='tabs']/ul/li[2]/a/span");
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//div[@id='tabs']/ul/li[3]/a/span\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Tasks\"]")).click();
- selenium.click("//div[@id='tabs']/ul/li[3]/a/span");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']/ul/li[2]/a/span")));
- selenium.click("css=img[alt=\"Tasks\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//div[@id='tabs']/ul/li[2]/a/span\");", "30000");
-
- selenium.click("//div[@id='tabs']/ul/li[2]/a/span");
- selenium.click("//div[@id='tabs']/ul/li[3]/a/span");
- selenium.click("//div[@id='tabs']/ul/li[4]/a/span");
- selenium.click("//div[@id='tabs']/ul/li[5]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Tasks\"]")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[5]/a/span")).click();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java b/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
index e3b38f3..1ec720d 100644
--- a/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
@@ -19,331 +19,367 @@
package org.apache.syncope.console;
import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
public class ConfigurationTestITCase extends AbstractTest {
@Test
public void editParameters() {
- selenium.click("css=img[alt=\"Configuration\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//span[contains(text(), 'log.lastlogindate')]/../../div[2]/span/input");
- selenium.click("//div[@id='parameters']/form/a");
+ seleniumDriver.findElement(By.xpath("//span[contains(text(), 'log.lastlogindate')]/../../div[2]/span/input")).
+ click();
+ seleniumDriver.findElement(By.xpath("//div[@id='parameters']/form/a")).click();
- selenium.waitForCondition("selenium.isTextPresent(\"Operation executed successfully\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Operation executed successfully"));
}
@Test
public void browsePasswordPolicy() {
- selenium.click("css=img[alt=\"Configuration\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='tabs']/ul/li[2]/a");
- selenium.click("//div[@id='policies']/ul/li[2]/a");
- selenium.click("//div[@id='password']/span/div/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[3]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='policies']/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//div[@id='password']/span/div/a")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@name='id:textField']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='id:textField']")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
-
- selenium.type("name=description:textField", "new description");
- selenium.click("//div[2]/form/div[3]/input[@type='submit']");
+ WebElement element = seleniumDriver.findElement(By.name("description:textField"));
+ element.sendKeys("new description");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input[@type='submit']")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.waitForCondition("selenium.isTextPresent(\"new description\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Operation executed successfully"));
}
@Test
public void browseWorkflowDef() {
- selenium.click("css=img[alt=\"Configuration\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='tabs']/ul/li[4]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[5]/a/span")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='workflow']/div/span/img\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='workflow']/div/span/img")));
}
@Test
public void setLogLevel() {
- selenium.click("css=img[alt=\"Configuration\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='tabs']/ul/li[6]/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[7]/a")).click();
- selenium.select("//div[@id='core']/div/span/table/tbody/tr/td[2]/select", "label=ERROR");
+ final Select select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[@id='core']/div/span/table/tbody/tr/td[2]/select")));
+ select.selectByVisibleText("ERROR");
- selenium.waitForCondition("selenium.isTextPresent(\"Operation executed successfully\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='workflow']/div/span/img")));
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Operation executed successfully"));
}
@Test
public void createNotification() {
- selenium.click("css=img[alt=\"Configuration\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.click("//div[@id='tabs']/ul/li[3]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='notifications']/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div/div/label\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@name='sender:textField']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));
- selenium.type("name=sender:textField", "test@syncope.it");
+ seleniumDriver.findElement(By.name("sender:textField")).sendKeys("test@syncope.it");
- selenium.type("name=subject:textField", "test@syncope.it");
+ seleniumDriver.findElement(By.name("subject:textField")).sendKeys("test@syncope.it");
- selenium.select("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select", "label=UserSchema");
+ Select select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select")));
+ select.selectByVisibleText("UserSchema");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));
- selenium.select("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select", "label=fullname");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
+ select.selectByVisibleText("fullname");
- selenium.select("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select", "label=optin");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
+ select.selectByVisibleText("optin");
- selenium.select("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select", "label=ALL");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
+ select.selectByVisibleText("ALL");
- selenium.click("//div[2]/form/div[3]/ul/li[3]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
- selenium.click("//div[2]/form/div[3]/ul/li[2]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
- + "/option[text()='PROPAGATION']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
+ + "/option[text()='PROPAGATION']")));
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']",
- "label=PROPAGATION");
+ select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
+ select.selectByVisibleText("PROPAGATION");
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='role']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
+ + "/option[text()='role']")));
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']",
- "label=role");
+ select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
+ select.selectByVisibleText("role");
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
- + "/option[text()='resource-db-sync']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
+ + "/option[text()='resource-db-sync']")));
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']",
- "label=resource-db-sync");
+ select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']")));
+ select.selectByVisibleText("resource-db-sync");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']")));
- selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
+ seleniumDriver.findElement(By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input")).
+ click();
- selenium.click("//div[2]/form/div[3]/ul/li[4]/a");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a")).click();
- selenium.click("//div[2]/form/div[3]/div[4]/div/div/span/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[4]/div/div/span/input")).click();
- selenium.type(
- "name=staticRecipients:multiValueContainer:view:0:panel:textField", "syncope445@syncope.apache.org");
+ wait.until(ExpectedConditions.elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));
+
+ seleniumDriver.findElement(By.name(
+ "staticRecipients:multiValueContainer:view:0:panel:textField")).
+ sendKeys("syncope445@syncope.apache.org");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div[4]/div/div[2]/label\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[3]/div[4]/div/div[2]/label")));
- selenium.click("//div[2]/form/div[4]/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();
seleniumDriver.switchTo().defaultContent();
}
@Test
public void createDisabledNotification() {
- selenium.click("css=img[alt=\"Configuration\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.click("//div[@id='tabs']/ul/li[3]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='notifications']/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div/div/label\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@name='sender:textField']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));
- selenium.type("name=sender:textField", "test@syncope.it");
+ seleniumDriver.findElement(By.name("sender:textField")).sendKeys("test@syncope.it");
- selenium.type("name=sender:textField", "test@syncope.it");
+ Select select = new Select(seleniumDriver.findElement(
+ By.xpath("//div[2]/form/div[3]/div/div[1]/div[3]/div[2]/span/select")));
+ select.selectByVisibleText("UserSchema");
- selenium.select("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select", "label=UserSchema");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]\");", "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
+ select.selectByVisibleText("fullname");
- selenium.select("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select", "label=fullname");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
+ select.selectByVisibleText("optin");
- selenium.select("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select", "label=optin");
-
- selenium.select("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select", "label=ALL");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
+ select.selectByVisibleText("ALL");
// disable notification
- selenium.click("//div[2]/form/div[3]/div/div/div[7]/div[2]/span/input");
-
- selenium.click("//div[2]/form/div[3]/ul/li[3]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[7]/div[2]/span/input")).click();
- selenium.click("//div[2]/form/div[3]/ul/li[2]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
- + "/option[text()='PROPAGATION']\");",
- "30000");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']",
- "label=PROPAGATION");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
+ + "/option[text()='PROPAGATION']")));
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='role']\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
+ select.selectByVisibleText("PROPAGATION");
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']",
- "label=role");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
+ + "/option[text()='role']")));
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
- + "/option[text()='resource-db-sync']\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
+ select.selectByVisibleText("role");
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']",
- "label=resource-db-sync");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
+ + "/option[text()='resource-db-sync']")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']")));
+ select.selectByVisibleText("resource-db-sync");
- selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']")));
- selenium.click("//div[2]/form/div[3]/ul/li[4]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input")).
+ click();
- selenium.click("//div[2]/form/div[3]/div[4]/div/div/span/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a/span")).click();
- selenium.type(
- "name=staticRecipients:multiValueContainer:view:0:panel:textField", "syncope492@syncope.apache.org");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[4]/div/div/span/input")).click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));
+
+ seleniumDriver.findElement(
+ By.name("staticRecipients:multiValueContainer:view:0:panel:textField"))
+ .sendKeys("syncope492@syncope.apache.org");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div[4]/div/div[2]/label\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//div[2]/form/div[3]/div[4]/div/div[2]/label")));
- selenium.click("//div[2]/form/div[4]/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();
seleniumDriver.switchTo().defaultContent();
}
@Test
public void issueSYNCOPE446() {
- selenium.click("css=img[alt=\"Configuration\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
-
- selenium.click("//div[@id='tabs']/ul/li[3]/a");
-
- selenium.click("//div[@id='notifications']/a");
-
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div/div/label\");", "30000");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@name='sender:textField']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Configuration\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.type("name=sender:textField", "syncope446@syncope.it");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[4]/a")).click();
- selenium.type("name=subject:textField", "Test issue Syncope 446");
+ seleniumDriver.findElement(By.xpath("//div[@id='notifications']/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
- selenium.select("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select", "label=UserSchema");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[3]/div/div/div/div/label")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='sender:textField']")));
- selenium.select("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select", "label=email");
+ seleniumDriver.findElement(By.name("sender:textField")).sendKeys("syncope446@syncope.it");
+ seleniumDriver.findElement(By.name("subject:textField")).sendKeys("Test issue Syncope 446");
- selenium.select("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select", "label=optin");
+ Select select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[3]/div[2]/span/select")));
+ select.selectByVisibleText("UserSchema");
- selenium.select("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select", "label=ALL");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select/option[2]")));
- selenium.click("//div[2]/form/div[3]/ul/li[3]/a/span");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[4]/div[2]/span/select")));
+ select.selectByVisibleText("email");
- selenium.click("//div[2]/form/div[3]/ul/li[2]/a/span");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[5]/div[2]/span/select")));
+ select.selectByVisibleText("optin");
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
- + "/option[text()='REST']\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div/div/div[6]/div[2]/span/select")));
+ select.selectByVisibleText("ALL");
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']",
- "label=REST");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[2]/a/span")).click();
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
- + "/option[text()='RoleController']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
+ + "/option[text()='REST']")));
- selenium.select(
- "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']",
- "label=RoleController");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']")));
+ select.selectByVisibleText("REST");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//input[@name='eventSelection:eventsContainer:eventsPanel:successGroup']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
+ + "/option[text()='RoleController']")));
- selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']")));
+ select.selectByVisibleText("RoleController");
- selenium.click("//div[2]/form/div[3]/ul/li[3]/a/span");
- selenium.click("//div[2]/form/div[3]/div[3]/span/div[4]/div/span/input");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//input[@name='eventSelection:eventsContainer:eventsPanel:successGroup']")));
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']"
- + "/option[text()='ENTITLEMENT']\");",
- "30000");
+ seleniumDriver.findElement(
+ By.xpath("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[3]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[3]/span/div[4]/div/span/input")).click();
- selenium.select(
- "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']",
- "label=ENTITLEMENT");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']"
+ + "/option[text()='ENTITLEMENT']")));
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ By.xpath("//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']")));
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']"
- + "/option[text()='ROLE_CREATE']\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:type']")));
+ select.selectByVisibleText("ENTITLEMENT");
- selenium.select(
- "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']",
- "label=ROLE_CREATE");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']"
+ + "/option[text()='ROLE_CREATE']")));
- selenium.click("//div[2]/form/div[3]/ul/li[4]/a/span");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath(
+ "//select[@name='aboutContainer:roleAbout:searchFormContainer:searchView:0:property']")));
+ select.selectByVisibleText("ROLE_CREATE");
- selenium.click("//input[@name='recipientsContainer:checkRecipients:checkboxField']");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/ul/li[4]/a/span")).click();
+ seleniumDriver.findElement(By.xpath("//input[@name='recipientsContainer:checkRecipients:checkboxField']")).
+ click();
- selenium.type(
- "name=staticRecipients:multiValueContainer:view:0:panel:textField", "syncope446@syncope.apache.org");
+ wait.until(ExpectedConditions.elementToBeClickable(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")));
+
+ seleniumDriver.findElement(By.name("staticRecipients:multiValueContainer:view:0:panel:textField")).sendKeys(
+ "syncope446@syncope.apache.org");
- selenium.click("//div[2]/form/div[4]/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[4]/input")).click();
seleniumDriver.switchTo().defaultContent();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/ConnInstanceTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/ConnInstanceTestITCase.java b/console/src/test/java/org/apache/syncope/console/ConnInstanceTestITCase.java
index c8c148e..72715ab 100644
--- a/console/src/test/java/org/apache/syncope/console/ConnInstanceTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/ConnInstanceTestITCase.java
@@ -19,157 +19,173 @@
package org.apache.syncope.console;
import org.junit.Test;
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
public class ConnInstanceTestITCase extends AbstractTest {
@Test
public void browseCreateModal() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='tabs']/ul/li[2]/a");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a")).click();
- selenium.click("//div[3]/div[2]/a");
+ seleniumDriver.findElement(By.xpath("//div[3]/div[2]/a")).click();
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//form/div[2]/div/div/div[3]/div[2]/span/select\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(("//iframe"))));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[2]/div/div/div[3]/div[2]/span/select")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ Select select = new Select(
+ seleniumDriver.findElement(By.xpath("//form/div[2]/div[1]/div[1]/div[2]/div[2]/span/select")));
+
+ select.selectByValue("0");
- selenium.select("//select[@name='location:dropDownChoiceField']", "value=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='connectorName:dropDownChoiceField']/option[3]")));
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//select[@name='connectorName:dropDownChoiceField']/option[3]\");",
- "30000");
+ select = new Select(
+ seleniumDriver.findElement(By.xpath("//form/div[2]/div[1]/div[1]/div[3]/div[2]/span/select")));
+ select.selectByVisibleText("org.connid.bundles.soap");
- selenium.select("//select[@name='connectorName:dropDownChoiceField']", "label=org.connid.bundles.soap");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[1]/a/span")).click();
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a/span");
- selenium.click("//div[2]/form/div[2]/ul/li[1]/a/span");
-
- assertTrue(selenium.isElementPresent("//form/div[2]/div/div/div[3]/div[2]/"));
+ assertTrue(seleniumDriver.findElement(By.xpath("//form/div[2]/div/div/div[3]/div[2]")).isDisplayed());
seleniumDriver.switchTo().defaultContent();
- selenium.click("css=a.w_close");
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
@Test
public void browseEditModal() {
- selenium.click("css=img[alt=\"Resources\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
-
- selenium.click("//div[3]/ul/li[2]/a");
- selenium.click("//tr[4]/td[7]/div/span[13]/a");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//tr[4]/td[7]/div/span[13]/a")).click();
- assertEquals("ConnInstance103", selenium.getAttribute("//input[@name='displayName:textField']/@value"));
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));
+
+ assertEquals("ConnInstance103",
+ seleniumDriver.findElement(By.xpath("//input[@name='displayName:textField']")).getAttribute("value"));
- assertEquals("org.connid.bundles.soap",
- selenium.getSelectedLabel("//select[@name='connectorName:dropDownChoiceField']"));
+ assertEquals("org.connid.bundles.soap",(new Select(seleniumDriver.findElement(
+ By.xpath("//select[@name='connectorName:dropDownChoiceField']")))).getFirstSelectedOption().getText());
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a/span")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.click("css=a.w_close");
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
-
+
@Test
public void delete() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[3]/ul/li[2]/a");
- selenium.click("//tr[4]/td[7]/div/span[15]/a");
+ seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//tr[4]/td[7]/div/span[15]/a")).click();
- assertTrue(selenium.getConfirmation().equals("Do you really want to delete the selected item(s)?"));
+ Alert alert = seleniumDriver.switchTo().alert();
+ assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
+ alert.accept();
- selenium.waitForCondition("selenium.isTextPresent(\"Error:\");", "10000");
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Error: "));
}
-
+
@Test
public void checkConnection() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[3]/ul/li[2]/a");
- selenium.click("//tr[2]/td[7]/div/span[13]/a");
+ seleniumDriver.findElement(By.xpath("//div[3]/ul/li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//tr[2]/td[7]/div/span[13]/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='version:dropDownChoiceField']")));
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//select[@name='version:dropDownChoiceField']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a")).click();
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/a")));
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/a")).click();
- selenium.click("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/a");
-
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div/ul/li/span[contains(text(),'Successful connection')]\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div/ul/li/span[contains(text(),'Successful connection')]")));
seleniumDriver.switchTo().defaultContent();
}
-
+
@Test
public void issueSyncope506() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//tr[4]/td[3]/div/a/span");
+ seleniumDriver.findElement(By.xpath("//tr[4]/td[3]/div/a/span")).click();
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//select[@name='version:dropDownChoiceField']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='version:dropDownChoiceField']")));
- selenium.selectFrame("index=0");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a")).click();
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select\");", "30000");
+ seleniumDriver.findElement(By.xpath(
+ "//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/div[3]/span/div/div/span/a[2]/span/span")).click();
- selenium.click("//div[2]/form/div[2]/div[2]/div/span/div[2]/div[30]/div[3]/span/div/div/span/a[2]/span/span");
-
- selenium.click("//div[2]/form/div[3]/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.waitForCondition("selenium.isTextPresent(\"Operation executed successfully\");", "30000");
-
- selenium.click("//tr[4]/td[3]/div/a/span");
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Operation executed successfully"));
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//select[@name='version:dropDownChoiceField']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//tr[4]/td[3]/div/a/span")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//select[@name='version:dropDownChoiceField']")));
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a")).click();
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[2]/div/div/div[3]/div[2]/span/select")));
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@value='99']\");", "3000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@value='99']")));
- selenium.click("//div[2]/form/div[2]/ul/li[2]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/ul/li[2]/a/span")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.click("css=a.w_close");
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/EditProfileTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/EditProfileTestITCase.java b/console/src/test/java/org/apache/syncope/console/EditProfileTestITCase.java
index 2ea8acb..c06e084 100644
--- a/console/src/test/java/org/apache/syncope/console/EditProfileTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/EditProfileTestITCase.java
@@ -18,11 +18,16 @@
*/
package org.apache.syncope.console;
-import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;
+import java.util.concurrent.TimeUnit;
+import static org.apache.syncope.console.AbstractTest.ADMIN;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
public class EditProfileTestITCase extends AbstractTest {
@@ -30,47 +35,57 @@ public class EditProfileTestITCase extends AbstractTest {
@Before
public void setUp() throws Exception {
seleniumDriver = new FirefoxDriver();
- selenium = new WebDriverBackedSelenium(seleniumDriver, BASE_URL);
-
- selenium.open("/syncope-console/");
+ //selenium = new WebDriverBackedSelenium(seleniumDriver, BASE_URL);
+ seleniumDriver.get(BASE_URL);
+ wait = new WebDriverWait(seleniumDriver, 6);
+
}
@Test
public void selfRegistration() {
- selenium.click("//div/span/span/a");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//span[contains(text(),'Attributes')]\");", "30000");
+ seleniumDriver.findElement(By.xpath("//div/div[2]/div[1]/span/a/span")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
- selenium.click("css=a.w_close");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[contains(text(),'Attributes')]")));
+ seleniumDriver.switchTo().defaultContent();
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
// only to have some "Logout" available for @After
- selenium.open("/syncope-console/");
- selenium.waitForPageToLoad("30000");
- selenium.type("name=userId", ADMIN);
- selenium.type("name=password", PASSWORD);
- selenium.click("name=:submit");
- selenium.waitForPageToLoad("30000");
+ seleniumDriver.get(BASE_URL);
+ seleniumDriver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
+ WebElement element = seleniumDriver.findElement(By.name("userId"));
+ element.sendKeys(ADMIN);
+ element = seleniumDriver.findElement(By.name("password"));
+ element.sendKeys(PASSWORD);
+ seleniumDriver.findElement(By.name(":submit")).click();
+ seleniumDriver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
}
-
+
@Test
public void editUserProfile() {
- selenium.type("name=userId", "rossini");
- selenium.type("name=password", "password");
- selenium.click("name=:submit");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='username']/a\");", "30000");
- selenium.click("//div[@id='username']/a");
+ WebElement element = seleniumDriver.findElement(By.name("userId"));
+ element.sendKeys("rossini");
+ element = seleniumDriver.findElement(By.name("password"));
+ element.sendKeys("password");
+ seleniumDriver.findElement(By.name(":submit")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//span[contains(text(),'Attributes')]\");", "30000");
- selenium.waitForCondition("selenium.isElementPresent(\"//input[@value='rossini']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='username']/a")));
+ seleniumDriver.findElement(By.xpath("//div[@id='username']/a")).click();
- selenium.click("css=a.w_close");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[contains(text(),'Attributes')]")));
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@value='rossini']")));
+ seleniumDriver.switchTo().defaultContent();
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
- selenium.stop();
+ //seleniumDriver.stop();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java b/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java
index 09382f3..fae8233 100644
--- a/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java
@@ -19,90 +19,95 @@
package org.apache.syncope.console;
import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
public class ReportTestITCase extends AbstractTest {
@Test
public void readReportlet() {
- selenium.click("css=img[alt=\"Reports\"]");
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
-
- selenium.click("//table/tbody/tr/td[8]/div/span[13]/a");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
-
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[2]/div/div/span/div/div/div/span\");", "30000");
-
- selenium.click("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div[2]/div/a");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div/select\");", "30000");
-
- selenium.select("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div/select", "testUserReportlet");
- selenium.click("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div[2]/div[2]/a");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Reports\"]")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
+ seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[8]/div/span[13]/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[2]/div/div/span/div/div/div/span")));
+
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div[2]/div/a"))
+ .click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div/select")));
+
+ Select select = new Select(seleniumDriver.findElement(
+ By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div/div/select")));
+ select.selectByVisibleText("testUserReportlet");
+
+ seleniumDriver.findElement(
+ By.xpath("//div[2]/form/div[2]/div/div/span/div/div[5]/div[2]/div[2]/div[2]/a")).click();
seleniumDriver.switchTo().defaultContent();
+ wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(
+ By.xpath("//div[7]/form/div/div[2]/div/div/div/div[2]/div/div/iframe")));
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.name("reportletClass:dropDownChoiceField")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"name=reportletClass:dropDownChoiceField\");", "30000");
-
- selenium.selectFrame("index=1");
-
- selenium.select("name=reportletClass:dropDownChoiceField",
- "org.apache.syncope.common.report.StaticReportletConf");
+ select = new Select(seleniumDriver.findElement(By.name("reportletClass:dropDownChoiceField")));
+ select.selectByVisibleText("org.apache.syncope.common.report.StaticReportletConf");
- selenium.click("//div[2]/form/div[3]/input");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/input")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.click("css=a.w_close");
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
@Test
public void executeReport() {
- selenium.click("css=img[alt=\"Reports\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Reports\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//table/tbody/tr/td[8]/div/span[6]/a");
+ seleniumDriver.findElement(By.xpath("//table/tbody/tr/td[8]/div/span[6]/a")).click();
- selenium.waitForCondition("selenium.isTextPresent(\"Operation executed successfully\");", "30000");
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("feedback")));
+ assertTrue(seleniumDriver.findElement(By.tagName("body")).getText().contains("Operation executed successfully"));
}
@Test
public void navigateAudit() {
- selenium.click("css=img[alt=\"Reports\"]");
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Reports\"]")).click();
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[@id='tabs']/ul/li[2]/a/span");
+ seleniumDriver.findElement(By.xpath("//div[@id='tabs']/ul/li[2]/a/span")).click();
- selenium.waitForCondition(
- "selenium.isTextPresent(\"[REST]:[EntitlementController]:[]:[getOwn]:[SUCCESS]\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//option[contains(text(),'[REST]:[EntitlementController]:[]:[getOwn]:[SUCCESS]')]")));
- selenium.select(
- "//select[@name='events:categoryContainer:type:dropDownChoiceField']",
- "label=PROPAGATION");
+ Select select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='events:categoryContainer:type:dropDownChoiceField']")));
+ select.selectByVisibleText("PROPAGATION");
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='events:categoryContainer:category:dropDownChoiceField']/option[text()='user']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='events:categoryContainer:category:dropDownChoiceField']/option[text()='user']")));
- selenium.select(
- "//select[@name='events:categoryContainer:category:dropDownChoiceField']",
- "label=user");
+ select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='events:categoryContainer:category:dropDownChoiceField']")));
+ select.selectByVisibleText("user");
- selenium.waitForCondition("selenium.isElementPresent(\""
- + "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']/option[text()='resource-csv']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']"
+ + "/option[text()='resource-csv']")));
- selenium.select(
- "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']",
- "label=resource-csv");
+ select = new Select(seleniumDriver.findElement(By.xpath(
+ "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']")));
+ select.selectByVisibleText("resource-csv");
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//input[@name='events:eventsContainer:eventsPanel:successGroup']\");",
- "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//input[@name='events:eventsContainer:eventsPanel:successGroup']")));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/c6adbef3/console/src/test/java/org/apache/syncope/console/ResourceTestITCase.java
----------------------------------------------------------------------
diff --git a/console/src/test/java/org/apache/syncope/console/ResourceTestITCase.java b/console/src/test/java/org/apache/syncope/console/ResourceTestITCase.java
index 19a3a92..c862dc3 100644
--- a/console/src/test/java/org/apache/syncope/console/ResourceTestITCase.java
+++ b/console/src/test/java/org/apache/syncope/console/ResourceTestITCase.java
@@ -19,110 +19,123 @@
package org.apache.syncope.console;
import org.junit.Test;
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.support.ui.ExpectedConditions;
public class ResourceTestITCase extends AbstractTest {
@Test
public void browseCreateModal() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//div[3]/div/a");
+ seleniumDriver.findElement(By.xpath("//div[3]/div/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//form/div[3]/div/span/div/div/div/label[text()='Name']\");", "30000");
-
- selenium.click("css=a.w_close");
+ seleniumDriver.switchTo().defaultContent();
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
@Test
public void browseEditModal() {
- selenium.click("css=img[alt=\"Resources\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.click("//td[6]/div/span[13]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.waitForCondition("selenium.isElementPresent(" + "\"class=wicket_modal\");", "30000");
- selenium.waitForFrameToLoad("class=wicket_modal", "30000");
- selenium.selectFrame("index=0");
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//form/div[3]/div/span/div/div/div/label[text()='Name']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//td[6]/div/span[13]/a")).click();
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(
+ "//form/div[3]/div/span/div/div/div/label[text()='Name']")));
- selenium.click("//li[2]/a");
+ seleniumDriver.findElement(By.xpath("//li[2]/a")).click();
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//tbody/tr[2]/td/input\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//tbody/tr[2]/td/input")));
- selenium.click("//tbody/tr[2]/td/input");
+ seleniumDriver.findElement(By.xpath("//tbody/tr[2]/td/input")).click();
- assertTrue(selenium.getConfirmation().equals("Do you really want to delete the selected item(s)?"));
+ Alert alert = seleniumDriver.switchTo().alert();
+ assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
+ alert.accept();
- selenium.click("//div[4]/input");
+ seleniumDriver.findElement(By.xpath("//div[4]/input")).click();
seleniumDriver.switchTo().defaultContent();
}
@Test
public void delete() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//tr[3]/td[6]/div/span[15]/a");
+ seleniumDriver.findElement(By.xpath("//tr[3]/td[6]/div/span[15]/a")).click();
- assertTrue(selenium.getConfirmation().equals("Do you really want to delete the selected item(s)?"));
+ Alert alert = seleniumDriver.switchTo().alert();
+ assertTrue(alert.getText().equals("Do you really want to delete the selected item(s)?"));
+ alert.accept();
}
@Test
public void checkSecurityTab() {
- selenium.click("css=img[alt=\"Resources\"]");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.click("//td[6]/div/span[13]/a");
+ seleniumDriver.findElement(By.xpath("//td[6]/div/span[13]/a")).click();
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//form/div[3]/div/span/div/div/div/label[text()='Name']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ seleniumDriver.findElement(By.xpath("//li[4]/a")).click();
- selenium.click("//li[4]/a");
+ assertTrue(seleniumDriver.findElements(By.xpath("//label[@for='passwordPolicy']")).size()>0);
- assertTrue(selenium.isElementPresent("//label[@for='passwordPolicy']"));
-
- selenium.click("//li[1]/a");
- selenium.click("//li[2]/a");
- selenium.click("//li[3]/a");
+ seleniumDriver.findElement(By.xpath("//li[1]/a")).click();
+ seleniumDriver.findElement(By.xpath("//li[2]/a")).click();
+ seleniumDriver.findElement(By.xpath("//li[3]/a")).click();
seleniumDriver.switchTo().defaultContent();
- selenium.click("css=a.w_close");
+ seleniumDriver.findElement(By.xpath("//a[@class='w_close']")).click();
}
@Test
public void checkConnection() {
- selenium.click("css=img[alt=\"Resources\"]");
-
- selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+ seleniumDriver.findElement(By.xpath("//img[@alt=\"Resources\"]")).click();
- selenium.click("//*[@id=\"users-contain\"]//*[div=\"ws-target-resource-delete\"]/../td[6]/div/span[13]/a");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@id='tabs']")));
- selenium.waitForCondition("selenium.isElementPresent("
- + "\"//form/div[3]/div/span/div/div/div/label[text()='Name']\");", "30000");
+ seleniumDriver.findElement(
+ By.xpath("//*[@id=\"users-contain\"]//*[div=\"ws-target-resource-delete\"]/../td[6]/div/span[13]/a"))
+ .click();
- selenium.waitForCondition("selenium.isElementPresent(\"//iframe\");", "30000");
- selenium.selectFrame("index=0");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//iframe")));
+ seleniumDriver.switchTo().frame(0);
+
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//form/div[3]/div/span/div/div/div/label[text()='Name']")));
- selenium.click("//li[4]/a");
+ seleniumDriver.findElement(By.xpath("//li[4]/a")).click();
- selenium.waitForCondition("selenium.isElementPresent(" + "\"//span[text()='endpoint']\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//span[text()='endpoint']")));
- selenium.click("//div[2]/form/div[3]/div[4]/span/span/div[2]/a");
+ seleniumDriver.findElement(By.xpath("//div[2]/form/div[3]/div[4]/span/span/div[2]/a")).click();
- selenium.waitForCondition(
- "selenium.isElementPresent(\"//div/ul/li/span[contains(text(), 'Successful connection')]\");", "30000");
+ wait.until(ExpectedConditions.presenceOfElementLocated(
+ By.xpath("//div/ul/li/span[contains(text(), 'Successful connection')]")));
seleniumDriver.switchTo().defaultContent();
}