Author: prabhat.jha(a)jboss.com
Date: 2008-09-17 18:20:20 -0400 (Wed, 17 Sep 2008)
New Revision: 11926
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/userDetail-portlet.war
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/selenium-java-client-driver.jar
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/testng-5.8-jdk15.jar
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/selenium-server.jar
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
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/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java
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/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSExportFolderTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSUserInterfaceTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/temp-testng-customsuite.xml
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/archive.zip
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/big_archive.zip
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/many_files.zip
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile.txt
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
Log:
adding selenium tests from svn.corp
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/userDetail-portlet.war
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/apps/userDetail-portlet.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
(rev 0)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2008-09-17 22:20:20 UTC
(rev 11926)
@@ -0,0 +1,164 @@
+<project name="Tests" default="compile" basedir="."
xmlns:server="http://jboss.org/ns/test/ant/server">
+
+ <property environment="env" />
+
+ <property name="java.home" location="${env.JAVA_HOME}" />
+
+ <property name="suitename" location="testng-files" />
+ <property name="testname" location="testng-files" />
+
+ <property name="testng.dir" location="testng-files" />
+ <property name="testng.output.dir" location="test-output" />
+ <property name="test.build.dir" location="output/classes" />
+ <property name="test.src.dir" location="src" />
+ <property name="lib.dir" location="lib" />
+ <property name="hudson.lib.dir" location="/qa/tools/opt/" />
+ <property name="jboss-test.jar"
location="${hudson.lib.dir}/jboss-test.jar" />
+ <available file="${jboss-test.jar}"
property="jboss-test.jar.present" />
+ <property name="junit.report.dir" location="test-report" />
+
+ <property name="selsrv.dir" location="selenium-rc-server" />
+ <property name="node0" value="localhost" />
+ <property name="jboss.test.home" value="${env.JBOSS_TEST_HOME}"
/>
+ <property name="jboss.test.jar" value="${env.JBOSSTESTJAR}"
/>
+ <property name="jboss.portal.dir"
value="${env.JBOSS_UNZIPED_DIR}" />
+ <property name="portal_archive" value="${env.JBOSS_ARCHIVE}"
/>
+ <property name="portal.instance" value="default" />
+
+ <path id="jboss.test.classpath">
+ <pathelement path="${jboss.test.jar}" />
+ </path>
+
+ <path id="libraries.cp">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+
+ </path>
+
+ <path id="test.cp">
+ <pathelement location="${test.build.dir}" />
+ <path refid="libraries.cp" />
+ </path>
+
+ <taskdef name="testng" classpathref="libraries.cp"
classname="org.testng.TestNGAntTask" />
+
+ <taskdef name="config"
classname="org.jboss.ant.taskdefs.server.ConfigManagerTask"
uri="http://jboss.org/ns/test/ant/server"
loaderref="server.loader">
+ <classpath id="server.taskdef.classpath">
+ <path refid="jboss.test.classpath" />
+ </classpath>
+ </taskdef>
+ <taskdef name="start"
classname="org.jboss.ant.taskdefs.server.StartServerTask"
uri="http://jboss.org/ns/test/ant/server"
loaderref="server.loader">
+ <classpath refid="server.taskdef.classpath" />
+ </taskdef>
+ <taskdef name="stop"
classname="org.jboss.ant.taskdefs.server.StopServerTask"
uri="http://jboss.org/ns/test/ant/server"
loaderref="server.loader">
+ <classpath refid="server.taskdef.classpath" />
+ </taskdef>
+
+ <target name="init">
+ <echo message="Browser : ${browser}" />
+ <echo message="Workspace : ${workspace}" />
+ <echo message="Deleting testng report directory"/>
+ <delete dir="${testng.output.dir}"/>
+ </target>
+
+ <!--target name="server-config" depends="unpack-portal"-->
+ <server:config javaHome="${java.home}"
jbossHome="${jboss.test.home}/${jboss.portal.dir}/">
+ <server name="${portal.instance}" host="${node0}">
+ <!-- jvmarg value="${jpda.cmdline}" / -->
+ <jvmarg value="-Xmx512m" />
+ <sysproperty key="java.endorsed.dirs"
value="${jboss.test.home}/${jboss.portal.dir}/lib/endorsed" />
+ </server>
+ </server:config>
+ <!--/target-->
+
+ <target name="compile" depends="">
+ <echo message="Compiling testsuite" />
+ <mkdir dir="${test.build.dir}" />
+ <javac srcdir="${test.src.dir}" destdir="${test.build.dir}"
classpathref="libraries.cp" debug="on" />
+ </target>
+
+ <target name="run-src">
+ <echo message="Starting Selenium Remote Control" />
+ <java jar="${selsrv.dir}/selenium-server.jar" fork="true"
spawn="true">
+ <arg value="-multiWindow" />
+ <arg value="-port" />
+ <arg value="44444" />
+ <arg value="-log" />
+ <arg value="selenium.log" />
+ <arg value="-userExtensions" />
+ <arg value="${selsrv.dir}/user-extensions.js" />
+ </java>
+ </target>
+
+ <target name="stop-src">
+ <get taskname="selenium-shutdown"
src="http://localhost:44444/selenium-server/driver/?cmd=shutDown"
dest="result.txt" ignoreerrors="true" />
+ <echo taskname="selenium-shutdown" message="DGF Errors during
shutdown are expected" />
+ </target>
+
+ <target name="unpack-portal">
+ <echo message="Going to unpack ${portal_archive} into ${jboss.test.home}"
/>
+ <unzip src="${portal_archive}" dest="${jboss.test.home}" />
+ <chmod file="${jboss.test.home}/${jboss.portal.dir}/bin/run.sh"
perm="u+x" />
+ </target>
+
+ <target name="copyApps" depends="unpack-portal">
+ <echo message="Copying userInterceptor portlet into the ${portal.instance}
server"/>
+ <copy file="apps/userDetail-portlet.war"
tofile="${jboss.test.home}/${jboss.portal.dir}/server/${portal.instance}/deploy/userDetail-portlet.war"/>
+ </target>
+
+ <target name="delete-portal">
+ <echo message="Going to delete directory ${jboss.test.home}" />
+ <delete dir="${jboss.test.home}/${jboss.portal.dir}/" />
+ </target>
+
+ <target name="clean">
+ <echo message="Going to delete directory ${test.build.dir}" />
+ <delete dir="${test.build.dir}" />
+ </target>
+
+ <target name="cleanup">
+ <echo message="Cleaning up..." />
+ <antcall target="stop-src" />
+ <antcall target="delete-portal" />
+
+ </target>
+
+ <target name="reports">
+ <mkdir dir="${junit.report.dir}" />
+ <junitreport todir="test-report">
+ <fileset dir="test-output">
+ <include name="*/*.xml" />
+ </fileset>
+
+ <report format="noframes" todir="test-report" />
+ </junitreport>
+ </target>
+
+ <target name="selenium-test" depends="init, compile, unpack-portal,
run-src">
+ <antcall target="copyApps" />
+ <echo message="Starting portal instance : ${portal.instance}" />
+ <server:start name="${portal.instance}" />
+
+ <echo message="Runing TestNG" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="test-output"
+ suitename="SeleniumSuite">
+
+ <xmlfileset dir="." includes="testng.xml" />
+
+ <!--classfileset dir="${test.build.dir}"
+ includes="org/jboss/portal/test/selenium/*Test.class" / -->
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="workspace" value="${workspace}"/>
+
+ <jvmarg value="-ea" />
+
+ </testng>
+ <echo message="Stoping portal instance : ${portal.instance}" />
+ <server:stop name="${portal.instance}" />
+ <antcall target="cleanup" />
+ </target>
+
+</project>
+
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/selenium-java-client-driver.jar
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/selenium-java-client-driver.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/testng-5.8-jdk15.jar
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/lib/testng-5.8-jdk15.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/selenium-server.jar
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/selenium-server.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,42 @@
+Selenium.prototype.findTableRow = function(locator, searchText, searchCol){
+ var table = this.browserbot.findElement(locator);
+
+ var rowObj = table.rows;
+ var minCol = 0;
+
+ for (rowNo=0; rowNo<rowObj.length; rowNo++) {
+ // No need to read too short rows
+ var maxCol = rowObj[rowNo].cells.length;
+ if (maxCol <= searchCol || maxCol <= minCol) {continue;}
+ ///alert("1" + searchText);
+ // Read the content of the search colomn
+ searchHtml = rowObj[rowNo].cells[searchCol].innerHTML;
+ //alert("2"+searchHtml);
+ // Let's ignore <TD> inside <TD>s.
+ // Due to some odd reasons 'm' switch does not work in 'match'
+ // - Sumith (10th Dec, 2006)
+ if (searchHtml.replace(/\n/g, "
").match(/<TD.*>.*<\/TD>/i)) continue;
+ ///alert("3"+searchHtml);
+ // Build the pattern to check search column
+ var searchPat = new RegExp(".*"+searchText+".*",
"m");
+ //var searchPat = new
RegExp("^(.*<[^<>]*>)?\\s*"+searchText+"\\s*(<[^<>]*>.*)?$",
"m");
+
//alert("4"+"|"+searchText+"|"+searchHtml+"|");
+ // No more processing for unmatched rows
+ if (!searchHtml.match(searchPat)) {continue;}
+
//alert("5"+"|"+searchText+"|"+searchHtml+"|");
+ // Got the row! Let's simply return it
+ return rowNo;
+ }
+ return -1;
+}
+
+Selenium.prototype.countTableRows = function(locator){
+ var table = this.browserbot.findElement(locator);
+
+ return table.rows.length;
+}
+
+Selenium.prototype.fillInEditor = function(locator, content){
+ var iframe = this.browserbot.findElement(locator);
+ iframe.contentDocument.body.innerHTML= content;
+}
\ No newline at end of file
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,148 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+
+import com.sun.java_cup.internal.internal_error;
+
+@Test(groups = { "cms_dashboard" }, enabled = true, description =
"Dashboard issues test case.")
+public class DashboardTestCase extends JBossPortalSeleniumTestCase {
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ //selenium.setSpeed("3000");
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testCreatePage() {
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("_id3jbpnsabcsnpbj:pageName", "DashTestPage");
+ selenium.click("_id3jbpnsabcsnpbj:_id4jbpnsabcsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=DashTestPage"));
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Powered by JBoss Portal"));
+ }
+
+ @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ public void testUpdateTheme() {
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("_id15jbpnsabcsnpbj:themeSelector",
"label=renaissance");
+ selenium.click("_id15jbpnsabcsnpbj:_id18jbpnsabcsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if
(!selenium.getSelectedLabel("page_selector_form:pageNameSelector").equals("DashTestPage"))
{
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ //System.out.println(selenium.isElementPresent("_id15jbpnsabcsnpbj:themeSelector"));
+ //System.out.println(selenium.getSelectedLabel("_id15jbpnsabcsnpbj:themeSelector"));
+
+ Assert.assertEquals("renaissance",
selenium.getSelectedLabel("_id15jbpnsabcsnpbj:themeSelector"));
+ }
+
+ @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ public void testUpdateLayout() {
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals("default",
selenium.getSelectedLabel("_id10jbpnsabcsnpbj:layoutSelector"));
+
+ selenium.select("_id10jbpnsabcsnpbj:layoutSelector",
"label=generic");
+ selenium.click("_id15jbpnsabcsnpbj:_id18jbpnsabcsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if
(!selenium.getSelectedLabel("page_selector_form:pageNameSelector").equals("DashTestPage"))
{
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ Assert.assertEquals("generic",
selenium.getSelectedLabel("_id10jbpnsabcsnpbj:layoutSelector"));
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreatePage" })
+ public void testAddPortlet() {
+
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("layoutForm:a_center");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Current users"));
+ Assert.assertTrue(selenium.isTextPresent("Whose 1 is logged-in:"));
+ Assert.assertTrue(selenium.isTextPresent("[admin]"));
+ }
+
+ @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ public void testAddGooglePortlet() {
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Configure dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("page_selector_form:pageNameSelector",
"label=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("abc:instanceId", "label=widget/google");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Hindu God of the Week");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("layoutForm:a_center");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Dashboard");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ //selenium.setSpeed("10000");
+ selenium.click("link=DashTestPage");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Hindu God of the Week"));
+ //Assert.assertTrue(selenium.isTextPresent("powered by Google"));
+ //selenium.setSpeed("0");
+ }
+
+ @Test(enabled = false, dependsOnMethods = { "testCreatePage" })
+ public void testReorder() {
+
+ }
+
+}
Added:
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
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,330 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "admin_ui" }, enabled = true)
+public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
+
+ public static final String ID_SUBMIT_CONF_CREATE_USER =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:admin";
+ public static final String ID_SUBMIT_DELETE_ROLE =
"_id31jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id33jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ //private static final String ID_BUT_DELETE_ROLE =
"_id21jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:2:_id38jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_SUBMIT_ROLE_CREATE =
"_id24jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id29jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_INPUT_ROLEDISNAME =
"_id24jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roledisplayname";
+ public static final String ID_INPUT_ROLENAME =
"_id24jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:rolename";
+ public static final String ID_BUT_ROLE_CREATE =
"_id43jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id45jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_BUT_SUBMIT_DEL_USER =
"_id32jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id34jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ //private static final String ID_BUT_USER_DELETE =
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:0:_id60jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_SUBMIT_ASSIGN_ROLE =
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id31jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ //private static final String ID_BUT_SEARCHED_USER_ROLES =
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:0:_id51jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_SUBMIT_CREATE_USER =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:submit";
+ public static final String ID_INPUT_PASSWORD_CHK =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:passwordCheck";
+ public static final String ID_INPUT_PASSWORD =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:password";
+ public static final String ID_INPUT_USEREMAIL =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:email";
+ public static final String ID_INPUT_USERNAME =
"_id25jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:username";
+ public static final String ID_SUBMIT_SEARCH_USER =
"_id24jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:search";
+ public static final String ID_INPUT_SEARCH_USER =
"_id24jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:searchString";
+ public static final String ID_BUT_SEARCH_USER =
"_id20jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id22jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_LINK_USERTAB =
"_id1jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id3jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_LINK_USERMAIN =
"_id9jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id12jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_LINK_ROLETAB =
"_id1jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id5jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_LINK_ROLEMAIN =
"_id9jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id12jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ public static final String ID_LINK_CREATE_USER =
"_id20jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:_id23jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+
+ private String butSeaUsrRol_id(String userName){
+ String table
="_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ int r = findTableRow(table, userName, 0);
+ return
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:"+(r-1)+":_id51jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ }
+
+ private String butDelUsr_id(String userName){
+ String table =
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ int r = findTableRow(table, userName, 0);
+ return
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:"+(r-1)+":_id60jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ }
+
+ private String butDelRol_id(String roleName){
+ String table =
"_id21jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ int r = findTableRow(table, roleName, 0);
+ return
"_id21jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:"+(r-1)+":_id38jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ }
+
+ private String butUsrRol_id(String userName){
+ String table
="_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ int r = findTableRow(table, userName, 0);
+ return
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:"+(r-1)+":_id51jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ }
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @BeforeClass(groups = { "single" })
+ public void loginBefore() {
+ login("admin", "admin");
+ }
+
+ @AfterClass(groups = { "single" })
+ public void logoutAfter() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Creation of new user.")
+ public void testCreateUser() {
+ createUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
+ searchUser("tempUser", "tempUser(a)redhat.com");
+ deleteUser("tempUser", "tempUser(a)redhat.com");
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateUser" }, description =
"Creation of already existing user.")
+ public void testCreateExistingUser() {
+ createUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
+ searchUser("tempUser", "tempUser(a)redhat.com");
+ createExistingUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
+ deleteUser("tempUser", "tempUser(a)redhat.com");
+ }
+
+ @Test(enabled = true, description = "Creation of new role.")
+ public void testCreateRole() {
+ String role = "tempRole";
+ createRole(role, "tempRoleDisplay");
+ deleteRole(role);
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateUser",
"testCreateRole" }, description = "Assigning of the role to the
user.")
+ public void testAssignRole2User() {
+ String user = "tempUser";
+ String userMail = "tempUser(a)redhat.com";
+ String role = "tempRole";
+ String roleDisplay = "tempRoleDisplay";
+
+ createUser(user, "tempPassword", userMail);
+ createRole(role, "tempRoleDisplay");
+ assignRole(user, userMail, role, roleDisplay);
+
+ deassignRole(user, userMail, role, roleDisplay);
+ deleteRole(role);
+ deleteUser(user, userMail);
+
+ }
+
+ private void assignRole(String user, String email, String role, String roleDisplay) {
+
+ searchUser(user, email);
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
+
+ final String ID_CHECK_ROLE =
"//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles'
and @value='" + role + "']";
+
+ selenium.click(ID_CHECK_ROLE);
+
+ selenium.click(ID_SUBMIT_ASSIGN_ROLE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser(user, email);
+
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isChecked(ID_CHECK_ROLE), "The role wasn't
correctly assigned.");
+
+ }
+
+ private void deassignRole(String user, String email, String role, String roleDisplay) {
+
+ searchUser(user, email);
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
+
+ // check the tempRole check box
+ final String ID_CHECK_ROLE =
"//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles'
and @value='" + role + "']";
+ selenium.click(ID_CHECK_ROLE);
+
+ selenium.click(ID_SUBMIT_ASSIGN_ROLE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ searchUser(user, email);
+
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isChecked(ID_CHECK_ROLE), "Unassigned role is assigned
(checked).");
+
+ }
+
+ private void createUser(String username, String password, String email) {
+ selenium.open("/portal/auth/portal/default");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(ID_LINK_USERMAIN);
+ selenium.click(ID_LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Username *"), "Label for
username input is wrong or missing.");
+ selenium.type(ID_INPUT_USERNAME, username);
+ Assert.assertTrue(selenium.isTextPresent("E-Mail *"), "Label for e-mail
input is wrong or missing.");
+ selenium.type(ID_INPUT_USEREMAIL, email);
+ Assert.assertTrue(selenium.isTextPresent("Password *"), "Label for
password input is wrong or missing.");
+ selenium.type(ID_INPUT_PASSWORD, password);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Password *"), "Label
for password confirm input is wrong or missing.");
+ selenium.type(ID_INPUT_PASSWORD_CHK, password);
+
+ selenium.click(ID_SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("This username is already taken.
tempUser"), "User already exists.");
+
+ selenium.click(ID_SUBMIT_ASSIGN_ROLE);
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirmation"), "Confirmation
screen is missing or corrupted.");
+ selenium.click(ID_SUBMIT_CONF_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("User created"), "User was not
created (\"User created\" text missing).");
+
+ }
+
+ private void createExistingUser(String username, String password, String email) {
+ selenium.open("/portal/auth/portal/default");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERMAIN);
+
+ selenium.click(ID_LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(ID_INPUT_USERNAME, username);
+ selenium.type(ID_INPUT_USEREMAIL, email);
+ selenium.type(ID_INPUT_PASSWORD, password);
+ selenium.type(ID_INPUT_PASSWORD_CHK, password);
+ selenium.click(ID_SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert
+ .assertTrue(selenium.isTextPresent("This username is already taken.
tempUser"),
+ "No user was overwritten, current username wasn't already taken.");
+
+ }
+
+ private void searchUser(String username, String email) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ clickIfVisible(ID_LINK_USERMAIN);
+
+ selenium.click(ID_BUT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(ID_INPUT_SEARCH_USER, username);
+ selenium.click(ID_SUBMIT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
+ Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not
found.");
+ }
+
+ private void deleteUser(String username, String email) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_USERTAB);
+ // user home page
+ clickIfVisible(ID_LINK_USERMAIN);
+
+ selenium.click(ID_BUT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(ID_INPUT_SEARCH_USER, username);
+ selenium.click(ID_SUBMIT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
+ Assert.assertTrue(selenium.isTextPresent(email), "User e-mail adress was not
found.");
+ selenium.click(butDelUsr_id(username));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(ID_BUT_SUBMIT_DEL_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("User deleted"), "user was not
deleted (\"User deleted\" text missing).");
+ }
+
+ private void createRole(String roleName, String roleDisplayName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ Assert.assertTrue(selenium.isElementPresent(ID_BUT_ROLE_CREATE), "Button for role
creating has wrong id or doesn't exist.");
+ Assert.assertEquals(selenium.getText(ID_BUT_ROLE_CREATE), "Create role",
"Button for role creating has wrong label.");
+ selenium.click(ID_BUT_ROLE_CREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Role"), "Label for role name
not present or incorrect.");
+ selenium.type(ID_INPUT_ROLENAME, roleName);
+ Assert.assertTrue(selenium.isTextPresent("Display name"), "Label for
display role name not present or incorrect.");
+ selenium.type(ID_INPUT_ROLEDISNAME, roleDisplayName);
+ selenium.click(ID_SUBMIT_ROLE_CREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(roleName), "Name of newly created role is
missing.");
+ Assert.assertTrue(selenium.isTextPresent(roleDisplayName), "Display name of newly
created role is missing.");
+ }
+
+ private void deleteRole(String roleName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_ROLETAB);
+ clickIfVisible(ID_LINK_ROLEMAIN);
+
+ Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
+
+ selenium.click(butDelRol_id(roleName));
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Warning! You are about to delete the
role " + roleName),
+ "Confirmation text for role deletion missing missing.");
+ selenium.click(ID_SUBMIT_DELETE_ROLE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
+
+}
Added:
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
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,87 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+public class JBossPortalSeleniumTestCase {
+ protected Selenium selenium;
+ protected static final String PAGE_LOAD = "50000";
+
+ @BeforeClass
+ public void setupChromeForLogin() throws Exception {
+
+ String browser = System.getProperty("browser");
+
+ selenium = new DefaultSelenium("127.0.0.1", 44444, browser,
"http://localhost:8080/portal/");
+ selenium.start();
+ selenium.setTimeout("300000");
+ }
+
+ @AfterClass
+ public void tearDownInstaller() throws Exception {
+ selenium.stop();
+ }
+
+ protected void clickIfVisible(String id) {
+ if (findLink(id)) {
+ selenium.click(id);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+ if (selenium.isElementPresent(id)){
+ selenium.click(id);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+ }
+
+ protected boolean findLink(String id) {
+ for (String link : selenium.getAllLinks()) {
+ if (link.equals(id)) {
+ return true;
+ }
+ }
+ for (String link : selenium.getAllFields()) {
+ //System.out.println(link);
+ if (link.equals(id)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected int findTableRow(String tableLocation, String searchName, int searchCol) {
+ return Integer.valueOf(selenium.getEval("selenium.findTableRow(\"" +
tableLocation + "\",'" + searchName + "'," + searchCol +
")"));
+ }
+
+ protected int countTableRows(String tableLocation){
+ return Integer.valueOf(selenium.getEval("selenium.countTableRows(\"" +
tableLocation + "\")"));
+ }
+
+ protected void login(String username, String password) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Login");
+ selenium.selectFrame("login-content");
+ selenium.type("j_username", username);
+ selenium.type("j_password", password);
+ Assert.assertTrue(selenium.isElementPresent("login"));
+ selenium.click("login");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: "+username),
"Not logged in, login message missing.");
+ }
+
+ protected void logout() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=Logout"));
+ selenium.click("link=Logout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "Not logged
in, login message missing.");
+ Assert.assertTrue(selenium.isElementPresent("Link=Login"), "Login link
not present.");
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,118 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "portlet_user_creation" }, enabled = true)
+public class PortletUserCreationTestCase extends JBossPortalSeleniumTestCase {
+ private static final String SUBMIT_CREATE_CONF =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:user";
+
+ private static final String SUBMIT_CREATE_USER =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:submit";
+
+ private static final String INPUT_USERPASSWDCONF =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:passwordCheck";
+
+ private static final String INPUT_USERPASSWD =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:password";
+
+ private static final String INPUT_USERMAIL =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:email";
+
+ private static final String INPUT_USERNAME =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:username";
+
+ private static final String LINK_CREATE_USER =
"_id14jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:_id16jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj";
+
+ private static final String TAB_WELCOME =
"_id1jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj:_id3jbpns_2fdefault_2fdefault_2fIdentityUserPortletWindowsnpbj";
+
+ @Test(enabled = true, description = "Simple user creation.")
+ public void userCreationTest() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ Assert.assertTrue((selenium.isElementPresent(LINK_CREATE_USER)));
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("Username *")));
+ Assert.assertTrue((selenium.isTextPresent("E-Mail *")));
+ Assert.assertTrue((selenium.isTextPresent("Password *")));
+ Assert.assertTrue((selenium.isTextPresent("Confirm Password *")));
+ selenium.type(INPUT_USERNAME, "portletUser");
+ selenium.type(INPUT_USERMAIL, "portletUser(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "portletUserPassword");
+ selenium.type(INPUT_USERPASSWDCONF, "portletUserPassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("portletUser")));
+ Assert.assertTrue((selenium.isTextPresent("portletUser(a)redhat.com")));
+ selenium.click(SUBMIT_CREATE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue((selenium.isTextPresent("* Your account has been successfully
created. You may want to login now.")));
+ }
+
+ @Test(enabled = true, description = "Creation of already existing user.")
+ public void existingUserCreationTest() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "user");
+ selenium.type(INPUT_USERMAIL, "user(a)portal.com");
+ selenium.type(INPUT_USERPASSWD, "userpassword");
+ selenium.type(INPUT_USERPASSWDCONF, "userpassword");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("This username is already taken.
user"));
+ }
+
+ @Test(enabled = true, description = "Using invalid e-mail within user
creation.")
+ public void invalidEmail() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "invalidMail");
+ selenium.type(INPUT_USERMAIL, "invalidMail@");
+ selenium.type(INPUT_USERPASSWD, "invalidMailp");
+ selenium.type(INPUT_USERPASSWDCONF, "invalidMailp");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Invalid E-Mail address."));
+
+ }
+
+ @Test(enabled = true, description = "Not matching password confirmation.")
+ public void passwordNotMatch() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "wrongPass");
+ selenium.type(INPUT_USERMAIL, "wrongPass(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "wrongPass1");
+ selenium.type(INPUT_USERPASSWDCONF, "wrongPass2");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("The passwords doesn't
match."));
+ }
+
+ @Test(enabled = true, description = "Using short password.")
+ public void shortPass() {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_WELCOME);
+ selenium.click(LINK_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_USERNAME, "wrongPass");
+ selenium.type(INPUT_USERMAIL, "wrongPass(a)redhat.com");
+ selenium.type(INPUT_USERPASSWD, "w1");
+ selenium.type(INPUT_USERPASSWDCONF, "w1");
+ selenium.click(SUBMIT_CREATE_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("password: Validation Error: Value is
less than allowable minimum of '6'"));
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserInterceptorPortletTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,71 @@
+package org.jboss.portal.test.selenium;
+
+import java.util.Date;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Vector;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel;
+
+@Test(groups = { "cms_user_interceptor" }, enabled = true, description =
"Checking the log of logging of users.")
+public class UserInterceptorPortletTestCase extends JBossPortalSeleniumTestCase {
+
+ @Test(enabled = true, description = "Checking the logging dates for user.")
+ public void testTestUserLogger() throws ParseException {
+
+ Assert.assertTrue(dateDiff("user", "user", 1) > 0, "Second
logging was not after the first for user.");
+ }
+
+ @Test(enabled = true, description = "Checking the logging dates for admin.")
+ public void testTestAdminLogger() throws ParseException {
+ Assert.assertTrue(dateDiff("admin", "admin", 3) > 0,
"Second logging was not after the first for user.");
+ }
+
+ private int dateDiff(String name, String passwd, int ind) throws ParseException {
+ DateFormat df = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
+ Vector<String> vs;
+ String logInfo;
+
+ login(name, passwd);
+ logout();
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=UsersDetailPage");
+ selenium.waitForPageToLoad("30000");
+ logInfo =
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div");
+
+ vs = parseUserInterceptorString(logInfo);
+
+ Date d1 = df.parse(vs.get(ind));
+
+ login(name, passwd);
+ logout();
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=UsersDetailPage");
+ selenium.waitForPageToLoad("30000");
+ logInfo =
selenium.getText("//div[@id='regionB']/div/table/tbody/tr[2]/td[2]/div");
+
+ vs = parseUserInterceptorString(logInfo);
+
+ Date d2 = df.parse(vs.get(ind));
+
+ return d2.compareTo(d1);
+ }
+
+ private Vector<String> parseUserInterceptorString(String input) {
+ Vector<String> result = new Vector<String>();
+
+ String[] lines = input.split("\n");
+
+ for (int i = 1; i <= 4; i++)
+ result.add(lines[i].split(": ")[1].trim());
+
+ return result;
+ }
+
+}
Added:
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
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,146 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "login" }, enabled = true)
+public class UserLoginTestCase extends JBossPortalSeleniumTestCase {
+
+ @AfterClass(enabled = true)
+ public void logoutIfNeeded()
+ {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if (selenium.isElementPresent("link=Logout")){
+ selenium.click("link=Logout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ }
+
+ @Test(enabled = true, description = "login as default user 'user' with
password 'user'.")
+ public void testDefaultUserLogin() throws Exception {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=Login"), "Expected DOM
element for login link does not exist.");
+ Assert.assertEquals(selenium.getText("link=Login"), "Login",
"Login button doesn't exist.");
+
+ selenium.click("link=Login");
+ selenium.selectFrame("login-content");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_username')"),
"Expected input DOM element for username doesn't exist.");
+ selenium.type("j_username", "user");
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_password')"),
"Expected input DOM element for password doesn't exist.");
+ selenium.type("j_password", "user");
+ selenium.click("login");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: user"),
"\"Logged in as\" message missing.");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
+ "DOM Element with username label not available.");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
"Username:");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
+ "Incorrect username for default user \"user\".");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
"user");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
+ "DOM Element with e-mail label not available.");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
"E-Mail:");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
+ "Incorrect e-mail for default user \"user\".");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
"user(a)portal.com");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected
DOM element for login link does not exist.");
+ Assert.assertEquals(selenium.getText("link=Logout"), "Logout",
"Logout has wrong label.");
+
+ selenium.click("link=Logout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"),
"\"Logged in as:\" message with no user logged in is missing.");
+ }
+
+ @Test(enabled = true, description = "login as admin user 'admin' with
password 'admin'.")
+ public void testAdminLogin() throws Exception {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=Login"), "Expected DOM
element for login link does not exist.");
+ Assert.assertEquals(selenium.getText("link=Login"), "Login",
"Login button doesn't exist.");
+
+ selenium.click("link=Login");
+ selenium.selectFrame("login-content");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_username')"),
"Expected input DOM element for username doesn't exist.");
+ selenium.type("j_username", "admin");
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_password')"),
"Expected input DOM element for password doesn't exist.");
+ selenium.type("j_password", "admin");
+ selenium.click("login");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: admin"),
"\"Logged in as\" message missing.");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
+ "DOM Element with username label not available.");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[1]/"),
"Username:");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
+ "Incorrect username for default user \"user\".");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/"),
"admin");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
+ "DOM Element with e-mail label not available.");
+ Assert.assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[1]/"),
"E-Mail:");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
+ "Incorrect e-mail for default user \"user\".");
+ Assert
+ .assertEquals(selenium.getText("xpath=id('regionA')/div[2]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[2]/td[2]/"),
+ "admin(a)portal.com");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Logout"), "Expected
DOM element for login link does not exist.");
+ Assert.assertEquals(selenium.getText("link=Logout"), "Logout",
"Logout has wrong label.");
+
+ selenium.click("link=Logout");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"),
"\"Logged in as:\" message with no user logged in is missing.");
+ }
+
+ @Test(enabled = true, description = "canceling of the login form.")
+ public void testUserLoginCancel() throws Exception {
+ selenium.open("/portal");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"),
"\"Logged in as:\" message with no user logged in is missing.");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Login"), "DOM element
for login link not found.");
+ Assert.assertEquals(selenium.getText("link=Login"), "Login",
"Login button doesn't exist.");
+
+ selenium.click("link=Login");
+ selenium.selectFrame("login-content");
+
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_username')"),
"Expected input DOM element for username doesn't exist.");
+ selenium.type("j_username", "saki");
+ Assert.assertTrue(selenium.isElementPresent("xpath=id('j_password')"),
"Expected input DOM element for password doesn't exist.");
+ selenium.type("j_password", "paki");
+
+ selenium.click("cancel");
+ selenium.selectFrame("relative=up");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Login"), "DOM element
for login link not found.");
+ Assert.assertEquals(selenium.getText("link=Login"), "Login",
"Login button doesn't exist.");
+
+ Assert.assertFalse(selenium.isTextPresent("Logged in as:"),
"\"Logged in as:\" message with no user logged in is missing.");
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,255 @@
+package org.jboss.portal.test.selenium;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.testng.Assert;
+
+import com.sun.java_cup.internal.internal_error;
+
+@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test
case.")
+public class WSRPTestCase extends JBossPortalSeleniumTestCase {
+
+ // private static final String ID_LINK_PRODCONF =
+ //
"_id1jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id3jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"
+ // ;
+ // private static final String ID_LINK_CONSCONF =
+ //
"_id1jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id3jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"
+ // ;
+
+ private static final String ID_LINK_PRODCONF = "link=*Producer
Configuration*";
+ private static final String ID_LINK_CONSCONF = "link=*Consumers
Configuration*";
+
+ public static String WSRP_CONSUMER_TABLE =
"//div[@id='center']/div/div/div/table";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Creating a standard BEA consumer.")
+ public void testCreateBeaConsumer() {
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+
+ selenium.type("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:consumerName",
"BEA");
+ selenium.click("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id18jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:cache",
"600");
+ // selenium.click("link=14. Web Services for Remote Portlets (WSRP)");
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:wsdl",
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Refresh failed (probably because the
registration information was not valid)."));
+ Assert
+ .assertEquals(
+ "Missing value",
+ selenium
+ .getText("//form[@id='_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj']/table/tbody/tr[4]/td/span/table/tbody/tr[2]/td[3]/span"));
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id38jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
+ "public");
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id48jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Refresh was successful."));
+ selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("BEA"));
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer",
"testBeaConsumerDeregister" }, description = "Standard BEA consumer
registering.")
+ public void testBeaConsumerRegister() {
+
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0);
+ selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[4]");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id52jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[4]"), "Deregister");
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deregistering.")
+ public void testBeaConsumerDeregister() {
+
+ createConsumer("BEAreg", "100",
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0);
+
+ selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[4]");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id49jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[4]"), "Register");
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer",
"testBeaConsumerDeactivate" }, description = "Standard BEA consumer
activating.")
+ public void testBeaConsumerActivate() {
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0);
+
+ Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
+
+ selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[3]");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deactivating.")
+ public void testBeaConsumerDeactivate() {
+
+ createConsumer("BEAact", "100",
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0);
+
+ Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
+
+ selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[3]");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh
needed)"));
+
+ }
+
+ @Test(enabled = false, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer configuring.")
+ public void testBeaConsumerConfigure() {
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deleting.")
+ public void testBeaConsumerDelete() {
+
+ createConsumer("BEAdel", "100",
"http://wsrp.bea.com:7001/producer/producer?WSDL");
+
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_CONSCONF);
+ Assert.assertTrue(selenium.isTextPresent("BEAdel"));
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0);
+
+ selenium.click(WSRP_CONSUMER_TABLE + "/tbody/tr[" + r +
"]/td[2]/a[5]");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("_id29jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id30jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("BEAdel"));
+ }
+
+ @Test(enabled = true, description = "Basic configuring of WSRP producer.")
+ public void testConfigureProducer() {
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ clickIfVisible(ID_LINK_PRODCONF);
+
+
+ selenium.click("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id26jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium
+ .type(
+ "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id27jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
+ "testProp");
+ selenium
+ .type(
+ "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
+ "testProp label");
+ selenium
+ .type(
+ "_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id37jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
+ "tetsPropHint");
+ selenium.click("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id45jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully
saved!"));
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(ID_LINK_PRODCONF);
+
+ Assert
+ .assertEquals(
+ "testProp",
+ selenium
+ .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id27jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
+ Assert
+ .assertEquals(
+ "testProp label",
+ selenium
+ .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
+ Assert
+ .assertEquals(
+ "tetsPropHint",
+ selenium
+ .getValue("_id10jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:registrationProperties:0:_id37jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj"));
+
+ }
+
+ private void createConsumer(String name, String timeout, String address) {
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+ selenium.type("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:consumerName",
name);
+ selenium.click("_id16jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id18jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:cache",
timeout);
+ // selenium.click("link=14. Web Services for Remote Portlets (WSRP)");
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:wsdl",
address);
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id34jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id38jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj",
+ "public");
+ selenium.click("_id21jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id48jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("_id6jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj:_id8jbpns_2fadmin_2fWSRP_2fWSRPConfigurationPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+}
\ No newline at end of file
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,131 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_archive_upload" }, enabled = true)
+public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
+
+ /*
+ {
+ System.setProperty("workspace","/home/vrockai/workspace/selenium/selenium/");
+ }
+ */
+
+ private final String WORKSPACE = System.getProperty("workspace");
+
+ @BeforeMethod( groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod( groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Test archive consisting of two files
upload.")
+ public void testArchiveUpload() {
+ //System.out.println("archive adress:" + WORKSPACE);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE + "/test_files/archive.zip");
+
+ selenium.click("submit");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
+ "Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
+
+ selenium.setSpeed("60000");
+ selenium.click("link=Home");
+ selenium.setSpeed("0");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("link=archive"), "archive");
+
+ selenium.click("link=archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("link=readme.txt"),
"readme.txt");
+ Assert.assertEquals(selenium.getText("link=jbosslogo.png"),
"jbosslogo.png");
+ }
+
+ @Test(enabled = true, description = "Test archive consisting of > 100 files
upload.")
+ public void testManyFilesArchiveUpload() {
+ //System.out.println("archive adress:" + WORKSPACE);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE +
"/test_files/many_files.zip");
+
+ selenium.click("submit");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
+ "Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
+
+ selenium.setSpeed("60000");
+ selenium.click("link=Home");
+ selenium.setSpeed("0");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=many_files"));
+
+ selenium.click("link=many_files");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ //TODO assert all files
+
+ Assert.assertTrue(selenium.isElementPresent("link=file31.txt"));
+ }
+
+ @Test(enabled = true, description = "Test archive consisting of 21MB file
upload.")
+ public void testBigArchiveUpload() {
+ //System.out.println("archive adress:" + WORKSPACE);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE +
"/test_files/big_archive.zip");
+
+ selenium.click("submit");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
+ "Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
+
+ selenium.setSpeed("60000");
+ selenium.click("link=Home");
+ selenium.setSpeed("0");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=bigfile"));
+
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,269 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_directory" }, enabled = true)
+public class CMSDirectoryTestCase extends JBossPortalSeleniumTestCase {
+
+ private final String defaultDirName = "default";
+ private final String tempDirName = "tempDir";
+ private final String copyDirName = "copySrc";
+ private final String moveDirName = "moveSrc";
+
+ private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+
+ @BeforeMethod( groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description="Directory creation.")
+ public void testCreateDirectory() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS");
+ Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder
is already present.");
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("newcollectionname", tempDirName);
+ selenium.type("newcollectiondescription", "test folder");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/ul/li[3]"));
+ Assert.assertEquals(tempDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Directory delete.")
+ public void testDeleteDirectory() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select(takeAction(tempDirName) + "/select",
"label=Delete");
+ selenium.click(takeAction(tempDirName) + "/select/option[4]");
+ selenium.click(takeAction(tempDirName) + "/input");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" +
tempDirName));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=" + tempDirName));
+ }
+
+ @Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Copying of directory.")
+ public void testCopyDirectory() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("newcollectionname"));
+ Assert.assertTrue(selenium.isElementPresent("newcollectiondescription"));
+ Assert.assertEquals("Confirm Directory Creation",
selenium.getText("//div[@id='center']/div/h3"));
+
+ selenium.type("newcollectionname", copyDirName);
+ selenium.type("newcollectiondescription", "source folder for
copy");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(copyDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(takeAction(copyDirName) + "/select",
"label=Copy");
+ selenium.click(takeAction(copyDirName) + "/select/option[2]");
+ selenium.click(takeAction(copyDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=" + defaultDirName);
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals("copySrc",
selenium.getText("//div[@id='center']/div/div/ul/li[5]"));
+ Assert.assertTrue(selenium.isElementPresent("link=" + defaultDirName));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + copyDirName));
+ selenium.click("link=" + defaultDirName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + copyDirName));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Canceling of copying of
directory.")
+ public void testCopyCancelDirectory() {
+ String copyCancelDirName = "L"+ "copyLDirName" +
"Cancel";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("newcollectionname"));
+ Assert.assertTrue(selenium.isElementPresent("newcollectiondescription"));
+ Assert.assertEquals("Confirm Directory Creation",
selenium.getText("//div[@id='center']/div/h3"));
+
+ selenium.type("newcollectionname", copyCancelDirName);
+ selenium.type("newcollectiondescription", "source folder for
copy");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(takeAction(copyDirName) + "/select",
"label=Copy");
+ selenium.click(takeAction(copyDirName) + "/select/option[2]");
+ selenium.click(takeAction(copyDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=" + defaultDirName);
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + copyCancelDirName));
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=" + copyCancelDirName));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Moving a directory.")
+ public void testMoveDirectory() {
+ //selenium.setSpeed("3000");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("newcollectionname"));
+ Assert.assertTrue(selenium.isElementPresent("newcollectiondescription"));
+ Assert.assertEquals("Confirm Directory Creation",
selenium.getText("//div[@id='center']/div/h3"));
+
+ selenium.type("newcollectionname", moveDirName);
+ selenium.type("newcollectiondescription", "source folder for
move");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(moveDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + moveDirName));
+ selenium.select(takeAction(moveDirName) + "/select",
"label=Move");
+ selenium.click(takeAction(moveDirName) + "/select/option[2]");
+ selenium.click(takeAction(moveDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=" + defaultDirName);
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(moveDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[5]"));
+ Assert.assertTrue(selenium.isElementPresent("link=" + defaultDirName));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=" + moveDirName));
+ selenium.click("link=" + defaultDirName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=" + moveDirName));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testCreateDirectory",
description="Canceling of moving a directory.")
+ public void testMoveCancelDirectory() {
+ String moveCancelDirName = "X" + "moveXDirName" +
"Cancel";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("newcollectionname"));
+ Assert.assertTrue(selenium.isElementPresent("newcollectiondescription"));
+ Assert.assertEquals("Confirm Directory Creation",
selenium.getText("//div[@id='center']/div/h3"));
+
+ selenium.type("newcollectionname", moveCancelDirName);
+ selenium.type("newcollectiondescription", "source folder for
move");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(takeAction(moveCancelDirName) + "/select",
"label=Move");
+ selenium.click(takeAction(moveCancelDirName) + "/select/option[2]");
+ selenium.click(takeAction(moveCancelDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=" + defaultDirName);
+ selenium.click("cancel");
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + moveCancelDirName));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=" + defaultDirName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=" + moveCancelDirName));
+
+ }
+
+ private String takeAction(String searchName) {
+
+ int row = findTableRow(CMS_FILE_TABLE, searchName, 0);
+
+ return takeAction(row);
+
+ }
+
+ private String takeAction(int row) {
+ return "//div[@id='center']/div/div/div[3]/table/tbody/tr[" + ++row +
"]/td[2]/form";
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSExportFolderTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSExportFolderTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSExportFolderTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,21 @@
+package org.jboss.portal.test.selenium.cms;
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_exportFolder" }, enabled = false)
+
+public class CMSExportFolderTestCase {
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,371 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_file" }, enabled = true)
+public class CMSFileTestCase extends JBossPortalSeleniumTestCase {
+
+ private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod( groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Common file structure browsing test.")
+ public void testDefaultBrowsing() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=default"));
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=images"));
+ Assert.assertTrue(selenium.isElementPresent("link=private"));
+ Assert.assertTrue(selenium.isElementPresent("link=index.html"));
+ Assert.assertTrue(selenium.isElementPresent("link=project.html"));
+ Assert.assertTrue(selenium.isElementPresent("link=support.html"));
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=text/html"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ Assert.assertEquals("JBoss Portal",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=images");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isElementPresent("link=logo.gif"));
+ }
+
+ @Test(enabled = true, description = "File properties checking.")
+ public void testFileProperties() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS/CMSAdminPortletWindow?op=main&action=2&path=%2F");
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
+ Assert.assertEquals("text/html",
selenium.getText("link=text/html"));
+ Assert.assertEquals("English", selenium.getText("link=English"));
+ Assert.assertEquals("Type",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[1]/b"));
+ Assert.assertEquals("Size",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[2]/b"));
+ Assert.assertEquals("Version",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[3]/b"));
+ Assert.assertEquals("Created",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[4]/b"));
+ Assert.assertEquals("Modified",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[5]/b"));
+ Assert.assertEquals("Title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[3]/td[6]/b"));
+
+ Assert.assertEquals("2kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals("JBoss Portal",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+
+ Assert.assertEquals("index.html",
selenium.getText("//div[@id='center']/div/div/ul/li[5]"));
+ Assert.assertEquals("Manage Content",
selenium.getText("//div[@id='center']/div/h3"));
+
+ Assert.assertTrue(selenium.isElementPresent("//div[(a)id='center']/div/div/div/div/select/option[.='Create']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[(a)id='center']/div/div/div/div/select/option[.='Copy']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[(a)id='center']/div/div/div/div/select/option[.='Move']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[(a)id='center']/div/div/div/div/select/option[.='Delete']"));
+ Assert.assertTrue(selenium.isElementPresent("//div[(a)id='center']/div/div/div/div/select/option[.='Secure']"));
+
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreateFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals("0kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("newFile title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("newFile", selenium.getText("link=newFile"));
+
+ }
+
+ @Test(enabled = true, description = "Editing of file.")
+ public void testEditFile() {
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "file2edit");
+ selenium.type("description", "file2edit description");
+ selenium.type("title", "file2edit title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = findTableRow("//div[@id='center']/div/div/table",
"1.0", 2)+1;
+
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+ row
+"]/td[3]"));
+ Assert.assertEquals("0kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+ row
+"]/td[2]"));
+ Assert.assertEquals("file2edit title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+ row
+"]/td[6]"));
+
+ selenium.click("link=text/plain");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("1.1"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[5]/td[3]/img"));
+
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("file2edit",
selenium.getText("link=file2edit"));
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testDeleteFile", description =
"Creation of existing file.")
+ public void testCreateExistingFile() {
+ String filename = "existingFile";
+
+ createFile(filename);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "existingFile");
+ selenium.type("description", "existingFile description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertTrue(selenium.isTextPresent("1.0"));
+ Assert.assertTrue(selenium.isTextPresent("1.1"));
+ Assert.assertFalse(selenium.isTextPresent("1.2"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("existingFile", selenium.getText("link=" +
filename));
+
+ deleteFile(filename);
+ }
+
+ @Test(enabled = true, description = "File creation and moving to default
directory.")
+ public void testMoveFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "fileToMove");
+ selenium.type("description", "fileToMove description");
+ selenium.type("title", "fileToMove title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals("0kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+ Assert.assertEquals("fileToMove title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("fileToMove",
selenium.getText("link=fileToMove"));
+
+ int row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0)+1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Move");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[3]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+ }
+
+ @Test(enabled = true, description = "File creation and copying to default
directory.")
+ public void testCopyFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "file2copy");
+ selenium.type("description", "file2copy description");
+ selenium.type("title", "file2copy title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = findTableRow("//div[@id='center']/div/div/table",
"1.0", 2)+1;
+
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[3]"));
+ Assert.assertEquals("0kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[2]"));
+ Assert.assertEquals("file2copy title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("file2copy",
selenium.getText("link=file2copy"));
+
+ row = findTableRow(CMS_FILE_TABLE, "file2copy", 0)+1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Copy");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[3]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ }
+
+ @Test(enabled = false, description = "Not implemented!")
+ public void testMoveOverwriteFile() {
+
+ }
+
+ @Test(enabled = false, description = "Not implemented!")
+ public void testMoveNotOverwriteFile() {
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testCreateFile", description =
"Simple file delete.")
+ public void testDeleteFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select",
"label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select",
"label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = false)
+ public void testDeleteCancelFile() {
+
+ }
+
+ private void createFile(String name) {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", name);
+ selenium.type("description", name + " description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("Czech", selenium.getText("link=Czech"));
+ Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
+ Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals("0kb",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[2]"));
+
+ Assert.assertEquals(name + " title",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"));
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals(name, selenium.getText("link=" + name));
+ logout();login("admin","admin");
+ }
+
+ private void deleteFile(String name) {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select",
"label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[3]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" + name));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ logout();login("admin","admin");
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,112 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_file_upload" }, enabled = true)
+public class CMSFileUploadTestCase extends JBossPortalSeleniumTestCase {
+ /*
+ {
+
System.setProperty("workspace","/home/vrockai/workspace/selenium/selenium/"
+ ); }
+ */
+ private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+ private final String WORKSPACE = System.getProperty("workspace");
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "canceling of file upload")
+ public void testFileUploadCancel() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_m_before = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_d_before = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("description", "myFile");
+ selenium.type("title", "file to upload");
+ selenium.select("language", "label=Afar");
+ selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_m_after = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_d_after = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(rc_m_after, rc_m_before, "The row count in CMS file table has
changes after canceling the upload of file in the root dir.");
+ Assert.assertEquals(rc_d_after, rc_d_before, "The row count in CMS file table has
changes after canceling the upload of file in the default dir.");
+ }
+
+ @Test(enabled = true, description = "File upload test")
+ public void testFileUpload() {
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("description", "myFile");
+ selenium.type("title", "file to upload");
+ selenium.select("language", "label=Afar");
+
+ //System.out.println(WORKSPACE);
+
+ selenium.type("response", WORKSPACE + "/test_files/testFile.txt");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Approve");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/ul/li[3]"),
"testFile.txt");
+ Assert.assertTrue(selenium.isElementPresent("link=text/plain"));
+ Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"),
"file to upload");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Afar"));
+ Assert.assertTrue(selenium.isTextPresent("testFile.txt"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("link=testFile.txt"),
"testFile.txt");
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,272 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_file_workflow" }, enabled = true)
+public class CMSFileWorkflowTestCase extends JBossPortalSeleniumTestCase {
+
+ private static final String SELECT_CMS_MAIN =
"//div[@id='center']/div/div/div[1]/div/select";
+
+ private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+
+ // file workflow table in CMS
+ private final String CMS_WF_TABLE =
"//div[@id='center']/div/div/table[2]";
+
+ // file version table in CMS
+ private final String CMS_FV_TABLE =
"//div[@id='center']/div/div/table";
+ public static String WYSIWYG_EDITOR_LOCATOR = "mce_editor_0";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod( groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreateFileApprove() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = countTableRows(CMS_WF_TABLE) - 1;
+ Assert.assertEquals(row, 1, "More instances of newly created document
exists.");
+
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isElementPresent("link=Preview"));
+ Assert.assertTrue(selenium.isElementPresent("link=Approve"));
+ Assert.assertTrue(selenium.isElementPresent("link=Deny"));
+
+ selenium.click("link=Approve");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = countTableRows(CMS_FV_TABLE) - 1;
+ Assert.assertEquals(row, 3, "More then 2 version of recently created and approved
file found.");
+
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreateFileDeny() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFileDeny");
+ selenium.type("description", "newFileDeny description");
+ selenium.type("title", "newFileDeny title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = countTableRows(CMS_WF_TABLE) - 1;
+ Assert.assertEquals(row, 1, "More instances of newly created document
exists.");
+
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isElementPresent("link=Preview"));
+ Assert.assertTrue(selenium.isElementPresent("link=Approve"));
+ Assert.assertTrue(selenium.isElementPresent("link=Deny"));
+
+ selenium.click("link=Deny");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("newFileDeny"));
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreateFilePreview(){
+
+ //TODO after the bug with empty content is repaired
+
+
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description
= "Simple file delete Cancel in first step, and then delete.")
+ public void testDeleteFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Delete");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true, description = "File creation and moving to default
directory.")
+ public void testMoveFile() {
+ createFile("fileToMove","");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ int row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["
+ row + "]/td[2]/form/select", "label=Move");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/select/option[3]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description
= "File creation and copying to default directory.")
+ public void testCopyFile() {
+ createFile("file2copy","");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ int row = findTableRow(CMS_FILE_TABLE, "file2copy", 0) + 1;
+
+ selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["
+ row + "]/td[2]/form/select", "label=Copy");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/select/option[3]");
+ selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
+ }
+
+ @Test(enabled = true, dependsOnMethods = "testCreateFileApprove",
description="File Creation and editing.")
+ public void testEditFile(){
+
+ int row = -1;
+ String file = "file2edit";
+
+ createFile(file,"contentstring1");
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link="+file);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ //selenium.setSpeed("5000");
+ row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
+ selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring2");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Approve");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
+ selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring3");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Deny");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("1.5"));
+
+ row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
+ selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("contentstring2"));
+
+ }
+
+ private void createFile(String name,String content) {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", name);
+ selenium.type("description", name + " description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Approve");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(name, selenium.getText("link=" + name));
+ logout();login("admin","admin");
+ }
+
+ private void fillInEditor(String content){
+ selenium.getEval("selenium.fillInEditor('"+WYSIWYG_EDITOR_LOCATOR+"','"+content+"')");
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,362 @@
+package org.jboss.portal.test.selenium.cms;
+
+import org.jboss.portal.test.selenium.IdentityAdminTestCase;
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_secure" }, enabled = true, description = "Setting
permissions on the default portlet.")
+public class CMSSecureTestCase extends JBossPortalSeleniumTestCase {
+
+ //@AfterMethod()
+ private void resetSecurity() {
+ login("admin", "admin");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=Anonymous");
+ selenium.select("secureusers:read", "label=admin");
+ selenium.select("secureroles:write", "label=Administrators");
+ selenium.select("secureusers:write", "label=admin");
+ selenium.select("secureroles:manage", "label=Administrators");
+ selenium.select("secureusers:manage", "label=admin");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ logout();
+ }
+
+ @BeforeClass()
+ public void createRoles() {
+ String roleName = "secRole";
+ String roleDisplayName = "secRoleDisp";
+
+ login("admin", "admin");
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(IdentityAdminTestCase.ID_LINK_ROLETAB);
+ clickIfVisible(IdentityAdminTestCase.ID_LINK_ROLEMAIN);
+
+ selenium.click(IdentityAdminTestCase.ID_BUT_ROLE_CREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(IdentityAdminTestCase.ID_INPUT_ROLENAME, roleName);
+ selenium.type(IdentityAdminTestCase.ID_INPUT_ROLEDISNAME, roleDisplayName);
+ selenium.click(IdentityAdminTestCase.ID_SUBMIT_ROLE_CREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ logout();
+ }
+
+ @Test(enabled = true, description = "Set admin read permissions, login as
user.")
+ public void testSetAdminReadPer() {
+ login("admin", "admin");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("secureroles:read", "label=Administrators");
+ selenium.select("secureusers:read", "label=admin");
+
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ login("user", "user");
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ logout();
+
+ resetSecurity();
+ }
+
+ @Test(enabled = true, description = "Set user read permissions, login as
user.")
+ public void testSetUserReadPer() {
+ login("admin", "admin");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=Administrators");
+ selenium.select("secureusers:read", "label=user");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ login("user", "user");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ logout();
+
+ resetSecurity();
+ }
+
+ @Test(enabled = true, description = "Set admin/secRole read permissions, login as
user w secRole.")
+ public void testSetRoleReadPer1() {
+ login("admin", "admin");
+
+ assignRole("user", "user(a)portal.com", "secRole",
"secRoleDisp");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=secRoleDisp");
+ selenium.select("secureusers:read", "label=admin");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ login("user", "user");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ logout();
+
+ resetSecurity();
+ }
+
+ @Test(enabled = true, description = "Set admin/secRole read permissions, login as
user w/o secRole.")
+ public void testSetRoleReadPer2() {
+ login("admin", "admin");
+
+ deassignRole("user", "user(a)portal.com", "secRole",
"secRoleDisp");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=secRoleDisp");
+ selenium.select("secureusers:read", "label=admin");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ login("user", "user");
+
+ Assert.assertTrue(selenium.isTextPresent("Access Denied"));
+ Assert.assertTrue(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ logout();
+
+ resetSecurity();
+ }
+
+ @Test(enabled = false, description = "Recursive permission test")
+ public void testRecursiveSecurity(){
+ login("admin", "admin");
+
+ deassignRole("user", "user(a)portal.com", "secRole",
"secRoleDisp");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"));
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"));
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=index.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=secRoleDisp");
+ selenium.select("secureusers:read", "label=admin");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+ resetSecurity();
+ }
+
+ @Test(enabled = true, description = "Subpage permission test")
+ public void testSubpageSecurity(){
+ selenium.open("/portal/portal/default");
+ Assert.assertTrue(selenium.isTextPresent("Thank you for downloading and deploying
JBoss Portal. We hope your enjoy working with it as much as we enjoy developing
it!"));
+ selenium.click("link=Explore");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isTextPresent("Thank you for downloading and deploying
JBoss Portal. We hope your enjoy working with it as much as we enjoy developing
it!"));
+
+ login("admin", "admin");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=support.html");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("//div[@id='center']/div/div/div/div/select",
"label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select("secureroles:read", "label=Administrators");
+ selenium.select("secureusers:read", "label=admin");
+ selenium.select("secureroles:write", "label=Administrators");
+ selenium.select("secureusers:write", "label=admin");
+ selenium.select("secureroles:manage", "label=Administrators");
+ selenium.select("secureusers:manage", "label=admin");
+ selenium.click("submit");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+ Assert.assertTrue(selenium.isTextPresent("Thank you for downloading and deploying
JBoss Portal. We hope your enjoy working with it as much as we enjoy developing
it!"));
+ selenium.open("/portal/portal/default");
+ selenium.click("link=Explore");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Thank you for downloading and deploying
JBoss Portal. We hope your enjoy working with it as much as we enjoy developing
it!"));
+
+ resetSecurity();
+ }
+
+ private void assignRole(String user, String email, String role, String roleDisplay) {
+
+ searchUser(user, email);
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
+
+ final String ID_CHECK_ROLE =
"//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles'
and @value='" + role + "']";
+
+ selenium.click(ID_CHECK_ROLE);
+
+ selenium.click(IdentityAdminTestCase.ID_SUBMIT_ASSIGN_ROLE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ searchUser(user, email);
+
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isChecked(ID_CHECK_ROLE), "The role wasn't
correctly assigned.");
+
+ }
+
+ private void deassignRole(String user, String email, String role, String roleDisplay) {
+
+ searchUser(user, email);
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(roleDisplay), "Role display name: "
+ roleDisplay + " not found on the page.");
+
+ // uncheck the tempRole check box
+ final String ID_CHECK_ROLE =
"//input[@name='_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:roles'
and @value='" + role + "']";
+ Assert.assertTrue(selenium.isChecked(ID_CHECK_ROLE), "Role to unassign wasn't
really assigned (checked).");
+ selenium.click(ID_CHECK_ROLE);
+
+ selenium.click(IdentityAdminTestCase.ID_SUBMIT_ASSIGN_ROLE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ searchUser(user, email);
+
+ selenium.click(butSeaUsrRol_id(user));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isChecked(ID_CHECK_ROLE), "Unassigned role is assigned
(checked).");
+
+ }
+
+ private void searchUser(String username, String email) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Members");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(IdentityAdminTestCase.ID_LINK_USERTAB);
+ clickIfVisible(IdentityAdminTestCase.ID_LINK_USERMAIN);
+
+ selenium.click(IdentityAdminTestCase.ID_BUT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(IdentityAdminTestCase.ID_INPUT_SEARCH_USER, username);
+ selenium.click(IdentityAdminTestCase.ID_SUBMIT_SEARCH_USER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(username), "Username was not
found.");
+ Assert.assertTrue(selenium.isTextPresent(email), "User email adress was not
found.");
+ }
+
+ private String butSeaUsrRol_id(String userName) {
+ String table =
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist";
+ int r = findTableRow(table, userName, 0);
+ return
"_id28jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj:userlist:" + (r
- 1)
+ + ":_id51jbpns_2fadmin_2fMembers_2fIdentityAdminPortletWindowsnpbj";
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSUserInterfaceTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSUserInterfaceTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSUserInterfaceTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,21 @@
+package org.jboss.portal.test.selenium.cms;
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_gui" }, enabled = true)
+
+public class CMSUserInterfaceTestCase {
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,274 @@
+package org.jboss.portal.test.selenium.portal;
+
+import java.text.MessageFormat;
+
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+@Test(groups = { "admin_portal" }, enabled = true, description = "Partal
administrating.")
+public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
+
+ private static final String INPUT_SUBMIT_PAGECREATE =
"_id65jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id67jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String INPUT_PAGENAME =
"_id65jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:pageName";
+ private static final String INPUT_PORTALNAME =
"_id33jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:name";
+ private static final String INPUT_SUBMIT_CREATEPORTAL =
"_id33jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id35jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+
+ private final String TAB_PORTALOBJ_ID = "//div[@id='current']/a";
+ // private final String LINK_PORTALS_ID =
+ //
"_id12jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id15jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj"
+ // ;
+ private final String LINK_PORTALS_ID = "link=*Portal Objects*";
+ private final String LINK_PORTAL_HOME =
"_id12jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id15jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+
+ private final String TABLE_PORTAL_ADMIN =
"//form[@id='_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj']/table";
+ private final String POR_TL_MAIN =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id43jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_SECURITY =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id48jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_PROPERTIES =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id52jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_THEME =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id56jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_RENAME =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id61jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_DELETE =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id66jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String POR_TL_MAKEDEF =
"_id39jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+
+ private final String TABLE_PORTALPAGE_ADMIN =
"//form[@id='_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj']/table";
+ private final String PAG_TL_MAIN =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id75jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_LAYOUT =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id80jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_SECURITY =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id84jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_PROPERTIES =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id88jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_THEME =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id92jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_RENAME =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id96jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_DISPLAY =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id100jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_DELETE =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id105jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private final String PAG_TL_MAKEDEF =
"_id71jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id72jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:{0}:_id110jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testPortalCreate() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ Assert.assertFalse(selenium.isTextPresent("TestPortal"), "Not created
page already exist.");
+
+ selenium.type(INPUT_PORTALNAME, "TestPortal");
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("TestPortal"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, "TestPortal", 0) - 1;
+
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_MAIN, r)));
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_SECURITY,
r)));
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_PROPERTIES,
r)));
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_MAKEDEF, r)));
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_RENAME, r)));
+ Assert.assertTrue(selenium.isElementPresent(MessageFormat.format(POR_TL_THEME, r)));
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPortalRename() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ Assert.assertTrue(selenium.isTextPresent("TestPortal"));
+ Assert.assertFalse(selenium.isTextPresent("AestPortal"), "Not created
page already exist.");
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, "TestPortal", 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_RENAME, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("renameForm:newName", "AestPortal");
+ selenium.click("renameForm:_id34jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent("TestPortal"));
+ Assert.assertTrue(selenium.isTextPresent("AestPortal"));
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
+ public void testPortalDelete() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ selenium.type(INPUT_PORTALNAME, "TestDelete");
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("TestDelete"));
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, "TestDelete", 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_DELETE, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You are about to delete the
TestDelete portal from the context!"));
+ Assert.assertTrue(selenium.isTextPresent("Delete portal"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
portal?"));
+ selenium
+ .click("_id33jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id40jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_id41jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("TestDelete has successfully been
destroyed"));
+
+ clickIfVisible("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ Assert.assertFalse(selenium.isTextPresent("TestDelete"));
+
+ }
+
+ @Test(enabled = true)
+ public void testAddPage() {
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ final String portalName = "TestAddPortal";
+ final String portalPage = "tPage";
+
+ // selenium.setSpeed("5000");
+
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(portalPage),"Portal page already
present");
+ Assert.assertTrue(selenium.isTextPresent("Create a page named:"));
+
+ selenium.type(INPUT_PAGENAME, portalPage);
+ selenium.click(INPUT_SUBMIT_PAGECREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(portalPage));
+ }
+
+ @Test(enabled = true, dependsOnMethods = { "testAddPage" })
+ public void testRemovePage() {
+
+ final String portalName = "TestAddPortal";
+ final String portalPage = "tPage";
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, portalPage, 0) - 1;
+
+ selenium.click(MessageFormat.format(PAG_TL_DELETE, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Delete page"));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You are about to delete the
" + portalPage + " page from the " + portalName + " portal! "));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
page?"));
+
+ }
+
+ @Test(enabled = true)
+ public void testCreateWindow() {
+
+ final String portalName = "toAddWindowPortal";
+ final String pageName = "windowContainer";
+ final String windowName = "myFancyWindow";
+
+ createPortal(portalName);
+ createPage(portalName, pageName);
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type("windowForm:windowName", windowName);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad("30000");
+ selenium.click("layoutForm:a_center");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertTrue(selenium.isTextPresent(windowName));
+
+ selenium.open("/portal/auth/portal/mimikry");
+ Assert.assertTrue(selenium.isTextPresent("Current users"));
+
+ }
+
+ private void createPortal(String name) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ selenium.type(INPUT_PORTALNAME, name);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void createPage(String portalName, String pageName) {
+ selenium.open("/portal/");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_PAGENAME, pageName);
+ selenium.click(INPUT_SUBMIT_PAGECREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
+
+}
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/temp-testng-customsuite.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/temp-testng-customsuite.xml
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/temp-testng-customsuite.xml 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1,8 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="SeleniumTest">
+ <test verbose="2"
name="org.jboss.portal.test.selenium.AdminTest" annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.AdminTest"/>
+ </classes>
+ </test>
+</suite>
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/archive.zip
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/archive.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/big_archive.zip
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/big_archive.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/many_files.zip
===================================================================
(Binary files differ)
Property changes on:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/many_files.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile.txt
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile.txt
(rev 0)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile.txt 2008-09-17
22:20:20 UTC (rev 11926)
@@ -0,0 +1 @@
+i'm the test file!
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml
(rev 0)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng.xml 2008-09-17 22:20:20 UTC
(rev 11926)
@@ -0,0 +1,90 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="SeleniumTest">
+ <test verbose="2"
name="org.jboss.portal.test.selenium.UserLoginTestCase"
annotations="JDK">
+ <classes>
+ <class name="org.jboss.portal.test.selenium.UserLoginTestCase"/>
+ </classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.IdentityAdminTestCase -
MultipleLogins" verbose="2"
+ annotations="JDK">
+ <groups>
+ <run>
+ <exclude name="single"></exclude></run></groups>
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.IdentityAdminTestCase -
SingleLogin"
+ verbose="2" annotations="JDK">
+ <groups>
+ <run>
+ <exclude name="log"></exclude></run></groups>
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.PortletUserCreationTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.PortletUserCreationTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.WSRPTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.WSRPTestCase"></class></classes>
+ </test>
+
+ <test
name="org.jboss.portal.test.selenium.UserInterceptorPortletTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.UserInterceptorPortletTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.cms.CMSFileTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSFileWorkflowTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.cms.CMSSecureTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSSecureTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.cms.CMSDirectoryTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSDirectoryTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.cms.CMSFileUploadTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSFileUploadTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.cms.CMSArchiveUploadTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSArchiveUploadTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.DashboardTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.DashboardTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"></class></classes>
+ </test>
+<!--
+<listeners>
+ <listener
class-name="org.testng.reporters.JUnitXMLReporter"></listener></listeners>
+-->
+</suite>