From portal-commits at lists.jboss.org Mon May 25 11:34:25 2009 Content-Type: multipart/mixed; boundary="===============1899265981316573930==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r13412 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests: test_files and 1 other directory. Date: Mon, 25 May 2009 11:27:14 -0400 Message-ID: --===============1899265981316573930== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/testFileD= eny.txt branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFileP= rev.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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/porta= l/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/porta= l/test/selenium/cms/CMSFileWorkflowUploadTestCase.java 2009-05-25 15:27:14 = UTC (rev 13412) @@ -13,7 +13,7 @@ * = * @author Viliam Rockai */ - +//TODO refactoring needed @Test(groups =3D { "cms_file_upload" }, enabled =3D true) public class CMSFileWorkflowUploadTestCase extends JBossPortalSeleniumTest= Case { /* @@ -104,7 +104,7 @@ * directory is asserted. */ @Test(enabled =3D true, description =3D "File upload test") - public void testFileUpload() { + public void testFileApproveUpload() { = selenium.click("link=3DAdmin"); selenium.waitForPageToLoad(PAGE_LOAD); @@ -141,5 +141,88 @@ = Assert.assertEquals(selenium.getText("link=3DtestFile.txt"), "testFile.t= xt"); } + = + /** + * 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 n= on-existence of the file in root + * directory is asserted. + */ + @Test(enabled =3D true, description =3D "File upload test") + public void testFileDenyUpload() { = + selenium.click("link=3DAdmin"); + selenium.waitForPageToLoad(PAGE_LOAD); + selenium.click("link=3DCMS"); + selenium.waitForPageToLoad(PAGE_LOAD); + + selenium.select("//div[@id=3D'center']/div/div/div[1]/div/select", "labe= l=3DUpload 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=3DAfar"); + 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=3DHome"); + selenium.waitForPageToLoad(PAGE_LOAD); + + Assert.assertFalse(selenium.isElementPresent("link=3DtestFileDeny.txt")); + } + = + /** + * Selenium doesn't support file downloading, therefore the test is disab= led. 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 =3D false, description =3D "File upload test") + public void testFilePreviewUpload() { + + selenium.click("link=3DAdmin"); + selenium.waitForPageToLoad(PAGE_LOAD); + selenium.click("link=3DCMS"); + selenium.waitForPageToLoad(PAGE_LOAD); + + selenium.select("//div[@id=3D'center']/div/div/div[1]/div/select", "labe= l=3DUpload 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=3DAfar"); + 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=3DHome"); + selenium.waitForPageToLoad(PAGE_LOAD); + + Assert.assertFalse(selenium.isElementPresent("link=3DtestFilePrev.txt")); + } + } Added: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testF= ileDeny.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile= Deny.txt (rev 0) +++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile= Deny.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/testF= ilePrev.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile= Prev.txt (rev 0) +++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/test_files/testFile= Prev.txt 2009-05-25 15:27:14 UTC (rev 13412) @@ -0,0 +1 @@ +i'm the test file! --===============1899265981316573930==--