test: cover oikos kitchen edge flows
This commit is contained in:
@@ -141,6 +141,42 @@ function makeDiagnostics(page) {
|
|||||||
return diagnostics;
|
return diagnostics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test.describe('Oikos route guards and responsive edge coverage', () => {
|
||||||
|
test('Protected kitchen routes send anonymous users to login instead of leaking a blank app', async ({ page }) => {
|
||||||
|
for (const route of ['/', '/meals', '/shopping']) {
|
||||||
|
await page.context().clearCookies();
|
||||||
|
await page.goto(route, { waitUntil: 'domcontentloaded' });
|
||||||
|
await expect(page.locator('#login-form')).toBeVisible({ timeout: 10_000 });
|
||||||
|
await expect(page.locator('#username')).toBeVisible();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Kitchen/Studio works at mobile edge width without horizontal overflow', async ({ page }, testInfo) => {
|
||||||
|
const diagnostics = makeDiagnostics(page);
|
||||||
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
|
await page.addInitScript(() => localStorage.setItem('oikos-onboarded', '1'));
|
||||||
|
await login(page);
|
||||||
|
await page.goto('/meals', { waitUntil: 'domcontentloaded' });
|
||||||
|
await dismissOnboardingIfPresent(page);
|
||||||
|
|
||||||
|
const studioHost = page.locator('[data-oikos-meal-plan-studio]');
|
||||||
|
await expect(studioHost).toBeVisible({ timeout: 15_000 });
|
||||||
|
await expect(studioHost).toContainText(/Meal Plan Studio|Børnenes madplan/i);
|
||||||
|
await expect(page.getByRole('button', { name: /Generér ugeplan|Regenerér|Meal Plan Studio/i }).first()).toBeVisible();
|
||||||
|
|
||||||
|
const overflow = await page.evaluate(() => ({
|
||||||
|
innerWidth: window.innerWidth,
|
||||||
|
scrollWidth: document.documentElement.scrollWidth,
|
||||||
|
bodyScrollWidth: document.body.scrollWidth,
|
||||||
|
}));
|
||||||
|
diagnostics.mobileOverflow = overflow;
|
||||||
|
await attachDiagnostics(testInfo, diagnostics);
|
||||||
|
|
||||||
|
expect(overflow.scrollWidth, `mobile page should not cause sideways scrolling: ${JSON.stringify(overflow)}`).toBeLessThanOrEqual(overflow.innerWidth + 12);
|
||||||
|
expect(diagnostics.pageErrors, 'No browser page errors during mobile Kitchen smoke').toEqual([]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test.describe('Oikos Kitchen + Assist meal-planning flow', () => {
|
test.describe('Oikos Kitchen + Assist meal-planning flow', () => {
|
||||||
test('Kitchen opens quickly, Studio is present, and Assist routes meal plans into Studio', async ({ page }, testInfo) => {
|
test('Kitchen opens quickly, Studio is present, and Assist routes meal plans into Studio', async ({ page }, testInfo) => {
|
||||||
const diagnostics = makeDiagnostics(page);
|
const diagnostics = makeDiagnostics(page);
|
||||||
|
|||||||
Reference in New Issue
Block a user