Skip to content

Commit 2fed03f

Browse files
committed
feat: regenerate README screenshots from the functional tests
Adds a refreshReadmeScreenshots task that reruns the functional suite and copies each mapped test's screenshots into docs/images, and commits the refreshed images. The previous set dated from December 2022 and predates the remember-me checkbox and the consent Deny button.
1 parent cc45518 commit 2fed03f

9 files changed

Lines changed: 32 additions & 0 deletions
4.38 KB
Loading
5.72 KB
Loading
3.04 KB
Loading
5.36 KB
Loading
6.02 KB
Loading
4.39 KB
Loading
5.41 KB
Loading
2.96 KB
Loading

reference-app/build.gradle.kts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,38 @@ tasks.withType<JavaCompile> {
4747
}
4848
}
4949

50+
// The images embedded in the README are the screenshots the functional tests capture on every
51+
// run. This task republishes them into docs/images so they can be regenerated on purpose instead
52+
// of drifting (the previous set dated from 2022). Keys are docs/images/<flow> directory names,
53+
// values the producing test's screenshot directory under build/test-results/screenshots.
54+
val readmeScreenshotFlows =
55+
mapOf(
56+
"full-oauth-flow-oidc" to "completeFullOAuthFlowUsingUIToLogin",
57+
"remember-me" to "skipConsentScreenOnSecondLoginWhenRememberMeIsUsed",
58+
)
59+
60+
tasks.register("refreshReadmeScreenshots") {
61+
group = "documentation"
62+
description = "Reruns the functional tests and copies their screenshots into docs/images."
63+
dependsOn(tasks.test)
64+
val screenshotsDir = layout.buildDirectory.dir("test-results/screenshots")
65+
val docsImagesDir =
66+
rootProject.layout.projectDirectory
67+
.dir("docs/images")
68+
.asFile
69+
doLast {
70+
readmeScreenshotFlows.forEach { (flow, testName) ->
71+
val source = screenshotsDir.get().dir(testName).asFile
72+
require(source.isDirectory && !source.listFiles().isNullOrEmpty()) {
73+
"No screenshots at $source — did the test get renamed without updating this mapping?"
74+
}
75+
val target = docsImagesDir.resolve(flow)
76+
target.deleteRecursively()
77+
source.copyRecursively(target)
78+
}
79+
}
80+
}
81+
5082
// A way to run Playwright CLI commands using the Java source dependency.
5183
// Particularly useful from within a CI context (see ./.github/workflows.gradle.yml).
5284
// https://playwright.dev/docs/cli#install-system-dependencies

0 commit comments

Comments
 (0)