Skip to content

Commit

Permalink
reflect review comment RedirectTest.java #605
Browse files Browse the repository at this point in the history
  • Loading branch information
btyanagawamg committed Mar 2, 2017
1 parent 7d58429 commit 9ef5d85
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public void test01_02_hiddenRedirectToNotDefined() {
@Test
public void test01_03_redirectToExternalLink() {

ApServerName apServerName = webDriverOperations.getApServerName();

driver.findElement(By.id("listWithExternalPath")).click();
driver.findElement(By.id("btn1")).click();

Expand All @@ -103,22 +105,21 @@ public void test01_03_redirectToExternalLink() {
// screen capture
screenCapture.save(driver);

ApServerName apServerName = webDriverOperations.getApServerName();
String apServerVersion = webDriverOperations.getApServerVersion();

driver.findElement(By.id("btn1")).click();

String expectedErrorMessage;

// Unlike other application servers, WebSphere Liberty Profile 16 & WebSphere traditional 9 wraps an unexpected exception of ServletException.
// So the expected error page is different.
// confirms that 404 error occurred after login transition
if (apServerName == ApServerName.WEBSPHERELP && "16".equals(apServerVersion)
|| apServerName == ApServerName.WEBSPHERETR && "9".equals(apServerVersion)) {
assertThat(driver.findElement(By.xpath("/html/body/div/h2")).getText(),
is("System Error..."));
if (apServerName == ApServerName.WEBSPHERELP || apServerName == ApServerName.WEBSPHERETR) {
expectedErrorMessage = "System Error...";
} else {
assertThat(driver.findElement(By.xpath("/html/body/div/h2")).getText(),
is("Page Not Found"));
expectedErrorMessage = "Page Not Found";
}

// confirms that 404 error occurred after login transition
assertThat(driver.findElement(By.xpath("/html/body/div/h2")).getText(),
is(expectedErrorMessage));
}

@Test
Expand Down

0 comments on commit 9ef5d85

Please sign in to comment.