refactor(e2e): test urls can have trailing slashes (#58283)

This commit is contained in:
Oliver Eyton-Williams
2025-01-24 00:04:35 +01:00
committed by GitHub
parent 4eef3854c7
commit 8a852719f1
9 changed files with 24 additions and 11 deletions
+5 -2
View File
@@ -3,6 +3,7 @@ import { test, expect, type Page } from '@playwright/test';
import { addGrowthbookCookie } from './utils/add-growthbook-cookie';
import { clearEditor, focusEditor } from './utils/editor';
import { allowTrailingSlash } from './utils/url';
const slowExpect = expect.configure({ timeout: 25000 });
@@ -22,7 +23,9 @@ const completeFrontEndCert = async (page: Page, number?: number) => {
const loopNumber = number || projects.length;
for (let i = 0; i < loopNumber; i++) {
await page.waitForURL(
`/learn/front-end-development-libraries/front-end-development-libraries-projects/build-a-${projects[i]}`
allowTrailingSlash(
`/learn/front-end-development-libraries/front-end-development-libraries-projects/build-a-${projects[i]}`
)
);
await page
.getByRole('textbox', { name: 'solution' })
@@ -92,7 +95,7 @@ const completeChallenges = async ({
}) => {
await page.goto(challenges[0].url);
for (const challenge of challenges.slice(0, number)) {
await page.waitForURL(challenge.url);
await page.waitForURL(allowTrailingSlash(challenge.url));
await focusEditor({ page, isMobile });
await clearEditor({ page, browserName });
await page.evaluate(