Author: vrockai
Date: 2009-01-22 11:31:33 -0500 (Thu, 22 Jan 2009)
New Revision: 12609
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml
Log:
improving test stability
Modified: branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml 2009-01-22
15:27:51 UTC (rev 12608)
+++ branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/build.xml 2009-01-22
16:31:33 UTC (rev 12609)
@@ -141,7 +141,7 @@
<echo message="Runing TestNG" />
<mkdir dir="test-output" />
- <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSingleTest"
listeners="org.jboss.portal.test.selenium.JBossSeleniumTestListener">
+ <testng classpathref="test.cp" sourcedir="${test.src.dir}"
outputdir="${testng.output.dir}" suitename="SeleniumSingleTest">
<classfileset dir="${test.build.dir}" includes="${testname}"
/>
<sysproperty key="browser" value="${browser}" />
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-01-22
15:27:51 UTC (rev 12608)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-01-22
16:31:33 UTC (rev 12609)
@@ -162,6 +162,34 @@
waitFor(1000);
}
}
+
+ protected void waitForElement(String locator, boolean toFind) {
+ 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 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);
+ }
+ }
public void waitForText(String text) {
for (int second = 0;; second++) {
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-01-22
15:27:51 UTC (rev 12608)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-01-22
16:31:33 UTC (rev 12609)
@@ -12,6 +12,13 @@
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test
case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
private static final String INP_CONSUMER_NAME =
"//input[contains(@id,'edit-cons-form:id')]";
+ private static final String CHK_CONSUMER_WSDL
="//input[contains(@id,'edit-cons-form:useWSDL')]";
+
+ private static final String INP_WSDL_DESC_URL
="//input[contains(@id,'edit-cons-form:sd')]";
+ private static final String INP_WSDL_MARK_URL
="//input[contains(@id,'edit-cons-form:m')]";
+ private static final String INP_WSDL_REGI_URL
="//input[contains(@id,'edit-cons-form:r')]";
+ private static final String INP_WSDL_PMAN_URL
="//input[contains(@id,'edit-cons-form:pm')]";
+
private static final String SUBMIT_REFRESH_CANCEL =
"//a[contains(@id,'edit-cons-form:list-cons-link')]";
private static final String SUBMIT_PROD_SAVE =
"//input[contains(@id,'producer-form:save-producer')]";
private static final String SUBMIT_CONSDEL_CONF =
"//a[contains(@id,'confirm-delete-form:destroy-link')]";
@@ -71,7 +78,7 @@
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");
@@ -183,7 +190,15 @@
@Test(enabled = false, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer configuring.")
public void testBeaConsumerConfigure() {
-
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
+
}
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "Standard BEA consumer deleting.")
@@ -291,6 +306,40 @@
Assert.assertTrue(r>0, "Renamed consumer not found in table");
}
+ @Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" },
description = "WSDL checkbox functionality in consumer interface.")
+ public void testConsumerWSDLCheckbox() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(ID_LINK_CONSCONF);
+
+ selenium.type(INPUT_CREATECONS, "checkBEAwsdl");
+
+ selenium.click(SUBMIT_CREATECONS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isChecked(CHK_CONSUMER_WSDL),"wsdl checkbox not checked
after creating new consumer");
+
+ selenium.click(CHK_CONSUMER_WSDL);
+
+ waitForElement(INP_WSDL_DESC_URL);
+ waitForElement(INP_WSDL_MARK_URL);
+ waitForElement(INP_WSDL_PMAN_URL);
+ waitForElement(INP_WSDL_REGI_URL);
+
+ waitFor(10000);
+
+ Assert.assertTrue(selenium.isElementPresent(INP_WSDL_DESC_URL), "wsdl attribute
seen after unchecking the wsdl checkbox #1");
+ Assert.assertTrue(selenium.isElementPresent(INP_WSDL_MARK_URL), "wsdl attribute
seen after unchecking the wsdl checkbox #2");
+ Assert.assertTrue(selenium.isElementPresent(INP_WSDL_PMAN_URL), "wsdl attribute
seen after unchecking the wsdl checkbox #3");
+ Assert.assertTrue(selenium.isElementPresent(INP_WSDL_REGI_URL), "wsdl attribute
seen after unchecking the wsdl checkbox #4");
+
+
+ }
+
private void createConsumer(String name, String timeout, String address) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified:
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-01-22
15:27:51 UTC (rev 12608)
+++
branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-01-22
16:31:33 UTC (rev 12609)
@@ -13,16 +13,17 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
- private static final String ARCHIVE_WAITING = "60000";
+ private static final Integer ARCHIVE_WAITING = 10000;
+ private static final int n = 10;
/*
* 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/"
- * ); }
- */
+/*
+ {
+ 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";
@@ -36,6 +37,8 @@
public void loginBeforeTest() {
logoutIfPossible();
login("admin", "admin");
+ // timeout hack
+ //selenium.setSpeed("10000");
}
@AfterMethod(groups = { "log" })
@@ -46,7 +49,6 @@
@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);
@@ -85,18 +87,26 @@
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");
- selenium.setSpeed(ARCHIVE_WAITING);
- selenium.click("link=Home");
- selenium.setSpeed("0");
- selenium.waitForPageToLoad(PAGE_LOAD);
+ for (int i = 0;; i++) {
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=archive"), "uploaded
archive not found");
+ if (i >= n) {
+ Assert.assertTrue(selenium.isElementPresent("link=archive"), "uploaded
archive not found");
+ break;
+ }
+ if (selenium.isElementPresent("link=archive"))
+ break;
+
+ waitFor(ARCHIVE_WAITING);
+ }
+
selenium.click("link=archive");
selenium.waitForPageToLoad(PAGE_LOAD);
- 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");
+ Assert.assertTrue(selenium.isElementPresent("link=readme.txt"), "content
of uploaded file not found #1");
+ Assert.assertTrue(selenium.isElementPresent("link=jbosslogo.png"),
"content of uploaded file not found #2");
}
@Test(enabled = true, description = "Test archive consisting of > 100 files
upload.")
@@ -113,21 +123,31 @@
selenium.type(INP_ARCHIVE_FILE, WORKSPACE + "/test_files/many_files.zip");
selenium.click(SUB_SEND_ARCHIVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
- 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");
- selenium.setSpeed(ARCHIVE_WAITING);
selenium.click("link=Home");
- selenium.setSpeed("0");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=many_files"),
"uploaded archive not found");
+ for (int i = 0;; i++) {
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ if (i >= n) {
+ Assert.assertTrue(selenium.isElementPresent("link=many_files"),
"uploaded archive not found");
+ break;
+ }
+
+ if (selenium.isElementPresent("link=many_files"))
+ break;
+
+ waitFor(ARCHIVE_WAITING);
+ }
+
selenium.click("link=many_files");
selenium.waitForPageToLoad(PAGE_LOAD);
-
Assert.assertTrue(selenium.isElementPresent("link=file31.txt"), "content
of uploaded archive not found");
}
@@ -150,11 +170,23 @@
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");
- selenium.setSpeed(ARCHIVE_WAITING);
selenium.click("link=Home");
- selenium.setSpeed("0");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isElementPresent("link=bigfile"), "uploaded
archive not found");
+ for (int i = 0;; i++) {
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ if (i >= n) {
+ Assert.assertTrue(selenium.isElementPresent("link=bigfile"), "uploaded
archive not found");
+ break;
+ }
+
+ if (selenium.isElementPresent("link=bigfile"))
+ break;
+
+ waitFor(ARCHIVE_WAITING);
+ }
+
}
}
Modified: branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml 2009-01-22
15:27:51 UTC (rev 12608)
+++ branches/Enterprise_Portal_Platform_4_3/testsuite/ui-tests/testng.xml 2009-01-22
16:31:33 UTC (rev 12609)
@@ -52,12 +52,6 @@
<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>
@@ -82,6 +76,12 @@
<class
name="org.jboss.portal.test.selenium.portal.PortletInstancesTestCase"></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>
+
<listeners>
<!-- <listener
class-name="org.testng.reporters.JUnitXMLReporter"></listener> -->
<listener
class-name="org.jboss.portal.test.selenium.JBossSeleniumTestListener"/>