generated from freeCodeCamp/template
-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb1e9f4
commit 3b3fa55
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const legacyRoutes = [ | ||
{ from: '/#/how-to-translate-files', to: '/how-to-translate-files/' }, | ||
{ from: '/#/how-to-setup-wsl', to: '/how-to-setup-wsl/' }, | ||
{ | ||
from: '/#/how-to-setup-freecodecamp-locally', | ||
to: '/how-to-setup-freecodecamp-locally/' | ||
}, | ||
{ from: '/#/devops', to: '/devops/' }, | ||
{ | ||
from: '/#/how-to-add-playwright-tests', | ||
to: '/how-to-add-playwright-tests/' | ||
} | ||
]; | ||
|
||
test.describe('Legacy URL redirects', () => { | ||
for (const route of legacyRoutes) { | ||
test(`should redirect ${route.from} to ${route.to}`, async ({ page }) => { | ||
await page.goto(route.from); | ||
await expect(page).toHaveURL(route.to); | ||
}); | ||
} | ||
|
||
test('should handle query parameters in legacy URLs', async ({ page }) => { | ||
await page.goto( | ||
'/#/how-to-add-playwright-tests?id=run-the-playwright-tests' | ||
); | ||
await expect(page).toHaveURL( | ||
'/how-to-add-playwright-tests/#run-the-playwright-tests' | ||
); | ||
}); | ||
}); |