Skip to content

Commit af845f8

Browse files
committed
playwright: verify that isRailsApp is correct
The `isRailsApp` variable tells whether the URL in question refers to the original Rails App variant of https://git-scm.com/ or to the new Hugo/Pagefind-based site. The variable is set to true if the URL is https://git-scm.com/. However, today we tried for the first time to switch https://git-scm.com/ to the new site. Therefore, that condition would have been wrong (even as luck had it, the URL in use was a http one, not an https one, i.e. the insecure variant, and therefore `isRailsApp` was correctly set to `false`, but that was just happenstance). Let's make sure that the value of the `isRailsApp` is correct by looking for the tell-tale `<meta name="generator" content="Hugo <version>">` tag that is generated by Hugo but not by the Rails app. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4f88ad3 commit af845f8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/git-scm.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ test.afterEach(async ({ page }, testInfo) => {
2222
}
2323
})
2424

25+
test('generator is Hugo', async ({page}) => {
26+
await page.goto(url)
27+
if (isRailsApp) {
28+
await expect(page.locator('meta[name="generator"]')).toHaveCount(0)
29+
} else {
30+
await expect(page.locator('meta[name="generator"]')).toHaveAttribute('content', /^Hugo /)
31+
}
32+
})
33+
2534
async function pretendPlatform(page, browserName, userAgent, platform) {
2635
if (browserName !== 'chromium') {
2736
await page.context().addInitScript({

0 commit comments

Comments
 (0)