Skip to content

Commit bdc9b5e

Browse files
committed
playwright(book): let the tests pass on small screens
When the Playwright tests want to verify that the translated book versions can be navigated to, they assumed that the links were visible, but that is only true on "big screens". On phones, for example, the sidebar button has to be pressed first. With this change, a manual `npx playwright test` passes again. Note: This was not caught by the CI runs because they only test with Chrome (to avoid hefty downloads of the Firefox, Chromium and Webkit browsers, only Chrome is tested because it comes pre-installed on GitHub's hosted Actions runners). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 58628f3 commit bdc9b5e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/git-scm.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ test('book', async ({ page }) => {
228228
await expect(chaptersDropdown.locator('.active')).toHaveCount(1)
229229

230230
// Navigate to the French translation
231+
if (await page.evaluate(() => matchMedia('(max-width: 940px)').matches)) {
232+
// On small screens, the links to the translated versions of the ProGit book
233+
// are hidden by default, and have to be "un-hidden" by clicking on the
234+
// sidebar button first.
235+
await page.locator('.sidebar-btn').click();
236+
}
231237
await page.getByRole('link', { name: 'Français' }).click()
232238
await expect(page).toHaveURL(/book\/fr/)
233239
await expect(page.getByRole('link', { name: 'Démarrage rapide' })).toBeVisible()

0 commit comments

Comments
 (0)