Update tests and e2e files to support locale-based routing

- Replaced static paths with dynamic locale subpaths (`/[locale]/*`) in imports, URLs, and assertions across tests.
- Updated `next-intl` mocks for improved compatibility with `locale`-aware components.
- Standardized `page.goto` and navigation tests with `/en` as the base locale for consistency.
This commit is contained in:
Felipe Cardoso
2025-11-18 23:26:10 +01:00
parent d1b47006f4
commit da021d0640
42 changed files with 296 additions and 267 deletions

View File

@@ -8,12 +8,12 @@ import { test, expect } from '@playwright/test';
test.describe('Theme Toggle on Public Pages', () => {
test.beforeEach(async ({ page }) => {
// Clear localStorage before each test
await page.goto('/login');
await page.goto('/en/login');
await page.evaluate(() => localStorage.clear());
});
test('theme is applied on login page', async ({ page }) => {
await page.goto('/login');
await page.goto('/en/login');
// Wait for page to load and theme to be applied
await page.waitForTimeout(500);
@@ -27,7 +27,7 @@ test.describe('Theme Toggle on Public Pages', () => {
});
test('theme persists across page navigation', async ({ page }) => {
await page.goto('/login');
await page.goto('/en/login');
await page.waitForTimeout(500);
// Set theme to dark via localStorage
@@ -43,14 +43,14 @@ test.describe('Theme Toggle on Public Pages', () => {
await expect(page.locator('html')).toHaveClass(/dark/);
// Navigate to register page
await page.goto('/register');
await page.goto('/en/register');
await page.waitForTimeout(500);
// Theme should still be dark
await expect(page.locator('html')).toHaveClass(/dark/);
// Navigate to password reset
await page.goto('/password-reset');
await page.goto('/en/password-reset');
await page.waitForTimeout(500);
// Theme should still be dark
@@ -58,7 +58,7 @@ test.describe('Theme Toggle on Public Pages', () => {
});
test('can switch theme programmatically', async ({ page }) => {
await page.goto('/login');
await page.goto('/en/login');
// Set to light theme
await page.evaluate(() => {