Author: Alex.Kolonitsky
Date: 2009-09-15 06:16:09 -0400 (Tue, 15 Sep 2009)
New Revision: 15570
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/AddUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DeleteUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/EditUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/LoginTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/OpenAreasUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/ScrollerUseCasesTest.java
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/SearchTest.java
Log:
Investigate and fix photoalbum tests
https://jira.jboss.org/jira/browse/RFPL-86
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -190,38 +190,31 @@
}
- public static void login(Selenium selenium) {
+ public static void login(SeleniumTestBase selenium) {
login(selenium, UserInfoConstants.LOGIN_NAME, UserInfoConstants.LOGIN_PASSWORD);
}
- public static void login(Selenium selenium, String login) {
+ public static void login(SeleniumTestBase selenium, String login) {
login(selenium, login, UserInfoConstants.LOGIN_PASSWORD);
}
- public static void login(Selenium selenium, String name, String password) {
+
+ public static void login(SeleniumTestBase seleniumTest, String name, String password)
{
+ Selenium selenium = seleniumTest.selenium;
if (isLogined(selenium)) {
logout(selenium);
}
- for (int i = 0; i < 3; i++) {
+ for (int i = 0; i < 5; i++) {
try {
selenium.click(HtmlConstants.LogInOutArea.LOGIN_ID);
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- Assert.fail("Error : " + e.getMessage());
- }
+ delay();
break;
} catch (Exception e) {
// Do nothing.
- System.out.println("RealWorldHelper.login -1- ");
+ System.out.println("RealWorldHelper.login not found '" + i
+ "'");
}
- try {
-
selenium.click("//*[@id='mainform:bodyPanel_body']/a");
- } catch (Exception e) {
- // Do nothing.
- System.out.println("RealWorldHelper.login -2- ");
- }
+ delay(10000);
+ seleniumTest.renderPage();
}
Assert.assertTrue(selenium.isVisible(HtmlConstants.LoginPanel.usernameId), "Input
for username in not visible");
@@ -238,12 +231,23 @@
selenium.click(HtmlConstants.LoginPanel.loginButtonPath);
waitForAjaxCompletion(selenium);
-// if (!isLogined(selenium, UserInfoConstants.LOGIN_NAME)) {
-// Assert.fail("Authentication was not succesfull. Logged user text should contain
typed login name");
-// }
- }
+ }
- public static void logout(Selenium selenium) {
+ private static void delay() {
+ delay(5000);
+ }
+
+ private static void delay(int delay) {
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Assert.fail("Error : " + e.getMessage());
+ }
+ }
+
+
+ public static void logout(Selenium selenium) {
selenium.click(HtmlConstants.LogInOutArea.LOGOUT_PATH);
selenium.waitForPageToLoad(String.valueOf(TIMEOUT));
Assert.assertFalse(isLogined(selenium), "Logout was not succesfull.");
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/AddUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/AddUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/AddUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -21,7 +21,7 @@
String albumName = "_album";
renderPage();
- RealWorldHelper.login(selenium, "user_for_add");
+ RealWorldHelper.login(this, "user_for_add");
selenium.click(HtmlConstants.ToolBarArea.VIEW_ALBUMS_PATH);
waitForAjaxCompletion();
Assert.assertFalse(RealWorldHelper.isAlbumPresentOnPage(selenium, albumName));
@@ -37,7 +37,7 @@
String shelfName = "_shelf";
renderPage();
- RealWorldHelper.login(selenium, "user_for_add");
+ RealWorldHelper.login(this, "user_for_add");
selenium.click(HtmlConstants.ToolBarArea.VIEW_SHELFS_PATH);
waitForAjaxCompletion();
Assert.assertFalse(RealWorldHelper.isShelfPresentOnPage(selenium, shelfName));
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DeleteUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DeleteUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DeleteUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -25,7 +25,7 @@
public void testDeleteImage() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_del");
+ RealWorldHelper.login(this, "user_for_del");
selenium.click(HtmlConstants.ToolBarArea.VIEW_IMAGES_PATH);
waitForAjaxCompletion();
@@ -41,7 +41,7 @@
public void testDeleteAlbum() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_del");
+ RealWorldHelper.login(this, "user_for_del");
selenium.click(HtmlConstants.ToolBarArea.VIEW_ALBUMS_PATH);
waitForAjaxCompletion();
@@ -55,7 +55,7 @@
public void testDeleteShelf() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_del");
+ RealWorldHelper.login(this, "user_for_del");
String shelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_NAME_PATH);
RealWorldHelper.deleteCurrentShelf(selenium);
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/DnDUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -18,7 +18,7 @@
@Test
public void testDnDAlbumFromTree() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_add");
+ RealWorldHelper.login(this, "user_for_add");
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);
@@ -43,7 +43,7 @@
@Test
public void testDnDAlbumFromPreview() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_add");
+ RealWorldHelper.login(this, "user_for_add");
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);
@@ -66,7 +66,7 @@
@Test
public void testDnDImage() {
renderPage();
- RealWorldHelper.login(selenium, "user_for_dnd");
+ RealWorldHelper.login(this, "user_for_dnd");
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);
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/EditUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/EditUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/EditUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -17,7 +17,7 @@
@Test
public void testEditShelf() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
String shelfName = selenium.getText(HtmlConstants.ShelfArea.HEADER_NAME_PATH);
String description = "New shelf description";
selenium.click(HtmlConstants.ShelfArea.EDIT_PATH);
@@ -31,7 +31,7 @@
@Test
public void testEditAlbum() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
String albumName = selenium.getText(HtmlConstants.AlbumArea.PREVIEW_PATH +
HtmlConstants.AlbumArea.PREVIEW_NAME_PATH_SUFFIX);
String description = "New album description";
RealWorldHelper.openAlbumFromPreview(selenium);
@@ -46,7 +46,7 @@
@Test
public void testEditImage() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
RealWorldHelper.openAlbumFromPreview(selenium);
String imageName = selenium.getText(HtmlConstants.ImageArea.PREVIEW_PATH +
HtmlConstants.ImageArea.PREVIEW_NAME_PATH_SUFFIX);
String description = "New image description";
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/LoginTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/LoginTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/LoginTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -21,7 +21,7 @@
public void testAuthentication() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
RealWorldHelper.logout(selenium);
}
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/OpenAreasUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/OpenAreasUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/OpenAreasUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -26,7 +26,7 @@
@Test
public void testOpenAlbumAndImageWithAuthentication() {
renderPage();
- RealWorldHelper.login(selenium, LOGIN_VIKING);
+ RealWorldHelper.login(this, LOGIN_VIKING);
RealWorldHelper.openAlbumFromPreview(selenium);
RealWorldHelper.openImageFromPreview(selenium);
}
@@ -34,7 +34,7 @@
@Test
public void testOpenUserProfile() {
renderPage();
- RealWorldHelper.login(selenium, LOGIN_VIKING);
+ RealWorldHelper.login(this, LOGIN_VIKING);
selenium.click(HtmlConstants.LogInOutArea.USER_INFO_PATH);
waitForAjaxCompletion();
RealWorldHelper.testUserProfile(selenium, LOGIN_VIKING);
@@ -43,7 +43,7 @@
@Test
public void testOpenFilesUpload() {
renderPage();
- RealWorldHelper.login(selenium, LOGIN_VIKING);
+ RealWorldHelper.login(this, LOGIN_VIKING);
selenium.click(HtmlConstants.ToolBarArea.ADD_IMAGE_PATH);
waitForAjaxCompletion();
RealWorldHelper.testFilesUpload(selenium);
@@ -53,7 +53,7 @@
@Test
public void testToolbarViewButtons() {
renderPage();
- RealWorldHelper.login(selenium, LOGIN_VIKING);
+ RealWorldHelper.login(this, LOGIN_VIKING);
selenium.click(HtmlConstants.ToolBarArea.VIEW_SHELFS_PATH);
waitForAjaxCompletion();
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/ScrollerUseCasesTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/ScrollerUseCasesTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/ScrollerUseCasesTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -18,7 +18,7 @@
@Test
public void testScroller() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
selenium.click(HtmlConstants.ToolBarArea.VIEW_IMAGES_PATH);
waitForAjaxCompletion();
RealWorldHelper.openImageFromPreview(selenium);
Modified:
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/SearchTest.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/SearchTest.java 2009-09-15
00:30:58 UTC (rev 15569)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/SearchTest.java 2009-09-15
10:16:09 UTC (rev 15570)
@@ -34,7 +34,7 @@
public void testSearch() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
selenium.click(SEARCH_OPTION);
selenium.check(OBJECTS_MY);
@@ -47,7 +47,7 @@
public void testSearchOnMyOnly() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
selenium.click(SEARCH_OPTION);
selenium.check(OBJECTS_MY);
@@ -60,7 +60,7 @@
public void testSearchOnSharedOnly() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
selenium.click(SEARCH_OPTION);
selenium.uncheck(OBJECTS_MY);
@@ -73,7 +73,7 @@
public void testSearchOnMyTags() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(this);
selenium.click(SEARCH_OPTION);
selenium.check(OBJECTS_MY);