Skip to content

Commit 67b751e

Browse files
committed
Fix namespace-related E2E test failures
- Update inbox/feed/watchlist URL assertions from /d/ to /user/ prefix (inbox.spec.ts, mobile-hamburger.spec.ts) - Fix strict mode violation in namespace settings rename test by using getByRole('heading') instead of ambiguous getByText (namespace-frontend.spec.ts) - Fix flaky namespace feature toggle test by reading current UI state instead of assuming API-set initial state (parallel test interference)
1 parent cbad2d0 commit 67b751e

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

e2e/tests/navigation/mobile-hamburger.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test.describe('Mobile hamburger menu', () => {
5959
const dropdown = page.locator('.fixed.inset-0.z-40');
6060
await dropdown.getByText('Inbox').click();
6161

62-
await expect(page).toHaveURL(/\/d\/inbox/, { timeout: 5000 });
62+
await expect(page).toHaveURL(/\/user\/inbox/, { timeout: 5000 });
6363
});
6464

6565
test('hamburger menu closes when clicking outside', async ({ page }) => {

e2e/tests/projects/namespace-frontend.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ test.describe('Namespace Feature Toggle', () => {
3232
test('enabling namespaces via admin features toggle', async ({ page, request }, testInfo) => {
3333
const adminToken = getAdminToken();
3434

35-
// Ensure namespaces are disabled before testing the toggle
36-
await api.disableNamespaces(request, adminToken);
37-
3835
// Navigate to the admin features page
3936
await page.goto('/admin/features');
4037
await page.waitForLoadState('networkidle');
@@ -43,7 +40,13 @@ test.describe('Namespace Feature Toggle', () => {
4340
const namespacesSection = page.locator('div').filter({ hasText: /^Namespaces/ }).first();
4441
const toggle = namespacesSection.locator('button[role="switch"]');
4542

46-
// Toggle should be off
43+
// Ensure toggle is off — if already on (parallel test enabled it), turn off via UI first
44+
if (await toggle.getAttribute('aria-checked') === 'true') {
45+
await toggle.click();
46+
await page.waitForResponse(resp =>
47+
resp.url().includes('/settings/public') && resp.status() === 200,
48+
);
49+
}
4750
await expect(toggle).toHaveAttribute('aria-checked', 'false');
4851
await attach(page, testInfo, '00-toggle-off');
4952

@@ -150,8 +153,8 @@ test.describe('Namespace Frontend UI', () => {
150153
await page.goto(`/${slug}/settings`);
151154
await page.waitForLoadState('networkidle');
152155

153-
// Should see settings page content
154-
await expect(page.getByText('Settings Test NS').or(page.getByText('Namespace Settings', { exact: false }))).toBeVisible();
156+
// Should see settings page heading
157+
await expect(page.getByRole('heading', { name: 'Namespace Settings' })).toBeVisible();
155158

156159
await attach(page, testInfo, '05-settings-page');
157160

e2e/tests/workitems/inbox.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,23 +260,23 @@ test.describe('Inbox', () => {
260260
await waitForPageReady(page);
261261

262262
// Should be on inbox page
263-
await expect(page).toHaveURL(/\/d\/inbox/);
263+
await expect(page).toHaveURL(/\/user\/inbox/);
264264

265265
// Click Feed in sidebar
266266
const sidebar = page.locator('nav.hidden.sm\\:block');
267267
await sidebar.getByText('Feed').click();
268-
await expect(page).toHaveURL(/\/d\/feed/);
268+
await expect(page).toHaveURL(/\/user\/feed/);
269269
await expect(page.getByText('Feeds coming soon')).toBeVisible();
270270

271271
// Click Watchlist in sidebar
272272
await sidebar.getByText('Watchlist').click();
273-
await expect(page).toHaveURL(/\/d\/watchlist/);
273+
await expect(page).toHaveURL(/\/user\/watchlist/);
274274
// Watchlist is now a real page — verify the heading or empty state is visible
275275
await expect(page.getByText('Watchlist').first()).toBeVisible();
276276

277277
// Click Inbox in sidebar to go back
278278
await sidebar.getByText('Inbox').click();
279-
await expect(page).toHaveURL(/\/d\/inbox/);
279+
await expect(page).toHaveURL(/\/user\/inbox/);
280280
});
281281

282282
test('sidebar collapse and expand', async ({ page }) => {
@@ -530,7 +530,7 @@ test.describe('Inbox', () => {
530530

531531
// Click back to inbox
532532
await backLink.click();
533-
await expect(page).toHaveURL(/\/d\/inbox/, { timeout: 10000 });
533+
await expect(page).toHaveURL(/\/user\/inbox/, { timeout: 10000 });
534534
});
535535

536536
test('mobile edit mode toggle shows and hides card controls', async ({ request, testUser, testProject, page }) => {

0 commit comments

Comments
 (0)