Author: vrockai
Date: 2009-02-13 04:46:49 -0500 (Fri, 13 Feb 2009)
New Revision: 12817
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
Log:
properties
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-02-13
02:26:01 UTC (rev 12816)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-02-13
09:46:49 UTC (rev 12817)
@@ -423,6 +423,13 @@
deleteRole(roleName);
}
+ @Test(enabled = true)
+ public void testManyUsers(){
+ for (int i = 0; i < 25; i++) {
+ createUser("user0" + i + "", "useruser",
"user0" + i + "" + "(a)portal.com");
+ }
+ }
+
@Test(enabled = true, description = "Altering the number of rows in user
search")
public void testSearchUserCount() {
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-02-13
02:26:01 UTC (rev 12816)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-02-13
09:46:49 UTC (rev 12817)
@@ -3,7 +3,9 @@
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.Properties;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
@@ -23,6 +25,7 @@
public static final String LINK_LOGIN = "link=Login";
public static final String INPUT_PASSWORD = "j_password";
public static final String INPUT_USERNAME = "j_username";
+ protected Properties props;
protected Selenium selenium;
// Generic timeout in miliseconds
@@ -31,13 +34,22 @@
// Element timeout in seconds
protected static final int ELEM_TIMEOUT = 220;
+ public JBossPortalSeleniumTestCase() {
+ try {
+ this.props = getProperties();
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ }
+
@BeforeClass
public void setupChromeForLogin() throws Exception {
+
String browser = System.getProperty("browser");
selenium = new DefaultSelenium("127.0.0.1", 44444, browser,
"http://localhost:8080/portal/");
- JBossSeleniumTestListener.selenium = selenium;
+ JBossSeleniumTestListener.selenium = selenium;
selenium.start();
selenium.setTimeout(PAGE_LOAD);
}
@@ -47,6 +59,25 @@
selenium.stop();
}
+ private Properties getProperties() throws IOException {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ InputStream is =
cl.getResourceAsStream("org/jboss/portal/test/selenium/locator.properties");
+ Properties props = new Properties();
+ props.load(is);
+ return props;
+ }
+
+ protected String getProp(String prop, String subst) {
+ if (subst == null || "".equals(subst)){
+ subst = "Locator not set";
+ }
+
+ if (props == null)
+ return subst;
+ else
+ return props.getProperty(prop) != null ? props.getProperty(prop) : subst;
+ }
+
protected void clickIfVisible(String id) {
if (selenium.isElementPresent(id)) {
@@ -162,7 +193,7 @@
waitFor(1000);
}
}
-
+
protected void waitForElement(String locatorElem, String locatorLink, long timeToWait,
long n) {
for (int i = 0;; i++) {
if (i >= n) {
@@ -187,10 +218,10 @@
break;
} catch (Exception e) {
}
- waitFor(1000);
+ waitFor(100);
}
}
-
+
protected void login(String username, String password) {
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -230,7 +261,7 @@
Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
}
}
-
+
protected void savePage(String filename) {
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename)));
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-13
02:26:01 UTC (rev 12816)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-13
09:46:49 UTC (rev 12817)
@@ -4,23 +4,27 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
+import com.thoughtworks.selenium.Selenium;
+
/**
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "login" }, enabled = true)
public class UserLoginTestCase extends JBossPortalSeleniumTestCase {
-
- private static final String ADR_PORTAL = "/portal";
- private static final String FRM_MAIN = "relative=up";
- private static final String SUB_CANCEL = "cancel";
- private static final String LNK_LOGOUT = "link=Logout";
- private static final String SUB_LOGIN = "login";
- private static final String INP_PASSWORD = "xpath=id('j_password')";
- private static final String INP_USERNAME = "xpath=id('j_username')";
- private static final String FRM_LOGINFORM = "login-content";
- private static final String LNK_LOGIN = "link=Login";
-
+
+ public static final String casePfx = "";
+
+ private final String ADR_PORTAL =
getProp(casePfx+"adr.portal","/portal");
+ private final String FRM_MAIN = "relative=up";
+ private final String SUB_CANCEL = "cancel";
+ private final String LNK_LOGOUT = "link=Logout";
+ private final String SUB_LOGIN = "login";
+ private final String INP_PASSWORD = "xpath=id('j_password')";
+ private final String INP_USERNAME = "xpath=id('j_username')";
+ private final String FRM_LOGINFORM = "login-content";
+ private final String LNK_LOGIN = "link=Login";
+
@AfterClass(enabled = true)
public void logoutIfNeeded()
{
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-02-13
09:46:49 UTC (rev 12817)
@@ -0,0 +1 @@
+vilko.pilko=mimilko
\ No newline at end of file
Show replies by date