Author: vrockai
Date: 2009-05-28 06:06:10 -0400 (Thu, 28 May 2009)
New Revision: 13417
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/CMSFileUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
Log:
[BPORTAL-2311] cms workflow refactoring
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-05-27
10:33:48 UTC (rev 13416)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileTestCase.java 2009-05-28
10:06:10 UTC (rev 13417)
@@ -22,7 +22,7 @@
private final String TBL_CMS_FILEVER = getLoc(casePfx + "tbl.cms.filever",
"//div[@id='center']/div/div/table");
public final String TBL_CMS_FILE = getLoc(casePfx + "tbl.cms.file",
"//div[@id='center']/div/div/div[3]/table");
public final String TBL_FILE_PENDING = getLoc(casePfx + "tbl.file.pending",
"//div[@id='center']/div/div/table[2]");
-
+
@BeforeMethod(groups = { "log" })
protected void loginBeforeTest() {
logoutIfPossible();
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java 2009-05-27
10:33:48 UTC (rev 13416)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileUploadTestCase.java 2009-05-28
10:06:10 UTC (rev 13417)
@@ -13,7 +13,7 @@
*
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-
+//TODO refactoring needed
@Test(groups = { "cms_file_upload" }, enabled = true)
public class CMSFileUploadTestCase extends JBossPortalSeleniumTestCase {
/*
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2009-05-27
10:33:48 UTC (rev 13416)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2009-05-28
10:06:10 UTC (rev 13417)
@@ -17,12 +17,14 @@
@Test(groups = { "cms_file_workflow" }, enabled = true)
public class CMSFileWorkflowTestCase extends JBossPortalSeleniumTestCase {
- private static final String SUB_MOVE = "submit";
+
/** prefix for locator properties = cms.file.work. */
public final String casePfx = "cms.file.work.";
private final String LAB_LANG_CZECH = getLoc(casePfx + "lab.lang.czech",
"label=Czech");
+ private final String SUB_MOVE = getLoc(casePfx + "sub.move",
"submit");
+ private final String LNK_HOME = getLoc(casePfx + "lnk.home",
"link=Home");
private final String LNK_DENY = getLoc(casePfx + "lnk.deny",
"link=Deny");
private final String LNK_PREVIEW = getLoc(casePfx + "lnk.preview",
"link=Preview");
private final String LNK_APPROVE = getLoc(casePfx + "lnk.approve",
"link=Approve");
@@ -169,7 +171,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_MAIN, LAB_CREATE_FILE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -270,7 +272,7 @@
Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
@@ -298,7 +300,7 @@
Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isElementPresent("link=fileToMove"));
@@ -329,7 +331,7 @@
Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent("link=file2copy"));
@@ -376,7 +378,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=" + file);
@@ -421,7 +423,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_CMS);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SELECT_CMS_MAIN, LAB_CREATE_FILE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -436,7 +438,7 @@
selenium.click(LNK_APPROVE);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Home");
+ selenium.click(LNK_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(name, selenium.getText("link=" + name));
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java 2009-05-27
10:33:48 UTC (rev 13416)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java 2009-05-28
10:06:10 UTC (rev 13417)
@@ -9,32 +9,33 @@
import org.testng.annotations.Test;
/**
- * CMSFileUploadTestCase is responsible for testing of file uploading.
+ * CMSFileUploadTestCase is responsible for testing of file uploading. Files
+ * used in these tests are stored in the path defined by the system variable
+ * workspace (-Dworkspace).
*
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
-//TODO refactoring needed
@Test(groups = { "cms_file_upload" }, enabled = true)
public class CMSFileWorkflowUploadTestCase 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-2.7/"
- * ); }
- */
-
/** prefix for locator properties = cms.file.up. */
private final String casePfx = "cms.file.up.";
+
+ private final String SUB_FIL_SUBMIT = getLoc(casePfx + "sub.fil.submit",
"submit");
+ private final String SUB_FIL_CANCEL = getLoc(casePfx + "sub.fil.cancel",
"cancel");
+ private final String INP_FIL_FIL = getLoc(casePfx + "inp.fil.fil",
"response");
+ private final String INP_FIL_LAN = getLoc(casePfx + "inp.fil.lan",
"language");
+ private final String INP_FIL_TIT = getLoc(casePfx + "inp.fil.tit",
"title");
+ private final String INP_FIL_DES = getLoc(casePfx + "inp.fil.des",
"description");
private final String LNK_DENY = getLoc(casePfx + "lnk.deny",
"link=Deny");
private final String LNK_PREVIEW = getLoc(casePfx + "lnk.preview",
"link=Preview");
private final String LNK_APPROVE = getLoc(casePfx + "lnk.approve",
"link=Approve");
private final String CMS_FILE_TABLE = getLoc(casePfx + "cms.file.table",
"//div[@id='center']/div/div/div[3]/table");
private final String WORKSPACE = System.getProperty("workspace");
- private final String TEST_FILES_DIR = WORKSPACE + File.separatorChar +
"test_files" + File.separatorChar;
-
+ private final String TEST_FILES_DIR = WORKSPACE + File.separatorChar +
"test_files" + File.separatorChar;
+ private final String SEL_ACTION = getLoc(casePfx + "sel.action",
"//div[@id='center']/div/div/div[1]/div/select");
+ private final String LNK_CMS_ROOT = getLoc(casePfx + "lnk.cms.root",
"link=Home");
+ private final String TAB_FILE_VER = getLoc(casePfx + "tab.file.ver",
"//div[@id='center']/div/div/table");
+
@BeforeMethod(groups = { "log" })
protected void loginBeforeTest() {
logoutIfPossible();
@@ -68,18 +69,18 @@
int rc_d_before = countTableRows(CMS_FILE_TABLE);
- selenium.click("link=Home");
+ selenium.click(LNK_CMS_ROOT);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.select("//div[@id='center']/div/div/div[1]/div/select",
"label=Upload File");
+ selenium.select(SEL_ACTION, "label=Upload File");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
- selenium.type("description", "myFile");
- selenium.type("title", "file to upload");
- selenium.select("language", "label=Afar");
- selenium.type("response", WORKSPACE + "/test_files/testFile.txt");
+ selenium.type(INP_FIL_DES, "myFile");
+ selenium.type(INP_FIL_TIT, "file to upload");
+ selenium.select(INP_FIL_LAN, "label=Afar");
+ selenium.type(INP_FIL_FIL, WORKSPACE + "/test_files/testFile.txt");
selenium.click("link=default");
- selenium.click("cancel");
+ selenium.click(SUB_FIL_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
int rc_m_after = countTableRows(CMS_FILE_TABLE);
@@ -89,7 +90,7 @@
int rc_d_after = countTableRows(CMS_FILE_TABLE);
- selenium.click("link=Home");
+ selenium.click(LNK_CMS_ROOT);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(rc_m_after, rc_m_before, "The row count in CMS file table has
changes after canceling the upload of file in the root dir.");
@@ -100,129 +101,135 @@
* File upload test. The form for uploading file is filled with relevant
* values and the file located in "test_files/testFile.txt" is chosen for
* uploading into the root directory. Submit button is pressed and the
- * upload should take the action and afterwards the file is approved. The existence of
the file in root
- * directory is asserted.
+ * upload should take the action and afterwards the file is approved. The
+ * existence of the file in root directory is asserted.
*/
@Test(enabled = true, description = "File upload test")
public void testFileApproveUpload() {
+ String fileName = "testFile.txt";
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 File");
+ selenium.select(SEL_ACTION, "label=Upload File");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
- selenium.type("description", "myFile");
- selenium.type("title", "file to upload");
- selenium.select("language", "label=Afar");
- selenium.type("response", TEST_FILES_DIR + "testFile.txt");
- selenium.click("submit");
+ selenium.type(INP_FIL_DES, "myFile");
+ selenium.type(INP_FIL_TIT, "file to upload");
+ selenium.select(INP_FIL_LAN, "label=Afar");
+ selenium.type(INP_FIL_FIL, TEST_FILES_DIR + fileName);
+ selenium.click(SUB_FIL_SUBMIT);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isElementPresent(LNK_PREVIEW));
Assert.assertTrue(selenium.isElementPresent(LNK_APPROVE));
Assert.assertTrue(selenium.isElementPresent(LNK_DENY));
-
+
selenium.click(LNK_APPROVE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/ul/li[3]"),
"testFile.txt");
+
+ Assert.assertTrue(selenium.isTextPresent(fileName));
Assert.assertTrue(selenium.isElementPresent("link=text/plain"));
- Assert.assertTrue(selenium.isElementPresent("//div[@id='center']/div/div/table/tbody/tr[4]/td[3]"));
- Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/table/tbody/tr[4]/td[6]"),
"file to upload");
+ int r = findTableRow(TAB_FILE_VER, "file to upload", 5);
+
+ Assert.assertTrue(r > -1, "File title not found in the file table");
+
Assert.assertTrue(selenium.isElementPresent("link=Afar"));
- Assert.assertTrue(selenium.isTextPresent("testFile.txt"));
+ Assert.assertTrue(selenium.isTextPresent(fileName));
- selenium.click("link=Home");
+ selenium.click(LNK_CMS_ROOT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText("link=testFile.txt"),
"testFile.txt");
+ Assert.assertEquals(selenium.getText("link=" + fileName), fileName);
}
-
+
/**
* File upload test. The form for uploading file is filled with relevant
- * values and the file located in "test_files/testFileDeny.txt" is chosen for
- * uploading into the root directory. Submit button is pressed and the
- * upload should take the action and afterwards the file is denied. The non-existence of
the file in root
- * directory is asserted.
+ * values and the file located in "test_files/testFileDeny.txt" is chosen
+ * for uploading into the root directory. Submit button is pressed and the
+ * upload should take the action and afterwards the file is denied. The
+ * non-existence of the file in root directory is asserted.
*/
@Test(enabled = true, description = "File upload test")
public void testFileDenyUpload() {
+ String filename = "testFileDeny.txt";
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 File");
+ selenium.select(SEL_ACTION, "label=Upload File");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
- selenium.type("description", "myFile");
- selenium.type("title", "file to deny upload");
- selenium.select("language", "label=Afar");
- selenium.type("response", TEST_FILES_DIR + "testFileDeny.txt");
- selenium.click("submit");
+ selenium.type(INP_FIL_DES, "myFile");
+ selenium.type(INP_FIL_TIT, "file to deny upload");
+ selenium.select(INP_FIL_LAN, "label=Afar");
+ selenium.type(INP_FIL_FIL, TEST_FILES_DIR + filename);
+ selenium.click(SUB_FIL_SUBMIT);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isElementPresent(LNK_PREVIEW));
Assert.assertTrue(selenium.isElementPresent(LNK_APPROVE));
Assert.assertTrue(selenium.isElementPresent(LNK_DENY));
-
+
selenium.click(LNK_DENY);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(selenium.isTextPresent("testFileDeny.txt"));
- selenium.click("link=Home");
+ Assert.assertFalse(selenium.isTextPresent(filename));
+
+ selenium.click(LNK_CMS_ROOT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isElementPresent("link=testFileDeny.txt"));
+ Assert.assertFalse(selenium.isElementPresent("link=" + filename));
}
-
+
/**
- * Selenium doesn't support file downloading, therefore the test is disabled. The
form for uploading file is filled with relevant
- * values and the file located in "test_files/testFilePrev.txt" is chosen for
- * uploading into the root directory. Submit button is pressed and the
- * upload should take the action and afterwards the file is previewed and denied.
non-existence of the file in root
- * directory is asserted.
+ * Selenium doesn't support file downloading, therefore the test is
+ * disabled. The form for uploading file is filled with relevant values and
+ * the file located in "test_files/testFilePrev.txt" is chosen for uploading
+ * into the root directory. Submit button is pressed and the upload should
+ * take the action and afterwards the file is previewed and denied.
+ * non-existence of the file in root directory is asserted.
*/
@Test(enabled = false, description = "File upload test")
public void testFilePreviewUpload() {
+ String filename = "testFilePrev.txt";
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 File");
+ selenium.select(SEL_ACTION, "label=Upload File");
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.waitForPopUp("_top", PAGE_LOAD);
- selenium.type("description", "myFile");
- selenium.type("title", "file to deny upload");
- selenium.select("language", "label=Afar");
- selenium.type("response", TEST_FILES_DIR + "testFilePrev.txt");
- selenium.click("submit");
+ selenium.type(INP_FIL_DES, "myFile");
+ selenium.type(INP_FIL_TIT, "file to deny upload");
+ selenium.select(INP_FIL_LAN, "label=Afar");
+ selenium.type(INP_FIL_FIL, TEST_FILES_DIR + filename);
+ selenium.click(SUB_FIL_SUBMIT);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isElementPresent(LNK_PREVIEW));
Assert.assertTrue(selenium.isElementPresent(LNK_APPROVE));
Assert.assertTrue(selenium.isElementPresent(LNK_DENY));
-
+
selenium.click(LNK_PREVIEW);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
selenium.click(LNK_DENY);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- Assert.assertFalse(selenium.isTextPresent("testFileDenyPrev.txt"));
- selenium.click("link=Home");
+ Assert.assertFalse(selenium.isTextPresent(filename));
+
+ selenium.click(LNK_CMS_ROOT);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertFalse(selenium.isElementPresent("link=testFilePrev.txt"));
+ Assert.assertFalse(selenium.isElementPresent("link=" + filename));
}
}
Modified:
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 2009-05-27
10:33:48 UTC (rev 13416)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-05-28
10:06:10 UTC (rev 13417)
@@ -71,6 +71,7 @@
}
final String portalName = "UseCasePortal";
+ final String portalManName = "UseManagePortal";
final String page1Name = "firstPage";
final String page2Name = "anotherPage";
final String page3Name = "lastPage with whitespace";
@@ -168,6 +169,11 @@
assertPageContains(page5Name, por5str);
}
+
+ @Test(enabled = true, description = "Usecase for creating small portal with
content.")
+ public void testManagePortalUsecase() {
+ createPortal(portalManName);
+ }
private void assertPageContains(String pageName, String awaitStr) {
selenium.open(ADR_PORTAL);