Author: mposolda(a)redhat.com
Date: 2009-08-05 05:22:53 -0400 (Wed, 05 Aug 2009)
New Revision: 13668
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
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/LdapIdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
Log:
Refactoring. Selenium tests with Ldap and HTTPS.
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-08-05 09:20:20 UTC
(rev 13667)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-08-05 09:22:53 UTC
(rev 13668)
@@ -39,6 +39,7 @@
<!-- Default properties for single-test-without-dependencies -->
<property name="suite.test.name" value="Ant test" />
+ <property name="browser.url"
value="http://localhost:8080/portal/" />
<path id="jboss.test.classpath">
<pathelement path="${jboss.test.jar}" />
@@ -113,6 +114,13 @@
</target>
<target name="run-src">
+ <!-- Only one call is performed -->
+ <antcall target="run-src-without-ssl" />
+ <antcall target="run-src-with-ssl" />
+ </target>
+
+ <!-- RUNNING SELENIUM SERVER FOR NORMAL TESTING -->
+ <target name="run-src-without-ssl" unless="https.flag">
<echo message="Starting Selenium Remote Control" />
<java jar="${selsrv.dir}/selenium-server.jar" fork="true"
spawn="true">
<arg value="-multiWindow" />
@@ -125,25 +133,30 @@
<arg value="-debug" />
<arg value="-userExtensions" />
<arg value="${selsrv.dir}/user-extensions.js" />
- </java>
+ </java>
<sleep seconds="20" />
</target>
- <target name="run-src-with-ssl">
- <echo message="Starting Selenium Remote Control with usage of HTTPS"
/>
+ <!-- RUNNING SELENIUM SERVER FOR HTTPS TESTING -->
+ <target name="run-src-with-ssl" if="https.flag">
+ <echo message="Starting Selenium Remote Control for testing with HTTPS"
/>
<java jar="${selsrv.dir}/selenium-server.jar" fork="true"
spawn="true">
<arg value="-trustAllSSLCertificates" />
<arg value="-multiWindow" />
+ <arg value="-timeout" />
+ <arg value="320000" />
<arg value="-port" />
<arg value="44444" />
<arg value="-log" />
<arg value="selenium.log" />
<arg value="-debug" />
+ <arg value="-firefoxProfileTemplate" />
+ <arg value="${selsrv.dir}/https-testing/localhost/SSLFirefoxProfile"
/>
<arg value="-userExtensions" />
- <arg value="${selsrv.dir}/user-extensions.js" />
+ <arg value="${selsrv.dir}/user-extensions.js" />
</java>
<sleep seconds="20" />
- </target>
+ </target>
<target name="stop-src">
<get taskname="selenium-shutdown"
src="http://localhost:44444/selenium-server/driver/?cmd=shutDown"
dest="result.txt" ignoreerrors="true" />
@@ -212,6 +225,7 @@
<xmlfileset dir="." includes="${user.suite}" />
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -235,6 +249,7 @@
<xmlfileset dir="." includes="${test.suite}" />
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -258,6 +273,7 @@
<classfileset dir="${test.build.dir}" includes="${testname}"
/>
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -280,6 +296,7 @@
<classfileset dir="${test.build.dir}" includes="${testname}"
/>
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -303,6 +320,7 @@
<xmlfileset dir="." includes="${test.suite}" />
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -326,6 +344,7 @@
<xmlfileset dir="." includes="${test.cms.suite}" />
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
@@ -350,6 +369,7 @@
<xmlfileset dir="." includes="${usecase.suite}" />
<sysproperty key="browser" value="${browser}" />
+ <sysproperty key="browser.url" value="${browser.url}" />
<sysproperty key="screenshot" value="${screenshot}" />
<sysproperty key="debug" value="${debug}" />
<sysproperty key="workspace" value="${workspace}" />
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-08-05
09:20:20 UTC (rev 13667)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-08-05
09:22:53 UTC (rev 13668)
@@ -76,9 +76,12 @@
ELEM_TIMEOUT = Integer.valueOf(getMess("selenium.timeout.elem",
String.valueOf(ELEM_TIMEOUT+"")));
String browser = System.getProperty("browser");
+ String browserURL = System.getProperty("browser.url");
+ if ((browserURL == null) || ("".equals(browserURL))) {
+ browserURL = "http://localhost:8080/portal/";
+ }
+ selenium = new DefaultSelenium("127.0.0.1", 44444, browser, browserURL);
- selenium = new DefaultSelenium("127.0.0.1", 44444, browser,
"http://localhost:8080/portal/");
-
JBossSeleniumTestListener.selenium = selenium;
selenium.start();
selenium.setTimeout(PAGE_LOAD);
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/LdapIdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/LdapIdentityAdminTestCase.java 2009-08-05
09:20:20 UTC (rev 13667)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/LdapIdentityAdminTestCase.java 2009-08-05
09:22:53 UTC (rev 13668)
@@ -31,6 +31,12 @@
private final String LDAP_ROLE_NAME = "Ldap";
+ private final String INP_PROFILE_GIVENNAME = getLoc(casePfx +
"inp.profile.givenname",
"//input[contains(@id,'profile-form:givenname')]");
+ private final String INP_PROFILE_FAMILYNAME = getLoc(casePfx +
"inp.profile.familyname",
"//input[contains(@id,'profile-form:familyname')]");
+ private final String INP_PROFILE_EXTRA = getLoc(casePfx + "inp.profile.extra",
"//textarea[contains(@id,'profile-form:extra')]");
+ private final String INP_PROFILE_HOMEPAGE = getLoc(casePfx +
"inp.profile.homepage",
"//input[contains(@id,'profile-form:homepage')]");
+ private final String INP_PROFILE_LOCATION = getLoc(casePfx +
"inp.profile.location",
"//input[contains(@id,'profile-form:location')]");
+
/**
* <p>User (tempUser, tempPassword, tempUser(a)redhat.com) and role (tempRole,
* tempRoleDisplay) are created. The role is assigned to the user and it is
@@ -103,6 +109,25 @@
// Go to edit page and check user profile
goToEdit(LDAP1_USER, LDAP1_USER_MAIL);
// TODO: add localizators while they will be added to IdentityAdminTestCase.
+ Assert.assertTrue(selenium.getValue(INP_PROFILE_GIVENNAME).equals(LDAP1_FIRST_NAME),
"First name should be " + LDAP1_FIRST_NAME + " but is " +
selenium.getValue(INP_PROFILE_GIVENNAME));
+ Assert.assertTrue(selenium.getValue(INP_PROFILE_FAMILYNAME).equals(LDAP1_SURNAME),
"Surname should be " + LDAP1_SURNAME + " but is " +
selenium.getValue(INP_PROFILE_FAMILYNAME));
+ Assert.assertTrue(selenium.getValue(INP_PROFILE_LOCATION).contains("Brno, Czechue
Republic"), "Location should contains Brno,Czechue Republic but is " +
selenium.getValue(INP_PROFILE_LOCATION));
+ Assert.assertTrue(selenium.getValue(INP_PROFILE_EXTRA).contains("This is content
of ldap attribute \"description\""), "Description has value " +
selenium.getValue(INP_PROFILE_EXTRA));
+
+ // fill some attributes (homepage should be DB attribute and givenname should be LDAP
attribute) and check them.
+ selenium.type(INP_PROFILE_GIVENNAME, "Jack");
+ selenium.type(INP_PROFILE_HOMEPAGE, "http://www.jboss.org/jbossportal");
+ clickAndWait(SUB_EDIT_PROF);
+ goToEdit(LDAP1_USER, LDAP1_USER_MAIL);
+ Assert.assertTrue(selenium.getValue(INP_PROFILE_GIVENNAME).equals("Jack"),
"First name should be Jack but is " +
selenium.getValue(INP_PROFILE_GIVENNAME));
+
Assert.assertTrue(selenium.getValue(INP_PROFILE_HOMEPAGE).equals("ht...,
"Homepage should be
http://www.jboss.org/jbossportal but is " +
selenium.getValue(INP_PROFILE_HOMEPAGE));
+ // Change name to the original value
+ selenium.type(INP_PROFILE_GIVENNAME, LDAP1_FIRST_NAME);
+ clickAndWait(SUB_EDIT_PROF);
+
+ // Go to edit page and check user profile
+ goToEdit(LDAP1_USER, LDAP1_USER_MAIL);
+ // TODO: add localizators while they will be added to IdentityAdminTestCase.
Assert.assertTrue(selenium.getValue("//input[contains(@id,'profile-form:givenname')]").equals(LDAP1_FIRST_NAME),
"First name should be " + LDAP1_FIRST_NAME + " but is " +
selenium.getValue("//input[contains(@id,'profile-form:givenname')]"));
Assert.assertTrue(selenium.getValue("//input[contains(@id,'profile-form:familyname')]").equals(LDAP1_SURNAME),
"Surname should be " + LDAP1_SURNAME + " but is " +
selenium.getValue("//input[contains(@id,'profile-form:familyname')]"));
Assert.assertTrue(selenium.getValue("//input[contains(@id,'profile-form:location')]").contains("Brno,
Czechue Republic"), "Location should contains Brno,Czechue Republic but is
" +
selenium.getValue("//input[contains(@id,'profile-form:location')]"));
Modified:
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 2009-08-05
09:20:20 UTC (rev 13667)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-08-05
09:22:53 UTC (rev 13668)
@@ -74,6 +74,11 @@
iden.man.lnk.usermang.main2=//a[contains(@id,'user-temp-form1:user-mgm-link')]
iden.man.lnk.create.user=//a[contains(@id,':user-form:create-user-link')]
iden.man.chk.role=//input[contains(@name,''assign-roles-form:roles'') and
@value=''{0}'']
+iden.man.inp.profile.givenname=//input[contains(@id,'profile-form:givenname')]
+iden.man.inp.profile.familyname=//input[contains(@id,'profile-form:familyname')]
+iden.man.inp.profile.extra=//textarea[contains(@id,'profile-form:extra')]
+iden.man.inp.profile.homepage=//input[contains(@id,'profile-form:homepage')]
+iden.man.inp.profile.location=//input[contains(@id,'profile-form:location')]
# DashboardTestCase