mirror of
https://github.com/cloud-shuttle/leptos-shadcn-ui.git
synced 2025-12-27 08:09:59 +00:00
fix: Improve sidebar toggle test logic to handle initial state
- Check initial sidebar visibility state before toggling - Test that sidebar state actually changes after toggle click - Handle both cases: sidebar initially visible or hidden - This should fix the remaining sidebar toggle test failure
This commit is contained in:
@@ -210,12 +210,19 @@ test.describe('Comprehensive Dashboard Demo E2E Tests', () => {
|
|||||||
const sidebarToggle = page.locator('button:has-text("☰")');
|
const sidebarToggle = page.locator('button:has-text("☰")');
|
||||||
await expect(sidebarToggle).toBeVisible();
|
await expect(sidebarToggle).toBeVisible();
|
||||||
|
|
||||||
|
// Check initial sidebar state
|
||||||
|
const sidebar = page.locator('div.w-64.bg-card.border-r.border-border');
|
||||||
|
const isInitiallyVisible = await sidebar.isVisible();
|
||||||
|
|
||||||
// Click sidebar toggle
|
// Click sidebar toggle
|
||||||
await sidebarToggle.click();
|
await sidebarToggle.click();
|
||||||
|
|
||||||
// Check that sidebar is hidden/shown
|
// Check that sidebar state changed
|
||||||
const sidebar = page.locator('div.w-64.bg-card.border-r.border-border');
|
if (isInitiallyVisible) {
|
||||||
|
await expect(sidebar).not.toBeVisible();
|
||||||
|
} else {
|
||||||
await expect(sidebar).toBeVisible();
|
await expect(sidebar).toBeVisible();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user