Add backend unit/integration tests, Playwright e2e tests, README, cookie Secure fix
SonarQube Analysis / sonarqube (push) Successful in 4m20s
SonarQube Analysis / sonarqube (push) Successful in 4m20s
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Theme switching', () => {
|
||||
test('toggling the switch changes the body theme attribute', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
const body = page.locator('body');
|
||||
const initial = await body.getAttribute('data-theme');
|
||||
|
||||
await page.getByRole('switch').click();
|
||||
|
||||
await expect(async () => {
|
||||
const updated = await body.getAttribute('data-theme');
|
||||
expect(updated).not.toBe(initial);
|
||||
}).toPass();
|
||||
});
|
||||
|
||||
test('theme preference persists across a reload', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await page.getByRole('switch').click();
|
||||
const chosen = await page.locator('body').getAttribute('data-theme');
|
||||
|
||||
await page.reload();
|
||||
await expect(page.locator('body')).toHaveAttribute('data-theme', chosen || '');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user