Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ void stopTestEnvironment() {
oryHydraContainer.stop();
}

// Every screenshot these tests capture is destined for the docs, so the viewport is pinned
// rather than left at Playwright's default — a Playwright upgrade must not resize the images.
private Page newPage() {
return browser.newPage(new Browser.NewPageOptions().setViewportSize(1280, 720));
}

@BeforeEach
public void registerTestClient() {
// A unique client per test keeps tests isolated on the shared container: Hydra remembers
Expand Down Expand Up @@ -164,7 +170,7 @@ public void loginInvalidCredentials() {
val screenshotPathProducer =
ScreenshotPathProducer.builder().testName("loginInvalidCredentials").build();

val page = browser.newPage();
val page = newPage();
val initiateFlowUri = getUriToInitiateFlow();

page.navigate(initiateFlowUri.toString());
Expand Down Expand Up @@ -200,7 +206,7 @@ public void completeFullOAuthFlowUsingUIToLogin() {
val screenshotPathProducer =
ScreenshotPathProducer.builder().testName("completeFullOAuthFlowUsingUIToLogin").build();

val page = browser.newPage();
val page = newPage();

val uri = getUriToInitiateFlow();

Expand Down Expand Up @@ -240,7 +246,7 @@ public void completeFlowWithPartialScopeSelection() {
val screenshotPathProducer =
ScreenshotPathProducer.builder().testName("completeFlowWithPartialScopeSelection").build();

val page = browser.newPage();
val page = newPage();

val uri = getUriToInitiateFlow();

Expand Down Expand Up @@ -327,7 +333,7 @@ public void skipConsentScreenOnSecondLoginWhenRememberMeIsUsed() {
ScreenshotPathProducer.builder()
.testName("skipConsentScreenOnSecondLoginWhenRememberMeIsUsed")
.build();
val page = browser.newPage();
val page = newPage();

val uri = getUriToInitiateFlow();

Expand Down Expand Up @@ -390,7 +396,7 @@ public void doNotSkipConsentScreenOnSecondLoginWhenRememberMeIsFalse() {
.testName("doNotSkipConsentScreenOnSecondLoginWhenRememberMeIsFalse")
.build();

val page = browser.newPage();
val page = newPage();

val uri = getUriToInitiateFlow();

Expand Down Expand Up @@ -443,7 +449,7 @@ public void denyConsentRedirectsToClientWithAccessDeniedError() {
.testName("denyConsentRedirectsToClientWithAccessDeniedError")
.build();

val page = browser.newPage();
val page = newPage();

page.navigate(getUriToInitiateFlow().toString());
page.screenshot(screenshotPathProducer.screenshotOptionsForStepName("initial-load"));
Expand Down Expand Up @@ -476,7 +482,7 @@ public void skipLoginScreenOnSecondFlowWhenLoginRememberMeIsUsed() {
.testName("skipLoginScreenOnSecondFlowWhenLoginRememberMeIsUsed")
.build();

val page = browser.newPage();
val page = newPage();

page.navigate(getUriToInitiateFlow().toString());
page.screenshot(screenshotPathProducer.screenshotOptionsForStepName("initial-load"));
Expand Down Expand Up @@ -520,7 +526,7 @@ public void logoutEndsTheRememberedLoginSession() {
val screenshotPathProducer =
ScreenshotPathProducer.builder().testName("logoutEndsTheRememberedLoginSession").build();

val page = browser.newPage();
val page = newPage();

// First flow: log in with remember-me so a durable login session exists.
completeFullFlowWithLoginRemember(page, screenshotPathProducer);
Expand Down Expand Up @@ -555,7 +561,7 @@ public void cancellingLogoutKeepsTheSessionAlive() {
val screenshotPathProducer =
ScreenshotPathProducer.builder().testName("cancellingLogoutKeepsTheSessionAlive").build();

val page = browser.newPage();
val page = newPage();

completeFullFlowWithLoginRemember(page, screenshotPathProducer);

Expand Down Expand Up @@ -595,7 +601,7 @@ public void quickStartFromLandingPageExchangesTokensInBrowser() {
.responseTypes("code", "id_token")
.scope("offline_access", "openid", "offline", "profile"));

val page = browser.newPage();
val page = newPage();

page.navigate("http://localhost:" + springBootAppPort + "/");
page.screenshot(screenshotPathProducer.screenshotOptionsForStepName("landing-page"));
Expand Down