Author: vrockai
Date: 2008-10-27 11:06:26 -0400 (Mon, 27 Oct 2008)
New Revision: 12185
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
dashboardtestcase fixed, extensions added
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-27
14:00:56 UTC (rev 12184)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-27
15:06:26 UTC (rev 12185)
@@ -39,4 +39,29 @@
Selenium.prototype.fillInEditor = function(locator, content){
var iframe = this.browserbot.findElement(locator);
iframe.contentDocument.body.innerHTML= content;
-}
\ No newline at end of file
+}
+
+Selenium.prototype.assertTextOrder = function(textValues) {
+
+ var allText = this.page().bodyText();
+ var expectedTextValues = textValues.split(";");
+
+ for (var i = 0; i < expectedTextValues.length - 1; i++) {
+ var index = allText.indexOf(expectedTextValues[i]);
+ var nextIndex = allText.indexOf(expectedTextValues[i+1]);
+ if (index == -1) {
+ return false;
+ //assert.fail("'" + expectedTextValues[i] + "'
not found.");
+ }
+ if (nextIndex == -1) {
+ return false;
+ //assert.fail("'" + expectedTextValues[i+1] + "'
not found.");
+ }
+
+ if (index > nextIndex) {
+ return false;
+ //assert.fail("'" + expectedTextValues[i+1] + "'
found before '" + expectedTextValues[i] + "'");
+ }
+ }
+ return true;
+}
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-27
14:00:56 UTC (rev 12184)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-27
15:06:26 UTC (rev 12185)
@@ -11,6 +11,9 @@
@Test(groups = { "cms_dashboard" }, enabled = true, description =
"Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
+ private static final String SEL_CONTENT_TYPE =
"//select[contains(@id,'contentTypesForm:instanceId')]";
+ private static final String SUB_DEL_FROM_CENTER_REGION =
"//input[contains(@id,'layoutForm:l_center')]";
+ private static final String SEL_CENTER_REGION =
"//select[contains(@id,'layoutForm:selectMany_center')]";
private static final String SUBMIT_ADDCENTER =
"//input[contains(@id,'layoutForm:a_center')]";
private static final String SUBMIT_ADDLEFT =
"//input[contains(@id,'layoutForm:a_left')]";
private static final String LINK_CONFIGURE_DASHBOARD = "link=Configure
dashboard";
@@ -119,7 +122,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Current users"));
- Assert.assertTrue(selenium.isTextPresent("Whose 1 is logged-in:"));
+ Assert.assertTrue(selenium.isTextPresent("Among them: * logged-in"));
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
@@ -174,8 +177,8 @@
selectIfNotSelected(SELECT_PAGE,"DashTestPage");
- selenium.addSelection("layoutForm:selectMany_center",
"label=CurrentUsersPortletWindow");
- selenium.click("layoutForm:l_center");
+ selenium.addSelection(SEL_CENTER_REGION, "label=CurrentUsersPortletWindow");
+ selenium.click(SUB_DEL_FROM_CENTER_REGION);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LINK_DASHBOARD);
@@ -195,9 +198,9 @@
selenium.click(LINK_CONFIGURE_DASHBOARD);
selenium.waitForPageToLoad(PAGE_LOAD);
selectIfNotSelected(SELECT_PAGE,"DashTestPage");
- selenium.select("abc:instanceId", "label=widget/google");
+ selenium.select(SEL_CONTENT_TYPE, "label=widget/google");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Hindu God of the Week");
+ selenium.click("link=Band Culinaria");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUBMIT_ADDCENTER);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -206,7 +209,8 @@
selenium.click("link=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Hindu God of the Week"));
+ Assert.assertTrue(selenium.isTextPresent("Band Culinaria"));
+ Assert.assertTrue(selenium.isTextPresent("Gadgets powered by Google"));
}
//
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023