Author: vrockai
Date: 2008-10-13 12:26:13 -0400 (Mon, 13 Oct 2008)
New Revision: 12060
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
Log:
portal admin tests addded
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/selenium-rc-server/user-extensions.js 2008-10-13
16:26:13 UTC (rev 12060)
@@ -39,4 +39,25 @@
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.parseCSV();
+
+ 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) {
+ assert.fail("'" + expectedTextValues[i] + "' not
found.");
+ }
+ if (nextIndex == -1) {
+ assert.fail("'" + expectedTextValues[i+1] + "' not
found.");
+ }
+
+ if (index > nextIndex) {
+ assert.fail("'" + expectedTextValues[i+1] + "'
found before '" + expectedTextValues[i] + "'");
+ }
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -75,8 +75,6 @@
Assert.assertEquals(selenium.getSelectedLabel(SELECT_THEME), "renaissance",
"Previously selected theme other then expected.");
}
-
-
@Test(enabled = true, dependsOnMethods = { "testCreatePage" })
public void testUpdateLayout() {
selenium.click(LINK_DASHBOARD);
@@ -124,6 +122,47 @@
Assert.assertTrue(selenium.isTextPresent("[admin]"));
}
+ @Test(enabled = true, dependsOnMethods = {
"testCreatePage","testAddPortlet" })
+ public void testMovePortlet() {
+ final String pageName = "DashMovePage";
+
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_PAGENAME, pageName);
+ selenium.click(SUBMIT_CREATEPAGE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CONFIGURE_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=ExceptionPortletInstance");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selectIfNotSelected(SELECT_PAGE,pageName);
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_ADDCENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LINK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link="+pageName);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(assertTextOrder("Current;Exception"));
+ Assert.assertTrue(assertTextOrder("Exception;Current"));
+
+ }
+
@Test(enabled = true, dependsOnMethods = { "testAddPortlet" })
public void testDeletePortlet() {
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -79,7 +79,7 @@
logoutIfPossible();
}
-
+/*
// For this mode to be functional, the user which is logged in must be
"admin" after each test
@BeforeClass(groups = { "single" })
public void loginBefore() {
@@ -90,7 +90,7 @@
public void logoutAfter() {
logout();
}
-
+*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
createUser("tempUser", "tempPassword",
"tempUser(a)redhat.com");
@@ -326,7 +326,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isElementPresent(TABLE_ROLEMEMBERS), "Not assigned
member found in the role members table.");
- selenium.setSpeed("3000");
+
deleteRole("membersRole");
deleteUser("newRoleMember" , "newRoleMem(a)redhatqa.com");
}
@@ -400,10 +400,11 @@
searchSimple("man","100");
Assert.assertEquals(countTableRows(TABLE_USERLIST)-1,95,"Wrong number of row in
user table #4.");
-
+ /*
for(int i=0; i< 95; i++){
deleteUser("man"+i+"us",
"man"+i+"us"+"(a)redhatqa.com");
}
+ */
}
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -92,6 +92,10 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ protected boolean assertTextOrder(String text){
+ return Boolean.valueOf(selenium.getEval("selenium.assertTextOrder(\"" +
text + "\")"));
+ }
protected void login(String username, String password) {
selenium.open(ADDR_PORTAL);
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/PortletUserCreationTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -90,8 +90,6 @@
selenium.click(SUBMIT_CREATE_CONF_EDIT);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("3000");
-
selenium.type(INPUT_USERNAME, "portletLong2User");
selenium.type(INPUT_USERMAIL, "portletLong2User(a)redhat.com");
selenium.type(INPUT_USERPASSWD, "portletLong2UserPassword");
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -301,6 +301,9 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
selenium.type(INPUT_CACHEEXP, timeout);
selenium.type(INPUT_CONSWSDL, address);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -308,6 +311,9 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUBMIT_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+
selenium.click(SUBMIT_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -13,6 +13,9 @@
@Test(groups = { "cms_archive_upload" }, enabled = true)
public class CMSArchiveUploadTestCase extends JBossPortalSeleniumTestCase {
+ /* 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/selenium/selenium/");
@@ -34,7 +37,29 @@
@Test(enabled = true, description = "Test archive consisting of two files
upload.")
public void testArchiveUpload() {
//System.out.println("archive adress:" + WORKSPACE);
+ // canceling at the first stage
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload Archive");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("response", WORKSPACE + "/test_files/archive.zip");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+
+ Assert.assertFalse(selenium.isTextPresent("Your archive has been accepted for
processing"));
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent("link=archive"));
+
+ // really uploading the file now
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -46,8 +71,10 @@
selenium.type("response", WORKSPACE + "/test_files/archive.zip");
selenium.click("submit");
-
selenium.waitForPageToLoad(PAGE_LOAD);
+ //
+
+ selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[2]/td/font"),
"Your archive has been accepted for processing. The resources will appear in
your Folder once the processing is finished");
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -32,6 +32,9 @@
@Test(enabled = true, description="Directory creation.")
public void testCreateDirectory() {
+
+ // cancelling of creating
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -40,14 +43,38 @@
selenium.open("/portal/auth/portal/admin/CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isTextPresent("TestFolder["), "Test folder
is already present.");
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already
present.");
selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("newcollectionname", tempDirName);
selenium.type("newcollectiondescription", "test folder");
+ selenium.click("cancel");
+
+ // really creating
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.open("/portal/auth/portal/admin/CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(tempDirName), "Test folder is already
present.");
+
+ selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create Folder");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("newcollectionname", tempDirName);
+ selenium.type("newcollectiondescription", "test folder");
selenium.click("submit");
+
+ // assuring that the directory is deleted
+
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/ul/li[3]"));
Assert.assertEquals(tempDirName,
selenium.getText("//div[@id='center']/div/div/ul/li[3]"));
@@ -59,11 +86,36 @@
@Test(enabled = true, dependsOnMethods =
"testCreateDirectory",description="Directory delete.")
public void testDeleteDirectory() {
+
+ // firstly cancel the delete process
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
+ selenium.select(takeAction(tempDirName) + "/select",
"label=Delete");
+ selenium.click(takeAction(tempDirName) + "/select/option[4]");
+ selenium.click(takeAction(tempDirName) + "/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /" +
tempDirName));
+ Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
resource?"));
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really deleting
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=" + tempDirName));
selenium.select(takeAction(tempDirName) + "/select",
"label=Delete");
selenium.click(takeAction(tempDirName) + "/select/option[4]");
selenium.click(takeAction(tempDirName) + "/input");
@@ -76,6 +128,14 @@
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+ // assuring that the deletition was processed
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
Assert.assertFalse(selenium.isElementPresent("link=" + tempDirName));
}
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -14,6 +14,7 @@
public class CMSFileTestCase extends JBossPortalSeleniumTestCase {
private final String CMS_FILE_TABLE =
"//div[@id='center']/div/div/div[3]/table";
+ public static final String CMS_FILE_PENDING_TABLE =
"//div[@id='center']/div/div/table[2]";
@BeforeMethod(groups = { "log" })
public void loginBeforeTest() {
@@ -109,6 +110,13 @@
selenium.select("language", "label=Czech");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "text/plain", 0) >=
0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "0kb", 1) >= 0);
+ Assert.assertTrue(findTableRow(CMS_FILE_PENDING_TABLE, "admin", 3) >= 0);
+
+ selenium.click("link=Approve");
+
Assert.assertEquals("Czech", selenium.getText("link=Czech"));
Assert.assertEquals("text/plain",
selenium.getText("link=text/plain"));
Assert.assertEquals("1.0",
selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -34,9 +34,11 @@
logout();
}
-
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFileApprove() {
+
+ // canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -50,6 +52,25 @@
selenium.type("title", "newFile title");
selenium.select("language", "label=Czech");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // saving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -101,10 +122,33 @@
@Test(enabled = true, description = "Simple file creation.")
public void testCreateFilePreview(){
+ String name = "file2preview";
- //TODO after the bug with empty content is repaired
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", name);
+ selenium.type("description", name + " description");
+ selenium.type("title", "existingFile title");
+ selenium.select("language", "label=Czech");
+ fillInEditor("vivat!");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Preview");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Pending Approval Queue"));
+ Assert.assertTrue(selenium.isTextPresent("vivat!"));
+
}
@Test(enabled = true, dependsOnMethods = "testCreateFileApprove", description
= "Simple file delete Cancel in first step, and then delete.")
@@ -131,9 +175,9 @@
row = findTableRow(CMS_FILE_TABLE, "newFile", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select",
"label=Delete");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/select/option[4]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr["+row+"]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/td[2]/form/select", "label=Delete");
+ selenium.click(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/td[2]/form/select/option[4]");
+ selenium.click(CMS_FILE_TABLE +
"/tbody/tr["+row+"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Confirm Deletion of /newFile"));
Assert.assertTrue(selenium.isTextPresent("WARNING! You will not be able to undo
these change!"));
@@ -145,19 +189,54 @@
@Test(enabled = true, description = "File creation and moving to default
directory.")
public void testMoveFile() {
createFile("fileToMove","");
+
+ //canceling first
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["
+ row + "]/td[2]/form/select", "label=Move");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is not moved
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
+
+ // really moving file
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ row = findTableRow(CMS_FILE_TABLE, "fileToMove", 0) + 1;
+
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Move");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=default");
selenium.click("submit");
selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // assuming file is moved
+
selenium.click("link=default");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -178,9 +257,9 @@
selenium.waitForPageToLoad(PAGE_LOAD);
int row = findTableRow(CMS_FILE_TABLE, "file2copy", 0) + 1;
- selenium.select("//div[@id='center']/div/div/div[3]/table/tbody/tr["
+ row + "]/td[2]/form/select", "label=Copy");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/select/option[3]");
- selenium.click("//div[@id='center']/div/div/div[3]/table/tbody/tr[" +
row + "]/td[2]/form/input");
+ selenium.select(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select", "label=Copy");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/select/option[3]");
+ selenium.click(CMS_FILE_TABLE + "/tbody/tr[" + row +
"]/td[2]/form/input");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=default");
selenium.click("submit");
@@ -204,6 +283,8 @@
createFile(file,"contentstring1");
+ // canceling for the first time
+
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
@@ -211,11 +292,31 @@
selenium.click("link="+file);
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("5000");
+
row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring2");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // really creating and approving
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link="+file);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ row = findTableRow(CMS_FV_TABLE, "1.1", 2) + 1;
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ fillInEditor("contentstring2");
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -223,7 +324,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
fillInEditor("contentstring3");
selenium.click("save");
@@ -235,19 +336,26 @@
Assert.assertFalse(selenium.isTextPresent("1.5"));
row = findTableRow(CMS_FV_TABLE, "1.3", 2) + 1;
- selenium.click("//div[@id='center']/div/div/table/tbody/tr["+row+"]/td[1]/a");
+ selenium.click(CMS_FV_TABLE + "/tbody/tr["+row+"]/td[1]/a");
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("contentstring2"));
}
+
private void createFile(String name,String content) {
+
+ // save and approve
+ selenium.open(ADDR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=CMS");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Create File");
+ selenium.click("link=Home");
selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
selenium.type("filename", name);
selenium.type("description", name + " description");
@@ -256,6 +364,7 @@
selenium.click("save");
selenium.waitForPageToLoad(PAGE_LOAD);
+
selenium.click("link=Approve");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Home");
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -0,0 +1,61 @@
+package org.jboss.portal.test.selenium.cms;
+import org.jboss.portal.test.selenium.JBossPortalSeleniumTestCase;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+
+/**
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@Test(groups = { "cms_gui" }, enabled = true)
+
+public class CMSPendingItemsTestCase extends JBossPortalSeleniumTestCase {
+
+ public static final String SELECT_MAIN =
"//div[@id='center']/div/div/div[1]/div/select";
+ public static final String PENDING_TABLE
="//div[@id='center']/div/div/table";
+
+ @BeforeMethod( groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true, description = "Simple file creation.")
+ public void testCreatePendingFile() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_MAIN, "label=Create File");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.waitForPopUp("_top", PAGE_LOAD);
+ selenium.type("filename", "newFile");
+ selenium.type("description", "newFile description");
+ selenium.type("title", "newFile title");
+ selenium.select("language", "label=Czech");
+ selenium.click("save");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertEquals("newFile", selenium.getText("link=newFile"));
+
+ selenium.select(SELECT_MAIN, "label=Pending Items");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(PENDING_TABLE, "newFile", 0)>=0);
+
+ }
+
+}
Property changes on:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSPendingItemsTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Modified:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13
14:45:21 UTC (rev 12059)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSSecureTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -131,6 +131,9 @@
@Test(enabled = true, description = "Set user read permissions, login as
user.")
public void testSetUserReadPer() {
+
+ // cancelling at first stage
+
login("admin", "admin");
Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured
resource is not visible.#1");
@@ -148,6 +151,30 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
selenium.select(SELECT_SECUREUSERS_READ, "label=user");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ logout();
+
+ // really setting the permissions
+
+ login("admin", "admin");
+
+ Assert.assertFalse(selenium.isTextPresent("Access Denied"),"Non secured
resource is not visible.#1");
+ Assert.assertFalse(selenium.isTextPresent("You are not allowed to access the
following resource - /default/index.html"),"Non secured resource is not
visible.#2");
+
+ selenium.click(LINK_ADMIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CMS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_DEFAULT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_INDEX_HTML);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_CMS_ACTION, "label=Secure");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_SECUREROLES_READ, "label=Administrators");
+ selenium.select(SELECT_SECUREUSERS_READ, "label=user");
selenium.click(SUBMIT_SECURITY_SET);
selenium.waitForPageToLoad(PAGE_LOAD);
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/DashboardsTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -0,0 +1,151 @@
+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;
+
+public class DashboardsTestCase extends JBossPortalSeleniumTestCase {
+
+ private static final String T_DH_SUB_UPDATE =
"common-edit-theme-form:_id125jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String T_DH_SEL_RENDERSET =
"common-edit-theme-form:renderSet";
+ private static final String T_DH_SEL_THEME = "common-edit-theme-form:theme";
+ private static final String T_DH_SEL_LAYOUT =
"common-edit-theme-form:layout";
+ private static final String T_PA_SUB_UPDATE =
"common-edit-page-error-form:update_2";
+ private static final String T_PO_SUB_UPDATE =
"common-edit-portal-error-form:update_1";
+ private static final String T_PA_INP_PAGEADD =
"common-edit-page-error-form:page-res-select";
+ private static final String T_PO_INP_PAGEADD =
"common-edit-portal-error-form:portal-res-input";
+ private static final String T_PA_SEL_PNF =
"common-edit-page-error-form:page-not-found-select";
+ private static final String T_PA_SEL_INTERN =
"common-edit-page-error-form:page-internal-select";
+ private static final String T_PA_SEL_ERROR =
"common-edit-page-error-form:page-error-select";
+ private static final String T_PA_SEL_CONTROL =
"common-edit-page-error-form:page-control-select";
+ private static final String T_PA_SEL_ACCESS =
"common-edit-page-error-form:page-access-select";
+ private static final String T_PO_SEL_PNF =
"common-edit-portal-error-form:portal-not-found-select";
+ private static final String T_PO_SEL_UNAVAIL =
"common-edit-portal-error-form:portal-unavail-select";
+ private static final String T_PO_SEL_ACCESS =
"common-edit-portal-error-form:portal-access-select";
+ private static final String SUBMIT_UPDATE_VALUE =
"common-manage-prop-form:update";
+ private static final String TABLE_PROPS =
"common-manage-prop-form:prop-data-table";
+ private static final String T_PROPS_INPUT_VALUE =
"common-manage-prop-form:prop-data-table:{0}:prop-value-input";
+ private static final String T_PROPS_LINK_DEL =
"common-manage-prop-form:prop-data-table:{0}:delete";
+
+ private static final String TABLE_PA_ERR =
"//form[@id='common-edit-page-error-form']/table";
+ private static final String TABLE_PO_ERR =
"//form[@id='common-edit-portal-error-form']/table";
+ private static final String TABLE_DH_THM =
"//form[@id='common-edit-theme-form']/table";
+ private static final String INPUT_PROP_NAME =
"common-edit-prop-form:property";
+ private static final String SUBMIT_ADD_PROP =
"common-edit-prop-form:add-property";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_DASH =
"admin-subtab-form:dashboard-link";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToDash();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testPropAdd() {
+ final String propName = "SelenProp";
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+ }
+
+ @Test(enabled = true)
+ public void testPropUpdate() {
+ final String propName = "SelenValueProp";
+ final String value = "updatedValue";
+ Assert.assertFalse(selenium.isTextPresent(value));
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+
+ int r = findTableRow(TABLE_PROPS, propName, 0);
+ System.out.println(propName+":"+r);
+
+ selenium.type(MessageFormat.format(T_PROPS_INPUT_VALUE, r-1),value);
+ selenium.click(SUBMIT_UPDATE_VALUE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent(value));
+
+ }
+
+ @Test(enabled = true)
+ public void testPropDelete() {
+ final String propName = "SelenDeleteProp";
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+ selenium.type(INPUT_PROP_NAME, propName);
+ selenium.click(SUBMIT_ADD_PROP);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent(propName));
+
+ int r = findTableRow(TABLE_PROPS, propName, 0);
+ System.out.println(propName+":"+r);
+
+ selenium.click(MessageFormat.format(T_PROPS_LINK_DEL, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isTextPresent(propName));
+
+ }
+
+ @Test(enabled = true)
+ public void testPortalError() {
+ selenium.select(T_PO_SEL_ACCESS, "label=Redirect to the specified
resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PO_SEL_UNAVAIL, "label=Redirect to the specified
resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PO_SEL_PNF, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(T_PO_INP_PAGEADD, "/WEB-INF/jsp/error/portalX.jsp");
+ selenium.click(T_PO_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testPageError() {
+ selenium.select(T_PA_SEL_ACCESS, "label=Display the default error message");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_CONTROL, "label=Redirect to the specified
resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_ERROR, "label=Remove the resource from page");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_INTERN, "label=Display the default error message");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(T_PA_SEL_PNF, "label=Redirect to the specified resource");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(T_PA_INP_PAGEADD, "/WEB-INF/jsp/error/pageY.jsp");
+ selenium.click(T_PA_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ @Test(enabled = true)
+ public void testDashboardTheme() {
+ selenium.select(T_DH_SEL_LAYOUT, "label=1column");
+ selenium.select(T_DH_SEL_THEME, "label=nphalanx");
+ selenium.select(T_DH_SEL_RENDERSET, "label=default");
+ selenium.click(T_DH_SUB_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void goToDash() {
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_DASH);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletDefinitionsTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -0,0 +1,97 @@
+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;
+
+public class PortletDefinitionsTestCase extends JBossPortalSeleniumTestCase{
+
+ private static final String T_LINK_PREF = "def-list:portlet-pref-{0}";
+ private static final String SUBMIT_CREATE_INST =
"add_instance_form:_id19jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj";
+ private static final String INPUT_INSTANCE_NAME =
"add_instance_form:instanceId";
+ private static final String T_LINK_CREATE = "def-list:create-instance-{0}";
+ private static final String SUBMIT_PROVIDER_VIEW =
"definition-form:view-portlets";
+ private static final String SELECT_PROVIDER = "definition-form:menu";
+ private static final String TABLE_PORTLET =
"//form[@id='def-list']/table";
+ private static final String LINK_NAME_ADMIN_PORT =
"common-show-portlet-detail-form:field1:select";
+ private static final String LINK_ADMIN_PORT = "def-list:portlet-def-0";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_PD =
"admin-subtab-form:portlet-def-link";
+ private static final String LINK_PD_MAIN = "man-form:def-link";
+
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToPD();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testShowInfo(){
+ selenium.click(LINK_ADMIN_PORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
+ Assert.assertTrue(selenium.isElementPresent(LINK_NAME_ADMIN_PORT));
+ Assert.assertTrue(selenium.isTextPresent("Administration Portlet"));
+ Assert.assertTrue(selenium.isTextPresent("Management Portlet"));
+ Assert.assertTrue(selenium.isTextPresent("management,admin"));
+ Assert.assertTrue(selenium.isTextPresent("de it en"));
+ }
+
+ @Test(enabled = true)
+ public void testCreateInstance(){
+
+ int r = findTableRow(TABLE_PORTLET, "Administration Portlet", 0);
+
+ selenium.click(MessageFormat.format(T_LINK_CREATE,r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_INSTANCE_NAME, "littleAdmin");
+ selenium.click(SUBMIT_CREATE_INST);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("littleAdmin portlet details"));
+ Assert.assertTrue(selenium.isTextPresent("Portlet Instance Information"));
+ }
+
+ @Test(enabled = true)
+ public void testPreferences(){
+
+ int r = findTableRow(TABLE_PORTLET, "Current Users Portlet", 0);
+
+ selenium.click(MessageFormat.format(T_LINK_PREF,r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Current Users Portlet
preferences"));
+ Assert.assertTrue(selenium.isTextPresent("guestNumber"));
+ }
+
+ @Test(enabled = true)
+ public void testSwitchProvider(){
+ selenium.select(SELECT_PROVIDER, "label=self");
+ selenium.click(SUBMIT_PROVIDER_VIEW);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ int n = countTableRows(TABLE_PORTLET);
+ Assert.assertEquals(n, 16,"Wrong number of self portlets.");
+
+ selenium.select(SELECT_PROVIDER, "label=local");
+ selenium.click(SUBMIT_PROVIDER_VIEW);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ n = countTableRows(TABLE_PORTLET);
+ Assert.assertEquals(n, 21, "Wrong number of local portlets.");
+ }
+
+ private void goToPD(){
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_PD);
+ clickIfVisible(LINK_PD_MAIN);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2008-10-13
16:26:13 UTC (rev 12060)
@@ -0,0 +1,231 @@
+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;
+
+public class PortletInstancesTestCase extends JBossPortalSeleniumTestCase{
+
+ private static final String SUBMIT_SECURITY_UPDATE =
"common-edit-security-form:update";
+ private static final String SUBMIT_SECURITY_CANCEL =
"common-edit-security-form:cancel";
+
+ private static final String LINK_PREF_WELCOMEPORT =
"instances-form:security-JSPPortletInstance";
+
+ private static final String TABLE_PREF_KEY =
"//form[@id='common-edit-pref-form']/table";
+
+ private static final String SUBMIT_PREF_DELETE =
"common-edit-exisiting-form:row_0";
+ private static final String LINK_PREF_GUESTNUM =
"common-edit-pref-form:pref-link-0";
+ private static final String INPUT_PREF_NEWVAL =
"common-append-form:new_value";
+ private static final String SUBMIT_PREF_UPDATE =
"common-append-form:append-button";
+ private static final String SUBMIT_PREF_SAVE =
"_id919jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:save";
+ private static final String INPUT_PREF_UPDATE =
"common-edit-exisiting-form:update";
+ private static final String INPUT_PREF_APPEND =
"common-edit-exisiting-form:pref-input-0";
+ private static final String SUBMIT_PREF_CANCEL =
"_id458jbpns_2fadmin_2fdefault_2fAdminPortletWindowsnpbj:cancel";
+ private static final String LINK_CURUSER_PREFERENCES =
"instances-form:preference-CurrentUsersPortletInstance";
+ private static final String LINK_DEL_EXCEPTPORT =
"instances-form:delete-ExceptionPortletInstance";
+ private static final String SUBMIT_PI_DELETE_CONF =
"confirm-delete-form1:delete";
+ private static final String SUBMIT_PI_DELETE_CANC =
"confirm-delete-form1:cancel";
+ private static final String T_LINK_DELETENAME =
"displaynamecontainer:instance-display-form:locale-data-table:{0}:delete-link";
+ private static final String T_LINK_MODIFYNAME =
"displaynamecontainer:instance-display-form:locale-data-table:{0}:edit-link";
+ private static final String LINK_COUNTPORT =
"instances-form:CounterPortletInstance";
+ private static final String SUBMIT_MODIFY_NAME =
"displaynamecontainer:displayNameForm:addDisplay";
+ private static final String INPUT_NAME =
"displaynamecontainer:displayNameForm:newName";
+ private static final String SELECT_LANGUAGE =
"displaynamecontainer:displayNameForm:locales";
+ private static final String LINK_ADMIN = "link=Admin";
+ private static final String LINK_TAB_PI =
"admin-subtab-form:portlet-instance-link";
+ private static final String LINK_PI_MAIN = "instance-form1:instance-link";
+ private static final String TABLE_DISPNAMES =
"displaynamecontainer:instance-display-form:locale-data-table";
+
+ @BeforeMethod(groups = { "log" })
+ public void loginBeforeTest() {
+ login("admin", "admin");
+ goToPI();
+ }
+
+ @AfterMethod(groups = { "log" })
+ public void logoutAfterTest() {
+ logout();
+ }
+
+ @Test(enabled = true)
+ public void testAddName(){
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Czech");
+ final String name = "Administracny";
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, name, 1)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testDeleteName(){
+ // adding the name
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Japanese");
+ final String name = "Aduminu";
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // deleting name
+
+ int r = findTableRow(TABLE_DISPNAMES, name, 1);
+
+ selenium.click(MessageFormat.format(T_LINK_DELETENAME, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(findTableRow(TABLE_DISPNAMES, name, r)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testModifyName(){
+ // adding the name
+ selenium.click(LINK_COUNTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.select(SELECT_LANGUAGE, "label=Japanese");
+ final String name = "Adminisimo";
+ final String nameNew = "Adminiprisimo";
+
+ selenium.type(INPUT_NAME, name);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // midifying name
+
+ int r = findTableRow(TABLE_DISPNAMES, name, 1);
+
+ selenium.click(MessageFormat.format(T_LINK_MODIFYNAME, r-1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_NAME, nameNew);
+ selenium.click(SUBMIT_MODIFY_NAME);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(findTableRow(TABLE_DISPNAMES, nameNew, 1)>=0);
+ }
+
+ @Test(enabled = true)
+ public void testSecure(){
+ // "common-edit-security-form:cancel"
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_2']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and
@value='admin']");
+ selenium.click(SUBMIT_SECURITY_UPDATE);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertTrue(selenium.isTextPresent("Greetings !"));
+
+ // then cancel
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad("30000");
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click(SUBMIT_SECURITY_CANCEL);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertTrue(selenium.isTextPresent("Greetings !"));
+
+ // then really stop the greetings portlet
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad("30000");
+ selenium.click(LINK_PREF_WELCOMEPORT);
+ selenium.waitForPageToLoad("30000");
+ selenium.click("//input[@name='common-edit-security-form:cars_0']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_0' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_2' and
@value='admin']");
+ selenium.click("//input[@name='common-edit-security-form:cars_1']");
+ selenium.click(SUBMIT_SECURITY_UPDATE);
+ selenium.waitForPageToLoad("30000");
+
+ selenium.click("link=Portal");
+ selenium.waitForPageToLoad("30000");
+ Assert.assertFalse(selenium.isTextPresent("Greetings !"));
+ }
+
+ @Test(enabled = true)
+ public void testDeleteInstance(){
+ // cancel first
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception
portlet not found.");
+ selenium.click(LINK_DEL_EXCEPTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
portlet instance ?"));
+ selenium.click(SUBMIT_PI_DELETE_CANC);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ // delete
+ goToPI();
+ Assert.assertTrue(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception
portlet not found.");
+ selenium.click(LINK_DEL_EXCEPTPORT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("WARNING!"));
+ Assert.assertTrue(selenium.isTextPresent("Are you sure you want to delete this
portlet instance ?"));
+ selenium.click(SUBMIT_PI_DELETE_CONF);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertFalse(selenium.isElementPresent(LINK_DEL_EXCEPTPORT),"Exception
portlet found after deletition.");
+ }
+
+ @Test(enabled = true)
+ public void testPreferences(){
+ int r;
+ selenium.click(LINK_CURUSER_PREFERENCES);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(SUBMIT_PREF_CANCEL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click(LINK_CURUSER_PREFERENCES);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(findTableRow(TABLE_PREF_KEY, "guestNumber", 0) >= 0);
+ selenium.click(LINK_PREF_GUESTNUM);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true]");
+ selenium.type(INPUT_PREF_APPEND, "true1");
+ selenium.click(INPUT_PREF_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[true1]");
+ selenium.click(SUBMIT_PREF_DELETE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[]");
+ selenium.type(INPUT_PREF_NEWVAL, "viliam");
+ selenium.click(SUBMIT_PREF_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r=findTableRow(TABLE_PREF_KEY, "guestNumber", 0);
+ Assert.assertEquals(selenium.getText(TABLE_PREF_KEY+"/tbody/tr["+r+"]/td[4]"),"[viliam]");
+ selenium.click(SUBMIT_PREF_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ }
+
+ private void goToPI(){
+ selenium.open("/portal/");
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_ADMIN);
+ clickIfVisible(LINK_TAB_PI);
+ clickIfVisible(LINK_PI_MAIN);
+ }
+
+}
Modified: branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-13 14:45:21 UTC
(rev 12059)
+++ branches/JBoss_Portal_Branch_2_6/testsuite/ui-tests/testng.xml 2008-10-13 16:26:13 UTC
(rev 12060)
@@ -15,7 +15,7 @@
<classes>
<class
name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
</test>
-
+<!--
<test name="org.jboss.portal.test.selenium.IdentityAdminTestCase -
SingleLogin"
verbose="2" annotations="JDK">
<groups>
@@ -24,7 +24,7 @@
<classes>
<class
name="org.jboss.portal.test.selenium.IdentityAdminTestCase"></class></classes>
</test>
-
+-->
<test name="org.jboss.portal.test.selenium.PortletUserCreationTestCase"
verbose="2" annotations="JDK">
<classes>
@@ -84,4 +84,23 @@
<classes>
<class
name="org.jboss.portal.test.selenium.portal.AdminPortalTestCase"></class></classes>
</test>
+
+ <test
name="org.jboss.portal.test.selenium.portal.PortletInstancesTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.portal.PortletInstancesTestCase"></class></classes>
+ </test>
+
+ <test
name="org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.portal.PortletDefinitionsTestCase"></class></classes>
+ </test>
+
+ <test name="org.jboss.portal.test.selenium.portal.DashboardsTestCase"
+ verbose="2" annotations="JDK">
+ <classes>
+ <class
name="org.jboss.portal.test.selenium.portal.DashboardsTestCase"></class></classes>
+ </test>
+
</suite>