Skip to content

Commit 01d4b76

Browse files
committed
fix: update sidebar toggle button locator to ensure visibility at desktop widths
1 parent 2670b8f commit 01d4b76

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

e2e/console-rendering.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ test.describe('Console Rendering', () => {
7373
// If it's missing, the app may hang during bootstrap.
7474
const response = await page.request.get(`${CONSOLE_BASE}/mockServiceWorker.js`);
7575

76-
// In production builds without MSW, 404 is acceptable.
77-
// But if the build includes it, it must be valid JS.
76+
// In production builds without MSW, the asset may be absent. The static
77+
// server returns the SPA fallback (index.html) for unknown paths, which
78+
// is a 200 with `text/html`. Treat that as "MSW not bundled" and skip.
7879
if (response.ok()) {
7980
const contentType = response.headers()['content-type'] || '';
81+
if (contentType.includes('text/html')) {
82+
// SPA fallback — mockServiceWorker.js is not bundled in this build.
83+
return;
84+
}
8085
expect(contentType).toContain('javascript');
8186
}
8287
});

e2e/sidebar-text-visibility.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ test.describe('Sidebar Text Visibility', () => {
4646
const sidebar = page.locator('[data-sidebar="sidebar"]').first();
4747
await expect(sidebar).toBeVisible({ timeout: SIDEBAR_VISIBLE_TIMEOUT });
4848

49-
// Find the sidebar toggle button (desktop trigger rendered by AppShell)
50-
const toggleButton = page.locator('[data-sidebar="trigger"]').first();
49+
// Find the sidebar toggle button (desktop trigger rendered in SidebarFooter).
50+
// AppHeader also renders a mobile-only `md:hidden` trigger that is not
51+
// visible at desktop viewport widths, so filter by visibility.
52+
const toggleButton = page.locator('[data-sidebar="trigger"]:visible').first();
5153
await expect(toggleButton).toBeVisible({ timeout: SIDEBAR_VISIBLE_TIMEOUT });
5254

5355
// Get the parent sidebar element that has data-state attribute
@@ -126,7 +128,7 @@ test.describe('Sidebar Text Visibility', () => {
126128
const sidebar = page.locator('[data-sidebar="sidebar"]').first();
127129
await expect(sidebar).toBeVisible({ timeout: SIDEBAR_VISIBLE_TIMEOUT });
128130

129-
const toggleButton = page.locator('[data-sidebar="trigger"]').first();
131+
const toggleButton = page.locator('[data-sidebar="trigger"]:visible').first();
130132
await expect(toggleButton).toBeVisible({ timeout: SIDEBAR_VISIBLE_TIMEOUT });
131133

132134
const sidebarGroup = page.locator('.group[data-collapsible="icon"]').first();

0 commit comments

Comments
 (0)