Author: vrockai
Date: 2009-02-17 05:44:45 -0500 (Tue, 17 Feb 2009)
New Revision: 12827
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/usecaseng.xml
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/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/CMSDirectoryTestCase.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/portal/AdminPortalTestCase.java
Log:
portal end to end test
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-02-16 05:00:41 UTC
(rev 12826)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-02-17 10:44:45 UTC
(rev 12827)
@@ -1,184 +1,212 @@
+
<project name="Tests" default="compile" basedir="."
xmlns:server="http://jboss.org/ns/test/ant/server">
- <property environment="env" />
+ <property environment="env" />
- <property name="workspace" location="build.xml" />
- <property name="java.home" location="${env.JAVA_HOME}" />
+ <property name="workspace" location="build.xml" />
+ <property name="java.home" location="${env.JAVA_HOME}" />
- <property name="suitename" location="testng-files" />
- <property name="testname" location="testng-files" />
+ <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="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.home" value="${env.JBOSS_HOME}" />
- <property name="jboss.test.jar" value="lib/jboss-test.jar" />
- <property name="jboss.portal.dir"
value="${env.JBOSS_UNZIPED_DIR}" />
- <property name="portal_archive" value="${env.JBOSS_ARCHIVE}"
/>
- <property name="portal.instance" value="default" />
+ <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.home" value="${env.JBOSS_HOME}" />
+ <property name="jboss.test.jar" value="lib/jboss-test.jar"
/>
+ <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>
+ <property name="test.suite" value="testng.xml" />
+ <property name="usecase.suite" value="usecaseng.xml" />
- <path id="libraries.cp">
- <fileset dir="${lib.dir}">
- <include name="*.jar" />
- </fileset>
+ <path id="jboss.test.classpath">
+ <pathelement path="${jboss.test.jar}" />
+ </path>
- </path>
+ <path id="libraries.cp">
+ <fileset dir="${lib.dir}">
+ <include name="*.jar" />
+ </fileset>
- <path id="test.cp">
- <pathelement location="${test.build.dir}" />
- <path refid="libraries.cp" />
- </path>
+ </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>
+ <path id="test.cp">
+ <pathelement location="${test.build.dir}" />
+ <path refid="libraries.cp" />
+ </path>
- <target name="init">
- <echo message="Browser : ${browser}" />
- <echo message="Screenshot : ${screenshot}" />
- <echo message="Deleting testng report directory" />
- <delete dir="${testng.output.dir}" />
- </target>
+ <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="Screenshot : ${screenshot}" />
+ <echo message="Deleting testng report directory" />
+ <delete dir="${testng.output.dir}" />
+ </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="-debug" />
- <arg value="-userExtensions" />
- <arg value="${selsrv.dir}/user-extensions.js" />
- </java>
- <sleep seconds="20" />
- </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="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="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="-debug" />
+ <arg value="-userExtensions" />
+ <arg value="${selsrv.dir}/user-extensions.js" />
+ </java>
+ <sleep seconds="20" />
+ </target>
- <target name="copyApps">
- <echo message="Copying userInterceptor portlet into the ${portal.instance}
server" />
- <copy file="apps/userDetail-portlet.war"
tofile="${jboss.home}/server/${portal.instance}/deploy/userDetail-portlet.war"
/>
- </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="clean">
- <echo message="Going to delete directory ${test.build.dir}" />
- <delete dir="${test.build.dir}" />
- </target>
+ <target name="copyApps">
+ <echo message="Copying userInterceptor portlet into the
${portal.instance} server" />
+ <copy file="apps/userDetail-portlet.war"
tofile="${jboss.home}/server/${portal.instance}/deploy/userDetail-portlet.war"
/>
+ </target>
- <server:config javaHome="${java.home}"
jbossHome="${jboss.home}">
- <server name="${portal.instance}" host="${node0}">
+ <target name="clean">
+ <echo message="Going to delete directory ${test.build.dir}" />
+ <delete dir="${test.build.dir}" />
+ </target>
+
+ <server:config javaHome="${java.home}"
jbossHome="${jboss.home}">
+ <server name="${portal.instance}" host="${node0}">
<!-- jvmarg value="${jpda.cmdline}" / -->
- <jvmarg value="-Xmx512m" />
- <jvmarg value="-XX:MaxPermSize=128m" />
- <sysproperty key="java.endorsed.dirs"
value="${jboss.home}/lib/endorsed" />
- </server>
- </server:config>
+ <jvmarg value="-Xmx512m" />
+ <jvmarg value="-XX:MaxPermSize=128m" />
+ <sysproperty key="java.endorsed.dirs"
value="${jboss.home}/lib/endorsed" />
+ </server>
+ </server:config>
- <target name="cleanup">
- <echo message="Cleaning up..." />
- <antcall target="stop-src" />
+ <target name="cleanup">
+ <echo message="Cleaning up..." />
+ <antcall target="stop-src" />
- </target>
+ </target>
- <target name="run-and-build" depends="init, compile,
run-src">
- <echo message="Starting portal instance : ${portal.instance}" />
- <server:start name="${portal.instance}" />
+ <target name="run-and-build" depends="init, compile,
run-src">
+ <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"
listeners="org.testng.reporters.JUnitXMLReporter"
suitename="SeleniumSuite">
+ <echo message="Runing TestNG" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="test-output"
listeners="org.testng.reporters.JUnitXMLReporter"
suitename="SeleniumSuite">
- <xmlfileset dir="." includes="testng.xml" />
+ <xmlfileset dir="." includes="${testng.suite}" />
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="screenshot" value="${screenshot}"
/>
+ <sysproperty key="workspace" value="${workspace}"
/>
+ <sysproperty key="userCount" value="${userCount}"
/>
+ <sysproperty key="html-src" value="${html-src}" />
+ <jvmarg value="-ea" />
- <!--classfileset dir="${test.build.dir}"
- includes="org/jboss/portal/test/selenium/*Test.class" / -->
- <sysproperty key="browser" value="${browser}" />
- <sysproperty key="screenshot" value="${screenshot}" />
- <sysproperty key="workspace" value="${workspace}" />
- <sysproperty key="userCount" value="${userCount}" />
- <sysproperty key="html-src" value="${html-src}" />
- <jvmarg value="-ea" />
+ </testng>
+ <echo message="Stoping portal instance : ${portal.instance}" />
+ <server:stop name="${portal.instance}" />
+ <antcall target="cleanup" />
+ </target>
- </testng>
- <echo message="Stoping portal instance : ${portal.instance}" />
- <server:stop name="${portal.instance}" />
- <antcall target="cleanup" />
- </target>
+ <target name="single-test" depends="init, compile, run-src,
copyApps">
+ <echo message="Runing TestNG" />
- <target name="single-test" depends="init, compile, run-src,
copyApps">
- <echo message="Runing TestNG" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}"
listeners="org.jboss.portal.test.selenium.JBossSeleniumTestListener"
suitename="SeleniumSingleTest" verbose="2">
- <mkdir dir="test-output" />
- <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}"
listeners="org.jboss.portal.test.selenium.JBossSeleniumTestListener"
suitename="SeleniumSingleTest" verbose="2">
+ <classfileset dir="${test.build.dir}"
includes="${testname}" />
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="screenshot" value="${screenshot}"
/>
+ <sysproperty key="workspace" value="${workspace}"
/>
+ <sysproperty key="userCount" value="${userCount}"
/>
+ <sysproperty key="html-src" value="${html-src}" />
- <classfileset dir="${test.build.dir}" includes="${testname}"
/>
- <sysproperty key="browser" value="${browser}" />
- <sysproperty key="screenshot" value="${screenshot}" />
- <sysproperty key="workspace" value="${workspace}" />
- <sysproperty key="userCount" value="${userCount}" />
- <sysproperty key="html-src" value="${html-src}" />
+ <jvmarg value="-ea" />
+ </testng>
+ <antcall target="cleanup" />
- <jvmarg value="-ea" />
- </testng>
- <antcall target="cleanup" />
+ </target>
- </target>
+ <target name="selenium-test" depends="init, compile, run-src,
copyApps">
+ <echo message="Runing TestNG" />
- <target name="selenium-test" depends="init, compile, run-src,
copyApps">
- <echo message="Runing TestNG" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSuite">
- <mkdir dir="test-output" />
- <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSuite">
+ <xmlfileset dir="." includes="${test.suite}" />
- <xmlfileset dir="." includes="testng.xml" />
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="screenshot" value="${screenshot}"
/>
+ <sysproperty key="workspace" value="${workspace}"
/>
+ <sysproperty key="userCount" value="${userCount}"
/>
+ <sysproperty key="html-src" value="${html-src}" />
- <sysproperty key="browser" value="${browser}" />
- <sysproperty key="screenshot" value="${screenshot}" />
- <sysproperty key="workspace" value="${workspace}" />
- <sysproperty key="userCount" value="${userCount}" />
- <sysproperty key="html-src" value="${html-src}" />
+ <jvmarg value="-ea" />
- <jvmarg value="-ea" />
+ </testng>
+ <antcall target="cleanup" />
+ </target>
- </testng>
- <antcall target="cleanup" />
- </target>
+ <target name="selenium-usecase" depends="init, compile, run-src,
copyApps">
+ <echo message="Runing TestNG" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSuite">
+
+ <xmlfileset dir="." includes="${usecase.suite}" />
+
+ <sysproperty key="browser" value="${browser}" />
+ <sysproperty key="screenshot" value="${screenshot}"
/>
+ <sysproperty key="workspace" value="${workspace}"
/>
+ <sysproperty key="userCount" value="${userCount}"
/>
+ <sysproperty key="html-src" value="${html-src}" />
+
+ <jvmarg value="-ea" />
+
+ </testng>
+ <antcall target="cleanup" />
+ </target>
+
+ <target name="archive" >
+ <!--<touch file="touchme.txt"/>-->
+ <echo file="touchme.txt" message="pipik2"/>
+ <genkey alias="apache-group" storepass="secret"
dname="CN=Ant Group, OU=Jakarta Division,
O=Apache.org, C=US"/>
+ <echo message=""/>
+ </target>
+
</project>
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -1,10 +1,7 @@
package org.jboss.portal.test.selenium;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
-import java.io.PrintWriter;
import java.util.Properties;
import org.testng.Assert;
@@ -18,258 +15,228 @@
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
public class JBossPortalSeleniumTestCase {
- public static final String LINK_LOGOUT = "link=Logout";
- public static final String SUBMIT_LOGIN = "login";
- public static final String ADDR_PORTAL = "/portal/";
- public static final String FRAME_LOGIN_CONTENT = "login-content";
- public static final String LINK_LOGIN = "link=Login";
- public static final String INPUT_PASSWORD = "j_password";
- public static final String INPUT_USERNAME = "j_username";
- protected Properties props;
- protected Selenium selenium;
- // Generic timeout in miliseconds
- protected static final String PAGE_LOAD = "2400000";
+ public static final String LINK_LOGOUT = "link=Logout";
+ public static final String SUBMIT_LOGIN = "login";
+ public static final String ADDR_PORTAL = "/portal/";
+ public static final String FRAME_LOGIN_CONTENT = "login-content";
+ public static final String LINK_LOGIN = "link=Login";
+ public static final String INPUT_PASSWORD = "j_password";
+ public static final String INPUT_USERNAME = "j_username";
+ protected Properties props;
+ protected Selenium selenium;
- // Element timeout in seconds
- protected static final int ELEM_TIMEOUT = 220;
+ // Generic timeout in miliseconds
+ protected static final String PAGE_LOAD = "2400000";
- public JBossPortalSeleniumTestCase() {
- try {
- this.props = getProperties();
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
+ // Element timeout in seconds
+ protected static final int ELEM_TIMEOUT = 220;
- @BeforeClass
- public void setupChromeForLogin() throws Exception {
+ public JBossPortalSeleniumTestCase() {
+ try {
+ this.props = getProperties();
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ }
- String browser = System.getProperty("browser");
+ @BeforeClass
+ public void setupChromeForLogin() throws Exception {
- selenium = new DefaultSelenium("127.0.0.1", 44444, browser,
"http://localhost:8080/portal/");
+ String browser = System.getProperty("browser");
- JBossSeleniumTestListener.selenium = selenium;
- selenium.start();
- selenium.setTimeout(PAGE_LOAD);
- }
+ selenium = new DefaultSelenium("127.0.0.1", 44444, browser,
"http://localhost:8080/portal/");
- @AfterClass
- public void tearDownInstaller() throws Exception {
- selenium.stop();
- }
+ JBossSeleniumTestListener.selenium = selenium;
+ selenium.start();
+ selenium.setTimeout(PAGE_LOAD);
+ }
- private Properties getProperties() throws IOException {
- ClassLoader cl = ClassLoader.getSystemClassLoader();
- InputStream is =
cl.getResourceAsStream("org/jboss/portal/test/selenium/locator.properties");
- Properties props = new Properties();
- props.load(is);
- return props;
- }
+ @AfterClass
+ public void tearDownInstaller() throws Exception {
+ selenium.stop();
+ }
- protected String getProp(String prop, String subst) {
- if (subst == null || "".equals(subst)){
- subst = "Locator not set";
- }
-
- if (props == null)
- return subst;
- else
- return props.getProperty(prop) != null ? props.getProperty(prop) : subst;
- }
+ private Properties getProperties() throws IOException {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ InputStream is =
cl.getResourceAsStream("org/jboss/portal/test/selenium/locator.properties");
+ Properties props = new Properties();
+ props.load(is);
+ return props;
+ }
- protected void clickIfVisible(String id) {
+ protected String getProp(String prop, String subst) {
+ if (subst == null || "".equals(subst)) {
+ subst = "Locator not set";
+ }
- if (selenium.isElementPresent(id)) {
- selenium.click(id);
+ if (props == null) {
+ return subst;
+ } else {
+ return props.getProperty(prop) != null ? props.getProperty(prop) : subst;
+ }
+ }
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
- }
+ protected void clickIfVisible(String id) {
- protected void clickIfVisible(String id, String awaited) {
+ if (selenium.isElementPresent(id)) {
+ selenium.click(id);
- if (selenium.isElementPresent(id)) {
- selenium.click(id);
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
- Assert.assertTrue(selenium.isTextPresent(awaited));
- }
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+ }
- @Deprecated
- protected boolean findLink(String id) {
- for (String link : selenium.getAllLinks()) {
- if (link.equals(id)) {
- return true;
- }
- }
- for (String link : selenium.getAllFields()) {
- if (link.equals(id)) {
- return true;
- }
- }
+ protected int findTableRow(String tableLocation, String searchName, int searchCol) {
+ return Integer.valueOf(selenium.getEval("selenium.findTableRow(\""
+ tableLocation + "\",'" + searchName + "'," + searchCol
+ ")"));
+ }
- return false;
- }
+ protected int countTableRows(String tableLocation) {
+ return
Integer.valueOf(selenium.getEval("selenium.countTableRows(\"" +
tableLocation + "\")"));
+ }
- protected int findTableRow(String tableLocation, String searchName, int searchCol) {
- return Integer.valueOf(selenium.getEval("selenium.findTableRow(\"" +
tableLocation + "\",'" + searchName + "'," + searchCol +
")"));
- }
+ // TODO refactor
+ protected void safeSelect(String locator, String value) {
+ waitForElement(locator);
- protected int countTableRows(String tableLocation) {
- return Integer.valueOf(selenium.getEval("selenium.countTableRows(\"" +
tableLocation + "\")"));
- }
+ for (int second = 0;; second++) {
+ if (second >= ELEM_TIMEOUT) {
+ Assert.fail("Element " + locator + " not found.");
+ }
+ try {
+ String[] opts = selenium.getSelectOptions(locator);
+ boolean isAvailable = false;
- // TODO refactor
- protected void safeSelect(String locator, String value) {
- waitForElement(locator);
+ for (String opt : opts) {
+ if (opt.equals(value)) {
+ isAvailable = true;
+ }
+ }
- for (int second = 0;; second++) {
- if (second >= ELEM_TIMEOUT) {
- Assert.fail("Element " + locator + " not found.");
- }
- try {
- String[] opts = selenium.getSelectOptions(locator);
- boolean isAvailable = false;
+ if (isAvailable) {
+ break;
+ }
+ } catch (Exception e) {
+ }
+ waitFor(1000);
+ }
- for (String opt : opts) {
- if (opt.equals(value)) {
- isAvailable = true;
- }
- }
+ selenium.select(locator, "label=" + value);
+ }
- if (isAvailable)
- break;
- } catch (Exception e) {
- }
- waitFor(1000);
- }
+ protected void clickAndWait(String locator) {
+ waitForElement(locator);
+ selenium.click(locator);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
- selenium.select(locator, "label=" + value);
- }
+ protected void openAndWait(String locator) {
+ selenium.open(locator);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
- protected void clickAndWait(String locator) {
- waitForElement(locator);
- selenium.click(locator);
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
+ protected void selectIfNotSelected(String selector, String label) {
+ waitForElement(selector);
+ if (!selenium.getSelectedLabel(selector).equals(label)) {
+ selenium.select(selector, "label=" + label);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+ }
- protected void openAndWait(String locator) {
- selenium.open(locator);
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
+ protected boolean assertTextOrder(String text) {
+ return
Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" + text +
"\")"));
+ }
- protected void selectIfNotSelected(String selector, String label) {
- waitForElement(selector);
- if (!selenium.getSelectedLabel(selector).equals(label)) {
- selenium.select(selector, "label=" + label);
- selenium.waitForPageToLoad(PAGE_LOAD);
- }
- }
+ protected void waitFor(long time) {
+ try {
+ Thread.sleep(time);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
- protected boolean assertTextOrder(String text) {
- return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" +
text + "\")"));
- }
+ protected void waitForElement(String locator) {
+ for (int second = 0;; second++) {
+ if (second >= ELEM_TIMEOUT) {
+ Assert.fail("Element " + locator + " not found.");
+ }
+ try {
+ if (selenium.isElementPresent(locator)) {
+ break;
+ }
+ } catch (Exception e) {
+ }
+ waitFor(1000);
+ }
+ }
- protected void waitFor(long time) {
- try {
- Thread.sleep(time);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ protected void waitForElement(String locatorElem, String locatorLink, long
timeToWait, long n) {
+ for (int i = 0;; i++) {
+ if (i >= n) {
+ Assert.fail("Element " + locatorElem + " not
found.");
+ }
+ try {
+ if (selenium.isElementPresent(locatorElem)) {
+ break;
+ }
+ } catch (Exception e) {
+ }
+ waitFor(1000);
+ }
+ }
- protected void waitForElement(String locator) {
- for (int second = 0;; second++) {
- if (second >= ELEM_TIMEOUT) {
- Assert.fail("Element " + locator + " not found.");
- }
- try {
- if (selenium.isElementPresent(locator))
- break;
- } catch (Exception e) {
- }
- waitFor(1000);
- }
- }
+ public void waitForText(String text) {
+ for (int second = 0;; second++) {
+ if (second >= ELEM_TIMEOUT) {
+ Assert.fail("Text '" + text + "' not
found.");
+ }
+ try {
+ if (selenium.isTextPresent(text)) {
+ break;
+ }
+ } catch (Exception e) {
+ }
+ waitFor(100);
+ }
+ }
- protected void waitForElement(String locatorElem, String locatorLink, long timeToWait,
long n) {
- for (int i = 0;; i++) {
- if (i >= n) {
- Assert.fail("Element " + locatorElem + " not found.");
- }
- try {
- if (selenium.isElementPresent(locatorElem))
- break;
- } catch (Exception e) {
- }
- waitFor(1000);
- }
- }
+ protected void login(String username, String password) {
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- public void waitForText(String text) {
- for (int second = 0;; second++) {
- if (second >= ELEM_TIMEOUT) {
- Assert.fail("Text '" + text + "' not found.");
- }
- try {
- if (selenium.isTextPresent(text))
- break;
- } catch (Exception e) {
- }
- waitFor(100);
- }
- }
+ selenium.click(LINK_LOGIN);
+ selenium.selectFrame(FRAME_LOGIN_CONTENT);
- protected void login(String username, String password) {
- selenium.open(ADDR_PORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ waitForElement(INPUT_USERNAME);
+ waitForElement(INPUT_PASSWORD);
+ waitForElement(SUBMIT_LOGIN);
- selenium.click(LINK_LOGIN);
- selenium.selectFrame(FRAME_LOGIN_CONTENT);
+ selenium.type(INPUT_USERNAME, username);
+ selenium.type(INPUT_PASSWORD, password);
+ Assert.assertTrue(selenium.isElementPresent(SUBMIT_LOGIN));
+ selenium.click(SUBMIT_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: " + username),
"Not logged in, login message missing.");
+ }
- waitForElement(INPUT_USERNAME);
- waitForElement(INPUT_PASSWORD);
- waitForElement(SUBMIT_LOGIN);
+ protected void logout() {
+ selenium.open(ADDR_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.");
+ }
- selenium.type(INPUT_USERNAME, username);
- selenium.type(INPUT_PASSWORD, password);
- Assert.assertTrue(selenium.isElementPresent(SUBMIT_LOGIN));
- selenium.click(SUBMIT_LOGIN);
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Logged in as: " + username),
"Not logged in, login message missing.");
- }
-
- protected void logout() {
- selenium.open(ADDR_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.");
- }
-
- protected void logoutIfPossible() {
- selenium.open(ADDR_PORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
- if (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.");
- }
- }
-
- protected void savePage(String filename) {
- try {
- PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename)));
- out.print(selenium.getHtmlSource());
- out.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ protected void logoutIfPossible() {
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (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.");
+ }
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -4,7 +4,6 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
-import com.thoughtworks.selenium.Selenium;
/**
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
@@ -16,14 +15,14 @@
public static final String casePfx = "";
private final String ADR_PORTAL =
getProp(casePfx+"adr.portal","/portal");
- private final String FRM_MAIN = "relative=up";
- private final String SUB_CANCEL = "cancel";
- private final String LNK_LOGOUT = "link=Logout";
- private final String SUB_LOGIN = "login";
- private final String INP_PASSWORD = "xpath=id('j_password')";
- private final String INP_USERNAME = "xpath=id('j_username')";
- private final String FRM_LOGINFORM = "login-content";
- private final String LNK_LOGIN = "link=Login";
+ private final String FRM_MAIN =
getProp(casePfx+"frm.main","relative=up");
+ private final String SUB_CANCEL =
getProp(casePfx+"sub.portal","cancel");
+ private final String LNK_LOGOUT =
getProp(casePfx+"adr.portal","link=Logout");
+ private final String SUB_LOGIN =
getProp(casePfx+"adr.portal","login");
+ private final String INP_PASSWORD =
getProp(casePfx+"adr.portal","xpath=id('j_password')");
+ private final String INP_USERNAME =
getProp(casePfx+"adr.portal","xpath=id('j_username')");
+ private final String FRM_LOGINFORM =
getProp(casePfx+"adr.portal","login-content");
+ private final String LNK_LOGIN =
getProp(casePfx+"adr.portal","link=Login");
@AfterClass(enabled = true)
public void logoutIfNeeded()
Modified:
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 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -68,7 +68,6 @@
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
- savePage("1.html");
selenium.type(INPUT_CACHEEXP, "600");
selenium.type(INPUT_CONSWSDL,
"http://wsrp.bea.com:7001/producer/producer?WSDL");
@@ -221,8 +220,8 @@
selenium.click("link=WSRP");
selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(ID_LINK_PRODCONF,"Producer configuration");
-
+ clickIfVisible(ID_LINK_PRODCONF);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration"));
clickAndWait(SUBMIT_ADDPROP_INIT);
selenium.type(INPUT_PROPNAME, "testProp");
Modified:
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 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -174,7 +174,6 @@
selenium.click("link=" + defaultDirName);
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
- savePage("2.html");
Assert.assertEquals("copySrc",
selenium.getText("//div[@id='center']/div/div/ul/li[5]"));
Assert.assertTrue(selenium.isElementPresent("link=" + defaultDirName));
selenium.click("link=Home");
Modified:
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 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -317,7 +317,6 @@
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);
- savePage("3.html");
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?"));
Modified:
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 2009-02-16
05:00:41 UTC (rev 12826)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -11,361 +11,352 @@
/**
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-@Test(groups = { "admin_portal" }, enabled = true, description = "Partal
administrating.")
+@Test(groups = {"admin_portal"}, enabled = true, description = "Partal
administrating.")
public class AdminPortalTestCase extends JBossPortalSeleniumTestCase {
- private static final String SUB_LAYOUT_ADD_CENTER =
"//input[contains(@id,'layoutForm:a_center')]";
- private static final String INP_WINDOW_NAME =
"//input[contains(@id,'windowForm:windowName')]";
- private static final String SUBMIT_RENAME_PORTAL =
"//input[contains(@id,'renameForm:rename')]";
- private static final String INPUT_RENAME_PORTAL =
"//input[contains(@id,'renameForm:newName')]";
- private static final String SUBMIT_DELETE_PORTAL_CONF =
"//input[contains(@id,'delete-view:confirm-form:delete')]";
- private static final String INPUT_SUBMIT_PAGECREATE =
"//input[contains(@id,'create-page-form:create-page')]";
- private static final String INPUT_PAGENAME =
"//input[contains(@id,'create-page-form:pageName')]";
- private static final String INPUT_PORTALNAME =
"//input[contains(@id,'create-portal-form:name')]";
- private static final String INPUT_SUBMIT_CREATEPORTAL =
"//input[contains(@id,'create-portal-form:create-portal')]";
+ private static final String SUB_LAYOUT_ADD_CENTER =
"//input[contains(@id,'layoutForm:a_center')]";
+ private static final String INP_WINDOW_NAME =
"//input[contains(@id,'windowForm:windowName')]";
+ private static final String SUBMIT_RENAME_PORTAL =
"//input[contains(@id,'renameForm:rename')]";
+ private static final String INPUT_RENAME_PORTAL =
"//input[contains(@id,'renameForm:newName')]";
+ private static final String SUBMIT_DELETE_PORTAL_CONF =
"//input[contains(@id,'delete-view:confirm-form:delete')]";
+ private static final String INPUT_SUBMIT_PAGECREATE =
"//input[contains(@id,'create-page-form:create-page')]";
+ private static final String INPUT_PAGENAME =
"//input[contains(@id,'create-page-form:pageName')]";
+ private static final String INPUT_PORTALNAME =
"//input[contains(@id,'create-portal-form:name')]";
+ private static final String INPUT_SUBMIT_CREATEPORTAL =
"//input[contains(@id,'create-portal-form:create-portal')]";
+ private final String TAB_PORTALOBJ_ID = "Link=Admin";
+ private final String LINK_PORTALS_ID = "link=*Portal Objects*";
+ private final String LINK_PORTAL_HOME =
"//a[contains(@id,'obj-temp-form:object-link-0')]";
+ private final String TABLE_PORTAL_ADMIN =
"//table[contains(@id,'obj-nav-form:portal-datatable')]";
+ private final String POR_TL_MAIN =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]";
+ private final String POR_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:security-link'')]";
+ private final String POR_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:prop-link'')]";
+ private final String POR_TL_THEME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:theme-link'')]";
+ private final String POR_TL_RENAME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:rename'')]";
+ private final String POR_TL_DELETE =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:delete'')]";
+ private final String POR_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:default-link'')]";
+ private final String TABLE_PORTALPAGE_ADMIN =
"//table[contains(@id,'obj-nav-form:pages-datatable')]";
+ private final String PAG_TL_MAIN =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:object-link'')]";
+ private final String PAG_TL_LAYOUT =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]";
+ private final String PAG_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]";
+ private final String PAG_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]";
+ private final String PAG_TL_THEME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]";
+ private final String PAG_TL_RENAME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]";
+ private final String PAG_TL_DISPLAY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]";
+ private final String PAG_TL_DELETE =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]";
+ private final String PAG_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]";
- private final String TAB_PORTALOBJ_ID = "Link=Admin";
+ @BeforeMethod(groups = {"log"})
+ public void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
- private final String LINK_PORTALS_ID = "link=*Portal Objects*";
- private final String LINK_PORTAL_HOME =
"//a[contains(@id,'obj-temp-form:object-link-0')]";
-
- private final String TABLE_PORTAL_ADMIN =
"//table[contains(@id,'obj-nav-form:portal-datatable')]";
- private final String POR_TL_MAIN =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]";
- private final String POR_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:security-link'')]";
- private final String POR_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:prop-link'')]";
- private final String POR_TL_THEME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:theme-link'')]";
- private final String POR_TL_RENAME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:rename'')]";
- private final String POR_TL_DELETE =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:delete'')]";
- private final String POR_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:default-link'')]";
+ @AfterMethod(groups = {"log"})
+ public void logoutAfterTest() {
+ }
- private final String TABLE_PORTALPAGE_ADMIN =
"//table[contains(@id,'obj-nav-form:pages-datatable')]";
- private final String PAG_TL_MAIN =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:object-link'')]";
- private final String PAG_TL_LAYOUT =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]";
- private final String PAG_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]";
- private final String PAG_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]";
- private final String PAG_TL_THEME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]";
- private final String PAG_TL_RENAME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]";
- private final String PAG_TL_DISPLAY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]";
- private final String PAG_TL_DELETE =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]";
- private final String PAG_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]";
+ @Test(enabled = true)
+ public void testPortalCreate() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- @BeforeMethod(groups = { "log" })
- public void loginBeforeTest() {
- logoutIfPossible();
- login("admin", "admin");
- }
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
- @AfterMethod(groups = { "log" })
- public void logoutAfterTest() {
-
- }
+ final String portalName = "TestPortal";
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page
already exist.");
- @Test(enabled = true)
- public void testPortalCreate() {
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
-
- final String portalName = "TestPortal";
- Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already
exist.");
+ Assert.assertTrue(selenium.isTextPresent(portalName));
- selenium.type(INPUT_PORTALNAME, portalName);
- selenium.click(INPUT_SUBMIT_CREATEPORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
- Assert.assertTrue(selenium.isTextPresent(portalName));
+ 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)));
+ }
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ @Test(enabled = true, dependsOnMethods = {"testPortalCreate"})
+ public void testPortalRename() {
+ // first create a portal
- 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)));
- }
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
- public void testPortalRename() {
- // first create a portal
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
-
- final String portalName = "TestRenPortal";
- Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already
exist.");
+ final String portalName = "TestRenPortal";
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page
already exist.");
- selenium.type(INPUT_PORTALNAME, portalName);
- selenium.click(INPUT_SUBMIT_CREATEPORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- // then rename it
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ // then rename it
- final String portalToRename = "TestRenPortal";
- Assert.assertTrue(selenium.isTextPresent(portalToRename));
- final String portalRenamed = "AestPortal";
- Assert.assertFalse(selenium.isTextPresent(portalRenamed), "Not created page
already exist.");
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalToRename, 0) - 1;
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
- selenium.click(MessageFormat.format(POR_TL_RENAME, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
+ final String portalToRename = "TestRenPortal";
+ Assert.assertTrue(selenium.isTextPresent(portalToRename));
+ final String portalRenamed = "AestPortal";
+ Assert.assertFalse(selenium.isTextPresent(portalRenamed), "Not created page
already exist.");
- selenium.type(INPUT_RENAME_PORTAL, portalRenamed);
- selenium.click(SUBMIT_RENAME_PORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalToRename, 0) - 1;
- Assert.assertFalse(selenium.isTextPresent(portalToRename));
- Assert.assertTrue(selenium.isTextPresent(portalRenamed));
- }
+ selenium.click(MessageFormat.format(POR_TL_RENAME, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
- @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
- public void testPortalDelete() {
- // first create a portal
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_RENAME_PORTAL, portalRenamed);
+ selenium.click(SUBMIT_RENAME_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
-
- final String portalName = "TestDelete";
- Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page already
exist.");
+ Assert.assertFalse(selenium.isTextPresent(portalToRename));
+ Assert.assertTrue(selenium.isTextPresent(portalRenamed));
+ }
- selenium.type(INPUT_PORTALNAME, portalName);
- selenium.click(INPUT_SUBMIT_CREATEPORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- // then delete it
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ @Test(enabled = true, dependsOnMethods = {"testPortalCreate"})
+ public void testPortalDelete() {
+ // first create a portal
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- final String portalToDelete = "TestDelete";
- selenium.type(INPUT_PORTALNAME, portalToDelete);
- selenium.click(INPUT_SUBMIT_CREATEPORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
- Assert.assertTrue(selenium.isTextPresent(portalToDelete));
+ final String portalName = "TestDelete";
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page
already exist.");
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalToDelete, 0) - 1;
+ selenium.type(INPUT_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click(MessageFormat.format(POR_TL_DELETE, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("WARNING! You are about to delete the
"+portalToDelete+" 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(SUBMIT_DELETE_PORTAL_CONF);
- selenium.waitForPageToLoad(PAGE_LOAD);
- //Assert.assertTrue(selenium.isTextPresent("TestDelete has successfully been
destroyed"));
+ // then delete it
- clickIfVisible("link=Admin");
- clickIfVisible(TAB_PORTALOBJ_ID);
- Assert.assertFalse(selenium.isTextPresent(portalToDelete));
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- }
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
- @Test(enabled = true, dependsOnMethods = { "testPortalCreate" })
- public void testAddPage() {
+ final String portalToDelete = "TestDelete";
+ selenium.type(INPUT_PORTALNAME, portalToDelete);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- final String portalName = "TestAddPagePortal";
- final String portalPage = "tToAddPage";
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(portalToDelete));
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalToDelete, 0) - 1;
-
- selenium.type(INPUT_PORTALNAME, portalName);
- selenium.click(INPUT_SUBMIT_CREATEPORTAL);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(MessageFormat.format(POR_TL_DELETE, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You are about to delete
the " + portalToDelete + " 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(SUBMIT_DELETE_PORTAL_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ //Assert.assertTrue(selenium.isTextPresent("TestDelete has successfully been
destroyed"));
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ clickIfVisible("link=Admin");
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ Assert.assertFalse(selenium.isTextPresent(portalToDelete));
- 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 = {"testPortalCreate"})
+ public void testAddPage() {
- @Test(enabled = true, dependsOnMethods = {
"testPortalCreate","testAddPage" })
- public void testRemovePage() {
-
- final String portalName = "TestRemovePagePortal";
- final String portalPage = "tRemPage";
+ final String portalName = "TestAddPagePortal";
+ final String portalPage = "tToAddPage";
- createPortal(portalName);
- createPage(portalName, portalPage);
-
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
- clickIfVisible(LINK_PORTAL_HOME);
+ 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_PORTALNAME, portalName);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- r = findTableRow(TABLE_PORTALPAGE_ADMIN, portalPage, 0) - 1;
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
- selenium.click(MessageFormat.format(PAG_TL_DELETE, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(MessageFormat.format(POR_TL_MAIN, 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?"));
+ 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 = { "testPortalCreate",
"testAddPage" })
- public void testCreateWindow() {
+ @Test(enabled = true, dependsOnMethods = {"testPortalCreate",
"testAddPage"})
+ public void testRemovePage() {
- final String portalName = "toAddWindowPortal";
- final String pageName = "windowContainer";
- final String windowName = "myFancyWindow";
+ final String portalName = "TestRemovePagePortal";
+ final String portalPage = "tRemPage";
- createPortal(portalName);
- createPage(portalName, pageName);
+ createPortal(portalName);
+ createPage(portalName, portalPage);
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
- clickIfVisible(LINK_PORTAL_HOME);
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
- selenium.click(MessageFormat.format(POR_TL_MAIN, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
- r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, portalPage, 0) - 1;
- // click on the page layout
- selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
-
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ selenium.click(MessageFormat.format(PAG_TL_DELETE, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
-
- selenium.click("link=Who's online portlet");
- selenium.waitForPageToLoad(PAGE_LOAD);
-
- selenium.type(INP_WINDOW_NAME, windowName);
-
- selenium.click(SUB_LAYOUT_ADD_CENTER);
- selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent(windowName));
+ 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?"));
- selenium.open("/portal/auth/portal/mimikry");
- Assert.assertTrue(selenium.isTextPresent("Current users"));
+ }
- }
-
- @Test(enabled = true, dependsOnMethods={"testPortalCreate",
"testAddPage"})
- public void testPageRename(){
- String portalName = "TestPortal";
- String pageName = "PageToRename";
-
- createPage("TestPortal", "PageToRename");
-
- openAndWait("/portal");
- clickAndWait("link=Admin");
+ @Test(enabled = true, dependsOnMethods = {"testPortalCreate",
"testAddPage"})
+ public void testCreateWindow() {
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
- //selenium.setSpeed("8000");
- clickIfVisible(LINK_PORTAL_HOME ,"Create a portal named:");
+ final String portalName = "toAddWindowPortal";
+ final String pageName = "windowContainer";
+ final String windowName = "myFancyWindow";
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ createPortal(portalName);
+ createPage(portalName, pageName);
- clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickAndWait(MessageFormat.format(PAG_TL_RENAME, r));
+ 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);
- @Test(enabled = false)
- public void testPageSecurity(){
-
- }
-
- @Test(enabled = false)
- public void testPageTheme(){
-
- }
-
- @Test(enabled = false)
- public void testPageLayout(){
-
- }
-
- private void createPortal(String name) {
- selenium.open("/portal/");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- 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.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- clickIfVisible(TAB_PORTALOBJ_ID);
- clickIfVisible(LINK_PORTALS_ID);
+ selenium.type(INP_WINDOW_NAME, windowName);
- int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(windowName));
- selenium.click(MessageFormat.format(POR_TL_MAIN, r));
- selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.open("/portal/auth/portal/mimikry");
+ Assert.assertTrue(selenium.isTextPresent("Current users"));
- selenium.type(INPUT_PAGENAME, pageName);
- selenium.click(INPUT_SUBMIT_PAGECREATE);
- selenium.waitForPageToLoad(PAGE_LOAD);
+ }
- }
+ @Test(enabled = true, dependsOnMethods = {"testPortalCreate",
"testAddPage"})
+ public void testPageRename() {
+ String portalName = "TestPortal";
+ String pageName = "PageToRename";
+ createPage("TestPortal", "PageToRename");
+
+ openAndWait("/portal");
+ clickAndWait("link=Admin");
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ //selenium.setSpeed("8000");
+ clickIfVisible(LINK_PORTAL_HOME);
+ Assert.assertTrue(selenium.isTextPresent("Create a portal named:"));
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(POR_TL_MAIN, r));
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ clickAndWait(MessageFormat.format(PAG_TL_RENAME, r));
+
+ }
+
+ @Test(enabled = false)
+ public void testPageSecurity() {
+ }
+
+ @Test(enabled = false)
+ public void testPageTheme() {
+ }
+
+ @Test(enabled = false)
+ public void testPageLayout() {
+ }
+
+ 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.waitForPageToLoad(PAGE_LOAD);
+ 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/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-02-17
10:44:45 UTC (rev 12827)
@@ -0,0 +1,214 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+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;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+@Test(groups = {"usecase"}, enabled = true, description = "Creating of new
portal with content.")
+public class EndtoEndPortalAdminTestCase extends JBossPortalSeleniumTestCase {
+
+ public static final String SEL_PORTLET_TYPE =
"_jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:_viewRoot:windowForm:instanceId";
+ private static final String SUB_LAYOUT_ADD_CENTER =
"//input[contains(@id,'layoutForm:a_center')]";
+ private static final String INP_WINDOW_NAME =
"//input[contains(@id,'windowForm:windowName')]";
+ private static final String SUB_RENAME_PORTAL =
"//input[contains(@id,'renameForm:rename')]";
+ private static final String INP_RENAME_PORTAL =
"//input[contains(@id,'renameForm:newName')]";
+ private static final String SUB_DELETE_PORTAL_CONF =
"//input[contains(@id,'delete-view:confirm-form:delete')]";
+ private static final String INP_SUBMIT_PAGECREATE =
"//input[contains(@id,'create-page-form:create-page')]";
+ private static final String INP_PAGENAME =
"//input[contains(@id,'create-page-form:pageName')]";
+ private static final String INP_PORTALNAME =
"//input[contains(@id,'create-portal-form:name')]";
+ private static final String INP_SUBMIT_CREATEPORTAL =
"//input[contains(@id,'create-portal-form:create-portal')]";
+ private final String TAB_PORTALOBJ_ID = "Link=Admin";
+ private final String LNK_PORTALS_ID = "link=*Portal Objects*";
+ private final String LNK_PORTAL_HOME =
"//a[contains(@id,'obj-temp-form:object-link-0')]";
+ private final String TBL_PORTAL_ADMIN =
"//table[contains(@id,'obj-nav-form:portal-datatable')]";
+ private final String POR_TL_MAIN =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:object-iid-link'')]";
+ private final String POR_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:security-link'')]";
+ private final String POR_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:prop-link'')]";
+ private final String POR_TL_THEME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:theme-link'')]";
+ private final String POR_TL_RENAME =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:rename'')]";
+ private final String POR_TL_DELETE =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:delete'')]";
+ private final String POR_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:portal-datatable:{0}:default-link'')]";
+ private final String TBL_PORTALPAGE_ADMIN =
"//table[contains(@id,'obj-nav-form:pages-datatable')]";
+ private final String PAG_TL_MAIN =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:object-link'')]";
+ private final String PAG_TL_LAYOUT =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:edit-page-layout'')]";
+ private final String PAG_TL_SECURITY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:security-link'')]";
+ private final String PAG_TL_PROPERTIES =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:prop-link'')]";
+ private final String PAG_TL_THEME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:theme-link'')]";
+ private final String PAG_TL_RENAME =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-link'')]";
+ private final String PAG_TL_DISPLAY =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:rename-display'')]";
+ private final String PAG_TL_DELETE =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:delete-link'')]";
+ private final String PAG_TL_MAKEDEF =
"//a[contains(@id,''obj-nav-form:pages-datatable:{0}:default-link'')]";
+ /*
+ - create a new portal
+ - add couple of page to the portal
+ - add few portlets of different kinds (csm, widget, regular portlets) in each page
+ - verify that new portal, pages and portlets get added correctly.
+ - Make the new portal default and verify that it becomes default portal
+ */
+
+ @BeforeMethod(groups = {"log"})
+ public void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = {"log"})
+ public void logoutAfterTest() {
+ }
+ final String portalName = "UseCasePortal";
+ final String page1Name = "firstPage";
+ final String page2Name = "anotherPage";
+ final String page3Name = "lastPage with whitespace";
+ final String page4Name = "_.s t R*a^n g e NAME _.][\\page";
+ final String PORTLET1 = "link=*ExceptionPortletInstance*";
+ final String PORTLET2 = "link=*CMSPortletInstance*";
+ final String PORTLET3 = "link=*ExceptionPortletInstance*";
+ final String PORTLET4 = "link=*ExceptionPortletInstance*";
+
+ @Test(enabled = true, description = "Usecase for creating small portal with
content.")
+ public void testCreatePortalUsecase() {
+ createPortal(portalName);
+
+ addPage(page1Name);
+ //selenium.setSpeed("4000");
+ addPage(page2Name);
+ addPage(page3Name);
+ addPage(page4Name);
+
+ addPortlet(portalName, page1Name, PORTLET1, "portlet");
+ addPortlet(portalName, page1Name, PORTLET2, "portlet");
+ addPortlet(portalName, page1Name, PORTLET3, "portlet");
+ addPortlet(portalName, page1Name, PORTLET4, "portlet");
+
+ makeDefaultPortal(portalName);
+ }
+
+ private void createPortal(String portalName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+ clickIfVisible(LNK_PORTAL_HOME);
+
+ Assert.assertFalse(selenium.isTextPresent(portalName), "Not created page
already exist.");
+
+ selenium.type(INP_PORTALNAME, portalName);
+ selenium.click(INP_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(portalName));
+ }
+
+ private void addPage(String pageName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+ clickIfVisible(LNK_PORTAL_HOME);
+
+ selenium.type(INP_PORTALNAME, portalName);
+ selenium.click(INP_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int r = findTableRow(TBL_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(pageName), "Portal page already
present");
+ Assert.assertTrue(selenium.isTextPresent("Create a page named:"));
+
+ selenium.type(INP_PAGENAME, pageName);
+ selenium.click(INP_SUBMIT_PAGECREATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(pageName));
+ }
+
+ private void addPortlet(String portalName, String pageName, String portletName,
String type) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+ clickIfVisible(LNK_PORTAL_HOME);
+
+ int r = findTableRow(TBL_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TBL_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ //hack
+ selenium.select(SEL_PORTLET_TYPE, "label=" + "cms");
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ selenium.select(SEL_PORTLET_TYPE, "label=" + type);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ selenium.click(portletName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void makeDefaultPortal(String portalName) {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LNK_PORTALS_ID);
+ clickIfVisible(LNK_PORTAL_HOME);
+
+ int r = findTableRow(TBL_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAKEDEF, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+}
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/usecaseng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/usecaseng.xml
(rev 0)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/usecaseng.xml 2009-02-17 10:44:45
UTC (rev 12827)
@@ -0,0 +1,14 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="SeleniumTest">
+
+ <test verbose="2"
name="org.jboss.portal.test.selenium.usecase.NewPortalUsecaseTestCase"
annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.usecase.NewPortalUsecaseTestCase"/>
+ </classes>
+ </test>
+
+<listeners>
+<!-- <listener
class-name="org.testng.reporters.JUnitXMLReporter"></listener> -->
+ <listener
class-name="org.jboss.portal.test.selenium.JBossSeleniumTestListener"/>
+</listeners>
+</suite>