Author: sebawagner
Date: Sat Oct 12 01:54:16 2013
New Revision: 1531477
URL: http://svn.apache.org/r1531477
Log:
OPENMEETINGS-816 Fix test to run in deployment mode of Wicket
Modified:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/AbstractLoadTestDefaults.java
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/SeleniumUtils.java
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/TestSignUp.java
Modified:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/AbstractLoadTestDefaults.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/AbstractLoadTestDefaults.java?rev=1531477&r1=1531476&r2=1531477&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/AbstractLoadTestDefaults.java
(original)
+++
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/AbstractLoadTestDefaults.java
Sat Oct 12 01:54:16 2013
@@ -123,7 +123,7 @@ public abstract class AbstractLoadTestDe
SeleniumUtils.inputText(driver, "pass", getUserpass());
WebElement signInButton =
SeleniumUtils.findElement(driver,
- "//button[span[contains(text(), 'Sign
in')]]", true);
+ "//button[span[contains(text(), 'Sign
in')]]", true, true);
signInButton.click();
SeleniumUtils.elementExists(driver,
@@ -144,7 +144,7 @@ public abstract class AbstractLoadTestDe
protected void testIsInstalledAndDoInstallation() throws Exception {
WebElement wicketExtensionsWizardHeaderTitle = SeleniumUtils
- .findElement(driver,
"wicketExtensionsWizardHeaderTitle", false);
+ .findElement(driver,
"wicketExtensionsWizardHeaderTitle", false, true);
if (wicketExtensionsWizardHeaderTitle == null) {
return;
}
@@ -207,7 +207,7 @@ public abstract class AbstractLoadTestDe
// check if installation is complete by searching for
the link on
// the success page
WebElement enterApplicationLink =
SeleniumUtils.findElement(driver,
- "//a[contains(@href,'install')]",
false);
+ "//a[contains(@href,'install')]",
false, true);
if (enterApplicationLink == null) {
System.out
Modified:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/SeleniumUtils.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/SeleniumUtils.java?rev=1531477&r1=1531476&r2=1531477&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/SeleniumUtils.java
(original)
+++
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/SeleniumUtils.java
Sat Oct 12 01:54:16 2013
@@ -40,7 +40,7 @@ public class SeleniumUtils {
public static void inputText(WebDriver driver, String search,
String inputText) throws Exception {
- WebElement element = SeleniumUtils.findElement(driver, search,
true);
+ WebElement element = SeleniumUtils.findElement(driver, search,
true, true);
//clear text before adding input
element.clear();
@@ -50,7 +50,7 @@ public class SeleniumUtils {
}
public static void click(WebDriver driver, String search) throws
Exception {
- WebElement element = SeleniumUtils.findElement(driver, search,
true);
+ WebElement element = SeleniumUtils.findElement(driver, search,
true, true);
element.click();
}
@@ -88,15 +88,26 @@ public class SeleniumUtils {
* @param search
* @param throwException
* under some circumstance you do't want to exit the test
here
+ * @param onlyReturnVisisbleElement TODO
* @return
* @throws Exception
*/
public static WebElement findElement(WebDriver driver, String search,
- boolean throwException) throws Exception {
+ boolean throwException, boolean
onlyReturnVisisbleElement) throws Exception {
for (int i = 0; i < numberOfRetries; i++) {
List<WebElement> elements = _findElement(driver,
search);
if (elements != null) {
- return elements.get(0);
+
+ if (!onlyReturnVisisbleElement) {
+ return elements.get(0);
+ }
+
+ for (WebElement element : elements) {
+ if (element.isDisplayed()) {
+ return element;
+ }
+ }
+
}
Thread.sleep(defaultSleepInterval);
Modified:
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/TestSignUp.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/TestSignUp.java?rev=1531477&r1=1531476&r2=1531477&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/TestSignUp.java
(original)
+++
openmeetings/trunk/singlewebapp/src/test/java/org/apache/openmeetings/test/selenium/TestSignUp.java
Sat Oct 12 01:54:16 2013
@@ -23,6 +23,8 @@ import java.util.Date;
import org.junit.Test;
import org.openqa.selenium.WebElement;
+import com.googlecode.wicket.jquery.ui.widget.dialog.DialogButtons;
+
public class TestSignUp extends AbstractLoadTestDefaults {
String pass = "pass";
@@ -43,7 +45,7 @@ public class TestSignUp extends Abstract
super.testIsInstalledAndDoInstallation();
WebElement signUpButton = SeleniumUtils.findElement(driver,
- "//button[span[contains(text(), 'Not a
member')]]", true);
+ "//button[span[contains(text(), 'Not a
member')]]", true, true);
signUpButton.click();
// ##################################
@@ -52,7 +54,7 @@ public class TestSignUp extends Abstract
doSignUp("Hans","Muster", userName, "pw", "pw2", email);
//Find Error label-id 232 "Please enter two identical passwords"
- SeleniumUtils.findElement(driver,
"//span[@class='feedbackPanelERROR'][contains(text(), '" + getString(232) +
"')]", true);
+ SeleniumUtils.findElement(driver,
"//span[@class='feedbackPanelERROR'][contains(text(), '" + getString(232) +
"')]", true, true);
// ##################################
@@ -60,13 +62,23 @@ public class TestSignUp extends Abstract
// ##################################
doSignUp("Hans","Muster", userName, pass, pass, email);
+
+ //Check for popup with success message and email to check
+ //Labelid 674
+ SeleniumUtils.findElement(driver, "//span[contains(text(), '" +
getString(674) + "')]", true, true);
+
+ //click button to close popup
+ WebElement signUpSucessPopUpOkButton =
SeleniumUtils.findElement(driver,
+ "//button[span[contains(text(), '" +
DialogButtons.OK.toString() + "')]]", true, true);
+ signUpSucessPopUpOkButton.click();
+
//Login with user
SeleniumUtils.inputText(driver, "login", userName);
SeleniumUtils.inputText(driver, "pass", pass);
//click labelid 112 "Sign In"
WebElement signInButton = SeleniumUtils.findElement(driver,
- "//button[span[contains(text(), '" +
getString(112) + "')]]", true);
+ "//button[span[contains(text(), '" +
getString(112) + "')]]", true, true);
signInButton.click();
// check for some text in dashbaord, labelid 281, "Help and
support"
@@ -83,13 +95,13 @@ public class TestSignUp extends Abstract
SeleniumUtils.inputText(driver, "firstName", firstName);
SeleniumUtils.inputText(driver, "lastName", lastName);
- SeleniumUtils.inputText(driver, "//div[contains(@id,
'register')]//input[@name='login']", login);
+ SeleniumUtils.inputText(driver, "//input[@name='login']",
login);
SeleniumUtils.inputText(driver, "password", password);
SeleniumUtils.inputText(driver, "confirmPassword",
confirmPassword);
SeleniumUtils.inputText(driver, "email", email);
WebElement submitButton = SeleniumUtils.findElement(driver,
- "//button[span[contains(text(), 'Register')]]",
true);
+ "//button[span[contains(text(), 'Register')]]",
true, true);
submitButton.click();
}
}