Skip to content

Commit

Permalink
playwright(book): let the tests pass on small screens
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 1, 2024
1 parent 58628f3 commit bdc9b5e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/git-scm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ test('book', async ({ page }) => {
await expect(chaptersDropdown.locator('.active')).toHaveCount(1)

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

0 comments on commit bdc9b5e

Please sign in to comment.