Author: Alex.Kolonitsky
Date: 2009-09-11 13:19:52 -0400 (Fri, 11 Sep 2009)
New Revision: 15545
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/OpenAreasUseCasesTest.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-11
15:02:59 UTC (rev 15544)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/RealWorldHelper.java 2009-09-11
17:19:52 UTC (rev 15545)
@@ -200,13 +200,25 @@
if (isLogined(selenium)) {
logout(selenium);
}
- selenium.click(HtmlConstants.LogInOutArea.LOGIN_ID);
- try {
- Thread.sleep(5000);
- }catch (Exception e) {
- Assert.fail("Test failed caused by: " + e);
- }
+ for (int i = 0; i < 3; i++) {
+ if (selenium.getXpathCount(HtmlConstants.LogInOutArea.LOGIN_ID).intValue()
> 0) {
+ selenium.click(HtmlConstants.LogInOutArea.LOGIN_ID);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Assert.fail("Error : " + e.getMessage());
+ }
+ break;
+ }
+
+ String photoalbumPath =
"//*[@id='mainform:bodyPanel_body']/a";
+ if (selenium.getXpathCount(photoalbumPath).intValue() > 0) {
+ selenium.click(photoalbumPath);
+ }
+ }
+
Assert.assertTrue(selenium.isVisible(HtmlConstants.LoginPanel.usernameId), "Input
for username in not visible");
Assert.assertTrue(selenium.isVisible(HtmlConstants.LoginPanel.passwordId), "Input
for password in not visible");
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-11
15:02:59 UTC (rev 15544)
+++
branches/community/3.3.X/examples/photoalbum/tests/src/test/java/org/richfaces/photoalbum/testng/OpenAreasUseCasesTest.java 2009-09-11
17:19:52 UTC (rev 15545)
@@ -25,7 +25,7 @@
@Test
public void testOpenAlbumAndImageWithAuthentication() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(selenium, "Viking");
RealWorldHelper.openAlbumFromPreview(selenium);
RealWorldHelper.openImageFromPreview(selenium);
}
@@ -33,7 +33,7 @@
@Test
public void testOpenUserProfile() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(selenium, "Viking");
selenium.click(HtmlConstants.LogInOutArea.USER_INFO_PATH);
waitForAjaxCompletion();
RealWorldHelper.testUserProfile(selenium, UserInfoConstants.LOGIN_NAME);
@@ -42,7 +42,7 @@
@Test
public void testOpenFilesUpload() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(selenium, "Viking");
selenium.click(HtmlConstants.ToolBarArea.ADD_IMAGE_PATH);
waitForAjaxCompletion();
RealWorldHelper.testFilesUpload(selenium);
@@ -52,7 +52,7 @@
@Test
public void testToolbarViewButtons() {
renderPage();
- RealWorldHelper.login(selenium);
+ RealWorldHelper.login(selenium, "Viking");
selenium.click(HtmlConstants.ToolBarArea.VIEW_SHELFS_PATH);
waitForAjaxCompletion();