Author: vrockai
Date: 2009-05-25 09:51:00 -0400 (Mon, 25 May 2009)
New Revision: 13411
Added:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowUploadTestCase.java
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng-cms-wf.xml
Log:
[JBPORTAL-2311] - file upload tests, archive longer timeout
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-05-25
10:25:51 UTC (rev 13410)
+++
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-05-25
13:51:00 UTC (rev 13411)
@@ -20,7 +20,7 @@
/** The constant defining the wait time (in ms) between attempts when checking if the
file was uploaded. */
- public static final int ARCHIVE_WAITING = 7000;
+ public static final int ARCHIVE_WAITING = 5000;
/** The constant defining the the number of attempts when checking if the file was
uploaded. */
public static final int ATTEMPTS = 50;
@@ -51,7 +51,7 @@
logoutIfPossible();
login("admin", "admin");
// timeout hack
- selenium.setSpeed("1000");
+ selenium.setSpeed("3000");
}
@AfterMethod(groups = { "log" })
Added:
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
(rev 0)
+++
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)
@@ -0,0 +1,145 @@
+package org.jboss.portal.test.selenium.cms;
+
+import java.io.File;
+
+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;
+
+/**
+ * CMSFileUploadTestCase is responsible for testing of file uploading.
+ *
+ * @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
+ */
+
+@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 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;
+
+ @BeforeMethod(groups = { "log" })
+ protected void loginBeforeTest() {
+ logoutIfPossible();
+ login("admin", "admin");
+ }
+
+ @AfterMethod(groups = { "log" })
+ protected void logoutAfterTest() {
+
+ }
+
+ /**
+ * Canceling of file upload. 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 default directory. Instead of submit
+ * button, the cancel button is pressed. The assertion are made to count the
+ * number of rows in file tables asserting the number of rows didn't change
+ * after canceling of upload.
+ */
+ @Test(enabled = true, description = "canceling of file upload")
+ public void testFileUploadCancel() {
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=CMS");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_m_before = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_d_before = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=Home");
+ 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 upload");
+ selenium.select("language", "label=Afar");
+ selenium.type("response", WORKSPACE + "/test_files/testFile.txt");
+ selenium.click("link=default");
+ selenium.click("cancel");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_m_after = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=default");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ int rc_d_after = countTableRows(CMS_FILE_TABLE);
+
+ selenium.click("link=Home");
+ 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.");
+ Assert.assertEquals(rc_d_after, rc_d_before, "The row count in CMS file table has
changes after canceling the upload of file in the default dir.");
+ }
+
+ /**
+ * 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.
+ */
+ @Test(enabled = true, description = "File upload test")
+ public void testFileUpload() {
+
+ 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 upload");
+ selenium.select("language", "label=Afar");
+ selenium.type("response", TEST_FILES_DIR + "testFile.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_APPROVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("//div[@id='center']/div/div/ul/li[3]"),
"testFile.txt");
+ 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");
+
+ Assert.assertTrue(selenium.isElementPresent("link=Afar"));
+ Assert.assertTrue(selenium.isTextPresent("testFile.txt"));
+
+ selenium.click("link=Home");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText("link=testFile.txt"),
"testFile.txt");
+ }
+
+}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng-cms-wf.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng-cms-wf.xml 2009-05-25
10:25:51 UTC (rev 13410)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/testng-cms-wf.xml 2009-05-25
13:51:00 UTC (rev 13411)
@@ -19,10 +19,10 @@
<class
name="org.jboss.portal.test.selenium.cms.CMSDirectoryTestCase"></class></classes>
</test>
- <test name="org.jboss.portal.test.selenium.cms.CMSFileUploadTestCase"
+ <test
name="org.jboss.portal.test.selenium.cms.CMSFileWorkflowUploadTestCase"
verbose="2" annotations="JDK">
<classes>
- <class
name="org.jboss.portal.test.selenium.cms.CMSFileUploadTestCase"></class></classes>
+ <class
name="org.jboss.portal.test.selenium.cms.CMSFileWorkflowUploadTestCase"></class></classes>
</test>
<test name="org.jboss.portal.test.selenium.cms.CMSArchiveUploadTestCase"
Show replies by date