Author: vrockai
Date: 2009-01-20 07:22:56 -0500 (Tue, 20 Jan 2009)
New Revision: 12566
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/cms/CMSArchiveUploadTestCase.java
Log:
single test tweak
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-01-20 12:03:22 UTC
(rev 12565)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-01-20 12:22:56 UTC
(rev 12566)
@@ -2,11 +2,12 @@
<property environment="env" />
+ <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="testng.dir" location="testng-files" />
<property name="testng.output.dir" location="test-output" />
<property name="test.build.dir" location="output/classes" />
@@ -55,11 +56,11 @@
<classpath refid="server.taskdef.classpath" />
</taskdef>
-<target name="init">
+ <target name="init">
<echo message="Browser : ${browser}" />
<echo message="Screenshot : ${screenshot}" />
- <echo message="Deleting testng report directory"/>
- <delete dir="${testng.output.dir}"/>
+ <echo message="Deleting testng report directory" />
+ <delete dir="${testng.output.dir}" />
</target>
@@ -89,8 +90,8 @@
</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"/>
+ <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="clean">
@@ -120,8 +121,7 @@
<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">
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="test-output"
listeners="org.testng.reporters.JUnitXMLReporter"
suitename="SeleniumSuite">
<xmlfileset dir="." includes="testng.xml" />
@@ -137,32 +137,33 @@
<antcall target="cleanup" />
</target>
- <target name="single-test" depends="init, compile, run-src">
+ <target name="single-test" depends="init, compile, run-src,
copyApps">
+ <echo message="Runing TestNG" />
- <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumTest"
testname="org.jboss.portal.test.selenium.SingleTestCase">
-<!-- listeners="org.testng.reporters.JUnitXMLReporter"-->
- <classfileset dir="${test.build.dir}"
- includes="${testname}" />
+ <mkdir dir="test-output" />
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumTest"
testname="${testname}">
+
+ <classfileset dir="${test.build.dir}" includes="${testname}"
/>
<sysproperty key="browser" value="${browser}" />
<sysproperty key="screenshot" value="${screenshot}" />
+ <sysproperty key="workspace" value="${workspace}" />
+
<jvmarg value="-ea" />
</testng>
</target>
- <target name="selenium-test" depends="init, compile,
run-src">
+ <target name="selenium-test" depends="init, compile, run-src,
copyApps">
+ <echo message="Runing TestNG" />
- <antcall target="copyApps" />
- <echo message="Runing TestNG" />
<mkdir dir="test-output" />
- <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}"
- suitename="SeleniumSuite">
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSuite">
<xmlfileset dir="." includes="testng.xml" />
<sysproperty key="browser" value="${browser}" />
<sysproperty key="screenshot" value="${screenshot}" />
- <sysproperty key="workspace" value="${workspace}"/>
+ <sysproperty key="workspace" value="${workspace}" />
<jvmarg value="-ea" />
Modified:
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 2009-01-20
12:03:22 UTC (rev 12565)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-01-20
12:22:56 UTC (rev 12566)
@@ -12,15 +12,17 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
-
- private static final String ARCHIVE_WAITING = "180000";
- /* uncomment following lines and set the right path to the workspace in the case
- * you want to use this test case locally from eclipse */
+
+ private static final String ARCHIVE_WAITING = "60000";
/*
- {
- System.setProperty("workspace","/home/vrockai/workspace/p2.7tests/ui-tests/");
- }
- */
+ * uncomment following lines and set the right path to the workspace in the
+ * case you want to use this test case locally from eclipse
+ */
+ /*
+ * {
+ *
System.setProperty("workspace","/home/vrockai/workspace/p2.7tests/ui-tests/"
+ * ); }
+ */
private static final String SUB_CANCEL_ARCH_UPLOAD = "cancel";
private static final String LNK_ADMIN = "link=Admin";
private static final String LNK_CMS = "link=CMS";
@@ -30,21 +32,21 @@
private static final String SEL_ACTION =
"//div[@id='center']/div/div/div[1]/div/select";
private final String WORKSPACE = System.getProperty("workspace");
- @BeforeMethod( groups = { "log" })
+ @BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
}
- @AfterMethod( groups = { "log" })
+ @AfterMethod(groups = { "log" })
public void logoutAfterTest() {
-
+
}
@Test(enabled = true, description = "Test archive consisting of two files
upload.")
public void testArchiveUpload() {
// canceling at the first stage
-
+
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
@@ -54,18 +56,18 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type(INP_ARCHIVE_FILE, WORKSPACE + "/test_files/archive.zip");
-
+
selenium.click(SUB_CANCEL_ARCH_UPLOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
-
-
- Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for
processing"));
- Assert.assertFalse(selenium.isElementPresent("link=archive"));
-
+
+ Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for
processing"),
+ "archive was accepted for processing afte cancelling the upload");
+ Assert.assertFalse(selenium.isElementPresent("link=archive"), "not
uploaded (upload cancelled) archive found #1");
+
selenium.open(ADDR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isElementPresent("link=archive"));
-
+ Assert.assertFalse(selenium.isElementPresent("link=archive"), "not
uploaded (upload cancelled) archive found #2");
+
// really uploading the file now
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -76,10 +78,10 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type(INP_ARCHIVE_FILE, WORKSPACE + "/test_files/archive.zip");
-
+
selenium.click(SUB_SEND_ARCHIVE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertEquals(selenium.getText(DIV_ARCHIVE_STATUS),
"Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
@@ -87,19 +89,19 @@
selenium.click("link=Home");
selenium.setSpeed("0");
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertEquals(selenium.getText("link=archive"), "archive");
+ Assert.assertTrue(selenium.isElementPresent("link=archive"), "uploaded
archive not found");
+
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");
+ Assert.assertEquals(selenium.isElementPresent("link=readme.txt"),
"content of uploaded file not found #1");
+ Assert.assertEquals(selenium.isElementPresent("link=jbosslogo.png"),
"content of uploaded file not found #2");
}
-
+
@Test(enabled = true, description = "Test archive consisting of > 100 files
upload.")
public void testManyFilesArchiveUpload() {
-
+
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
@@ -109,7 +111,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type(INP_ARCHIVE_FILE, WORKSPACE + "/test_files/many_files.zip");
-
+
selenium.click(SUB_SEND_ARCHIVE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -120,20 +122,18 @@
selenium.click("link=Home");
selenium.setSpeed("0");
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertTrue(selenium.isElementPresent("link=many_files"));
+ Assert.assertTrue(selenium.isElementPresent("link=many_files"),
"uploaded archive not found");
+
selenium.click("link=many_files");
selenium.waitForPageToLoad(PAGE_LOAD);
- //TODO assert all files
-
- Assert.assertTrue(selenium.isElementPresent("link=file31.txt"));
+ Assert.assertTrue(selenium.isElementPresent("link=file31.txt"), "content
of uploaded archive not found");
}
-
+
@Test(enabled = true, description = "Test archive consisting of 21MB file
upload.")
public void testBigArchiveUpload() {
-
+
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
@@ -143,7 +143,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type(INP_ARCHIVE_FILE, WORKSPACE + "/test_files/big_archive.zip");
-
+
selenium.click(SUB_SEND_ARCHIVE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -154,8 +154,7 @@
selenium.click("link=Home");
selenium.setSpeed("0");
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertTrue(selenium.isElementPresent("link=bigfile"));
+ Assert.assertTrue(selenium.isElementPresent("link=bigfile"), "uploaded
archive not found");
}
}