import { test, expect } from '../../fixtures/multi-client'; /** * Regression coverage for: "No login screen mobile phone on startup". * * Signed-out mobile users used to be left on a logged-out /dashboard (the * startup redirect special-cased mobile + root/dashboard and kept them there), * so they were never greeted with the login screen. The fix removes that mobile * exception: signed-out visitors are sent to /login on every platform. * * The mobile viewport must be set BEFORE navigation so ViewportService reports * `isMobile === true` at app bootstrap, which is exactly when the redirect ran. */ const MOBILE_VIEWPORT = { width: 390, height: 844 }; test.describe('Mobile login screen on startup', () => { test.describe.configure({ timeout: 120_000 }); test('greets a signed-out mobile visitor on /dashboard with the login screen', async ({ createClient }) => { const { page } = await createClient(); await page.setViewportSize(MOBILE_VIEWPORT); await page.goto('/dashboard', { waitUntil: 'domcontentloaded' }); await expect(page).toHaveURL(/\/login/, { timeout: 15_000 }); await expect(page.locator('#login-username')).toBeVisible({ timeout: 15_000 }); }); test('greets a signed-out mobile visitor on the app root with the login screen', async ({ createClient }) => { const { page } = await createClient(); await page.setViewportSize(MOBILE_VIEWPORT); await page.goto('/', { waitUntil: 'domcontentloaded' }); await expect(page).toHaveURL(/\/login/, { timeout: 15_000 }); await expect(page.locator('#login-username')).toBeVisible({ timeout: 15_000 }); }); });