Polish SAML2 tests
This commit is contained in:
parent
65d4b2ec4b
commit
9f6b38bf33
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
package example;
|
package example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
||||||
import com.gargoylesoftware.htmlunit.WebClient;
|
import com.gargoylesoftware.htmlunit.WebClient;
|
||||||
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
||||||
|
@ -78,7 +81,20 @@ public class Saml2JavaConfigurationITests {
|
||||||
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
||||||
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
||||||
HtmlPage loginPage = rpLogoutButton.click();
|
HtmlPage loginPage = rpLogoutButton.click();
|
||||||
assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
|
this.webClient.waitForBackgroundJavaScript(10000);
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
urls.add(loginPage.getUrl().getFile());
|
||||||
|
urls.add(((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).getUrl().getFile());
|
||||||
|
assertThat(urls).withFailMessage(() -> {
|
||||||
|
// @formatter:off
|
||||||
|
String builder = loginPage.asXml()
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ "Enclosing Page"
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ ((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).asXml();
|
||||||
|
// @formatter:on
|
||||||
|
return builder;
|
||||||
|
}).contains("/login?logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performLogin() throws Exception {
|
private void performLogin() throws Exception {
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
package example;
|
package example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
||||||
import com.gargoylesoftware.htmlunit.WebClient;
|
import com.gargoylesoftware.htmlunit.WebClient;
|
||||||
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
||||||
|
@ -62,7 +65,20 @@ public class Saml2LoginApplicationITests {
|
||||||
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
||||||
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
||||||
HtmlPage loginPage = rpLogoutButton.click();
|
HtmlPage loginPage = rpLogoutButton.click();
|
||||||
assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
|
this.webClient.waitForBackgroundJavaScript(10000);
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
urls.add(loginPage.getUrl().getFile());
|
||||||
|
urls.add(((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).getUrl().getFile());
|
||||||
|
assertThat(urls).withFailMessage(() -> {
|
||||||
|
// @formatter:off
|
||||||
|
String builder = loginPage.asXml()
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ "Enclosing Page"
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ ((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).asXml();
|
||||||
|
// @formatter:on
|
||||||
|
return builder;
|
||||||
|
}).contains("/login?logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performLogin() throws Exception {
|
private void performLogin() throws Exception {
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
package example;
|
package example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
||||||
import com.gargoylesoftware.htmlunit.WebClient;
|
import com.gargoylesoftware.htmlunit.WebClient;
|
||||||
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
||||||
|
@ -62,7 +65,20 @@ public class Saml2LoginApplicationITests {
|
||||||
HtmlPage home = (HtmlPage) Saml2LoginApplicationITests.this.webClient.getCurrentWindow().getEnclosedPage();
|
HtmlPage home = (HtmlPage) Saml2LoginApplicationITests.this.webClient.getCurrentWindow().getEnclosedPage();
|
||||||
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
||||||
HtmlPage loginPage = rpLogoutButton.click();
|
HtmlPage loginPage = rpLogoutButton.click();
|
||||||
assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
|
this.webClient.waitForBackgroundJavaScript(10000);
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
urls.add(loginPage.getUrl().getFile());
|
||||||
|
urls.add(((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).getUrl().getFile());
|
||||||
|
assertThat(urls).withFailMessage(() -> {
|
||||||
|
// @formatter:off
|
||||||
|
String builder = loginPage.asXml()
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ "Enclosing Page"
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ ((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).asXml();
|
||||||
|
// @formatter:on
|
||||||
|
return builder;
|
||||||
|
}).contains("/login?logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performLogin() throws Exception {
|
private void performLogin() throws Exception {
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
package example;
|
package example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
|
||||||
import com.gargoylesoftware.htmlunit.WebClient;
|
import com.gargoylesoftware.htmlunit.WebClient;
|
||||||
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
import com.gargoylesoftware.htmlunit.html.HtmlElement;
|
||||||
|
@ -79,7 +82,20 @@ public class Saml2XmlITests {
|
||||||
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
HtmlPage home = (HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage();
|
||||||
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
HtmlElement rpLogoutButton = home.getHtmlElementById("rp_logout_button");
|
||||||
HtmlPage loginPage = rpLogoutButton.click();
|
HtmlPage loginPage = rpLogoutButton.click();
|
||||||
assertThat(loginPage.getUrl().getFile()).isEqualTo("/login?logout");
|
this.webClient.waitForBackgroundJavaScript(10000);
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
urls.add(loginPage.getUrl().getFile());
|
||||||
|
urls.add(((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).getUrl().getFile());
|
||||||
|
assertThat(urls).withFailMessage(() -> {
|
||||||
|
// @formatter:off
|
||||||
|
String builder = loginPage.asXml()
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ "Enclosing Page"
|
||||||
|
+ "\n\n\n"
|
||||||
|
+ ((HtmlPage) this.webClient.getCurrentWindow().getEnclosedPage()).asXml();
|
||||||
|
// @formatter:on
|
||||||
|
return builder;
|
||||||
|
}).contains("/login?logout");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performLogin() throws Exception {
|
private void performLogin() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue