Author: vrockai
Date: 2009-05-25 11:27:14 -0400 (Mon, 25 May 2009)
New Revision: 13412
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFileDeny.txt
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFilePrev.txt
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java
Log:
[JBPORTAL-2311] - new tests added
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-25
13:51:00 UTC (rev 13411)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java 2009-05-25
15:27:14 UTC (rev 13412)
@@ -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 CMSFileWorkflowUploadTestCase extends JBossPortalSeleniumTestCase {
/*
@@ -104,7 +104,7 @@
* directory is asserted.
*/
@Test(enabled = true, description = "File upload test")
- public void testFileUpload() {
+ public void testFileApproveUpload() {
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -141,5 +141,88 @@
Assert.assertEquals(selenium.getText("link=testFile.txt"),
"testFile.txt");
}
+
+ /**
+ * 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.
+ */
+ @Test(enabled = true, description = "File upload test")
+ public void testFileDenyUpload() {
+ 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.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.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");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=testFileDeny.txt"));
+ }
+
+ /**
+ * 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() {
+
+ 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.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.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");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertFalse(selenium.isElementPresent("link=testFilePrev.txt"));
+ }
+
}
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFileDeny.txt
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFileDeny.txt
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFileDeny.txt 2009-05-25
15:27:14 UTC (rev 13412)
@@ -0,0 +1 @@
+i'm the test file!
Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFilePrev.txt
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFilePrev.txt
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFilePrev.txt 2009-05-25
15:27:14 UTC (rev 13412)
@@ -0,0 +1 @@
+i'm the test file!
Show replies by date