Skip to content

Commit

Permalink
devide assertion whether application server is WAS or not in redirect…
Browse files Browse the repository at this point in the history
… test #605
  • Loading branch information
btyanagawamg committed Mar 1, 2017
1 parent c184140 commit c6534e9
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=interstage
application.server.version=11
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=jboss
application.server.version=6
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=jboss
application.server.version=7
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=7
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=7
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=8.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=8.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=8.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=tomcat
application.server.version=8.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=weblogic
application.server.version=12
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
application.server.name=webotx
application.server.version=9
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=System Error...
application.server.name=webspherelp
application.server.version=16
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=System Error...
application.server.name=webspheretr
application.server.version=9
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
app.redirect.allowed.externalUrl=http://terasolunaorg.github.io
app.redirect.pageTitle.404Error=Page Not Found
## application server name and version properties are used in order to
## change the assertions in test which depends on application server.
## when the new profile is added, set appropriate values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.terasoluna.gfw.functionaltest.app.ApServerName;
import org.terasoluna.gfw.functionaltest.app.FunctionTestSupport;

@RunWith(SpringJUnit4ClassRunner.class)
Expand All @@ -34,9 +35,6 @@ public class RedirectTest extends FunctionTestSupport {
@Value("${app.redirect.allowed.externalUrl}")
String redirectionAllowedExternalUrl;

@Value("${app.redirect.pageTitle.404Error}")
String pageTitle404Error;

@Test
public void test01_01_redirectToValidInternalLink() {

Expand Down Expand Up @@ -107,10 +105,21 @@ public void test01_03_redirectToExternalLink() {

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

// confirms that 404 error occurred after login transition
assertThat(driver.findElement(By.xpath("/html/body/div/h2")).getText(),
is(pageTitle404Error));
ApServerName apServerName = webDriverOperations.getApServerName();

String apServerVersion = webDriverOperations.getApServerVersion();

// Unlike other application servers, Webspherelp16 & Webspheretr9 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..."));
} else {
assertThat(driver.findElement(By.xpath("/html/body/div/h2")).getText(),
is("Page Not Found"));
}
}

@Test
Expand Down

0 comments on commit c6534e9

Please sign in to comment.