feat(auth): add end-to-end tests for sidebar layout and theme persist…#41
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new Playwright E2E coverage around the authenticated app shell: verifying key sidebar/user-menu affordances exist and that user-selected theme preferences persist correctly across page loads using client storage and cookies.
Changes:
- Introduces sidebar layout smoke tests (tenant switcher visibility; language/theme selectors available and open submenus).
- Adds theme persistence tests for dark/light/system modes and validates storage/cookie persistence behavior.
- Verifies theme state is written to an expected localStorage key and cookie.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+56
to
+58
| // Navigate to another page and back — server should render class="dark" from cookie | ||
| await page.goto(page.url()); | ||
|
|
|
|
||
| await expect(page.locator('html')).not.toHaveClass(/dark/); | ||
|
|
||
| await page.goto(page.url()); |
| await expect(page.locator('html')).not.toHaveClass(/dark/); | ||
| }); | ||
|
|
||
| test('system preference dark mode applied before hydration', async ({ page, credentials, loginAs }) => { |
Comment on lines
+110
to
+114
| await page.waitForFunction(() => document.cookie.includes('appearance=dark')); | ||
|
|
||
| const cookies = await page.context().cookies(); | ||
| const appearanceCookie = cookies.find((c) => c.name === 'appearance'); | ||
| expect(appearanceCookie?.value).toBe('dark'); |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds comprehensive end-to-end tests for the sidebar layout and theme persistence features. The new tests ensure that key UI elements (like the tenant switcher and user menu selectors) are present and functional, and that theme selection (dark/light/system) persists correctly across navigation and between client and server.
Sidebar layout tests:
Theme persistence tests:
appearance) and cookie are used for theme persistence.