Author: konstantin.mishin
Date: 2009-05-12 10:22:06 -0400 (Tue, 12 May 2009)
New Revision: 14120
Modified:
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java
trunk/examples/photoalbum/tests/src/test/resources/testng.xml
Log:
RF-6909
Modified:
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java
===================================================================
---
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java 2009-05-12
13:52:00 UTC (rev 14119)
+++
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java 2009-05-12
14:22:06 UTC (rev 14120)
@@ -99,6 +99,7 @@
String DESCRIPTION_PATH = HEADER_PATH + "/following-sibling::p";
String PREVIEW_PATH = "//*[@class='preview_box_album_120']";
String PREVIEW_LINK_PATH_SUFFIX = "//a";
+ String PREVIEW_DRAG_PATH_SUFFIX = PREVIEW_LINK_PATH_SUFFIX + "/img";
String PREVIEW_NAME_PATH_SUFFIX = "/*[@class='album_name']";
String CONTROLS_PATH = "//*[@class='album-header-table-col2']";
String EDIT_PATH = CONTROLS_PATH + "/a[1]";
@@ -118,6 +119,7 @@
String DESCRIPTION_PATH = HEADER_PATH + "/following-sibling::p";
String PREVIEW_PATH = "//*[@class='preview_box_photo_120']";
String PREVIEW_LINK_PATH_SUFFIX = "//a";
+ String PREVIEW_DRAG_PATH_SUFFIX = PREVIEW_LINK_PATH_SUFFIX + "/img";
String PREVIEW_NAME_PATH_SUFFIX = "/*[@class='photo_name']";
String CONTROLS_PATH = "//*[@class='mainImage-table-col3']";
String EDIT_PATH = CONTROLS_PATH + "/div[1]/input";
@@ -238,6 +240,9 @@
Assert.assertTrue(selenium.isVisible(HtmlConstants.FilesUploadArea.FILE_UPLOAD_ID));
}
+ public static void openShelf(Selenium selenium) {
+ openShelf(selenium, selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[2]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX));
+ }
public static void openShelf(Selenium selenium, String shelfName) {
boolean presented = false;
int xpathCount =
selenium.getXpathCount(HtmlConstants.ShelfArea.HEADER_PATH).intValue();
Modified:
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java
===================================================================
---
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java 2009-05-12
13:52:00 UTC (rev 14119)
+++
trunk/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java 2009-05-12
14:22:06 UTC (rev 14120)
@@ -19,8 +19,8 @@
public void testDnDAlbumFromTree() {
renderPage();
RealWorldHelper.login(selenium);
- String fromShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[2]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
- String toShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[3]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
+ String toShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[2]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
+ String fromShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[3]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
RealWorldHelper.openShelf(selenium, fromShelfName);
RealWorldHelper.openAlbumFromPreview(selenium);
String albumName =
selenium.getText(RealWorldHelper.HtmlConstants.AlbumArea.HEADER_NAME_PATH);
@@ -37,4 +37,47 @@
RealWorldHelper.openShelf(selenium, toShelfName);
Assert.assertTrue(RealWorldHelper.isAlbumPresentOnPage(selenium, albumName));
}
+
+ @Test
+ public void testDnDAlbumFromPreview() {
+ renderPage();
+ RealWorldHelper.login(selenium);
+ String fromShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[2]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
+ String toShelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_PATH +
"[3]" + HtmlConstants.ShelfArea.HEADER_NAME_PATH_SUFFIX);
+ RealWorldHelper.openShelf(selenium, fromShelfName);
+ String albumName = selenium.getText(HtmlConstants.AlbumArea.PREVIEW_PATH +
HtmlConstants.AlbumArea.PREVIEW_NAME_PATH_SUFFIX);
+ String shelfTextPath = RealWorldHelper.getShelfTextPathInTree(selenium, toShelfName);
+ selenium.dragAndDropToObject(HtmlConstants.AlbumArea.PREVIEW_PATH +
HtmlConstants.AlbumArea.PREVIEW_DRAG_PATH_SUFFIX, shelfTextPath);
+ waitForAjaxCompletion();
+ selenium.click(HtmlConstants.ToolBarArea.VIEW_SHELFS_PATH);
+ waitForAjaxCompletion();
+ RealWorldHelper.openShelf(selenium, fromShelfName);
+ Assert.assertFalse(RealWorldHelper.isAlbumPresentOnPage(selenium, albumName));
+ selenium.click(HtmlConstants.ToolBarArea.VIEW_SHELFS_PATH);
+ waitForAjaxCompletion();
+ RealWorldHelper.openShelf(selenium, toShelfName);
+ Assert.assertTrue(RealWorldHelper.isAlbumPresentOnPage(selenium, albumName));
+ }
+
+ @Test
+ public void testDnDImage() {
+ renderPage();
+ RealWorldHelper.login(selenium);
+ RealWorldHelper.openShelf(selenium);
+ String fromAlbumName = selenium.getText(HtmlConstants.AlbumArea.PREVIEW_PATH +
HtmlConstants.AlbumArea.PREVIEW_NAME_PATH_SUFFIX);
+ String toAlbumName = selenium.getText(HtmlConstants.AlbumArea.PREVIEW_PATH +
"[2]" + HtmlConstants.AlbumArea.PREVIEW_NAME_PATH_SUFFIX);
+ RealWorldHelper.openAlbumFromPreview(selenium);
+ String imageName = selenium.getText(HtmlConstants.ImageArea.PREVIEW_PATH +
HtmlConstants.ImageArea.PREVIEW_NAME_PATH_SUFFIX);
+ String albumTextPath = RealWorldHelper.getAlbumTextPathInTree(selenium, toAlbumName);
+ selenium.dragAndDropToObject(HtmlConstants.ImageArea.PREVIEW_PATH +
HtmlConstants.ImageArea.PREVIEW_DRAG_PATH_SUFFIX, albumTextPath);
+ waitForAjaxCompletion();
+ selenium.click(HtmlConstants.ToolBarArea.VIEW_ALBUMS_PATH);
+ waitForAjaxCompletion();
+ RealWorldHelper.openAlbumFromPreview(selenium, fromAlbumName);
+ Assert.assertFalse(RealWorldHelper.isImagePresentOnPage(selenium, imageName));
+ selenium.click(HtmlConstants.ToolBarArea.VIEW_ALBUMS_PATH);
+ waitForAjaxCompletion();
+ RealWorldHelper.openAlbumFromPreview(selenium, toAlbumName);
+ Assert.assertTrue(RealWorldHelper.isImagePresentOnPage(selenium, imageName));
+ }
}
Modified: trunk/examples/photoalbum/tests/src/test/resources/testng.xml
===================================================================
--- trunk/examples/photoalbum/tests/src/test/resources/testng.xml 2009-05-12 13:52:00 UTC
(rev 14119)
+++ trunk/examples/photoalbum/tests/src/test/resources/testng.xml 2009-05-12 14:22:06 UTC
(rev 14120)
@@ -3,10 +3,18 @@
<!-- test name="IEFunctionalTests">
<parameter name="browser" value="*iexplore"/>
</test-->
- <test name="FireFoxFunctionalTestsDANe">
+ <test name="FireFoxFunctionalTestsDANe1">
<parameter name="browser" value="*firefox"/>
+ <classes>
+ <class name="org.richfaces.photoalbum.testng.DnDUseCasesTest" />
+ </classes>
+ </test>
+ <test name="FireFoxFunctionalTestsDANe2">
+ <parameter name="browser" value="*firefox"/>
<packages>
- <package name="org.richfaces.photoalbum.testng" />
+ <package name="org.richfaces.photoalbum.testng" >
+ <exclude name="DnDUseCasesTest"></exclude>
+ </package>
</packages>
</test>
</suite>