import { expect, test } from '@playwright/test' const accounts = [ { email: 'admin@microlearn.test', home: '/admin/dashboard' }, { email: 'designer@microlearn.test', home: '/app/dashboard' }, { email: 'manager@microlearn.test', home: '/manager/overview' }, { email: 'maryam@microlearn.test', home: '/learn/home' }, ] for (const account of accounts) { test(`${account.email} signs in to its workspace and signs out`, async ({ page }) => { await page.goto('http://127.0.0.1:5173/login') await page.getByLabel(/ایمیل|Email/).fill(account.email) await page.getByLabel(/رمز عبور|Password/).fill('password') await page.getByRole('button', { name: /ورود|Sign in/ }).click() await expect(page).toHaveURL(new RegExp(account.home.replaceAll('/', '\\/'))) await page.getByRole('button', { name: /بازکردن حساب کاربری|Open account/ }).click() await page.getByRole(account.email === 'maryam@microlearn.test' ? 'button' : 'menuitem', { name: /خروج از حساب|Sign out/ }).click() await expect(page).toHaveURL(/\/login$/, { timeout: 15_000 }) }) } test('designer phase 13 surfaces are responsive and free of horizontal overflow', async ({ page }) => { await page.setViewportSize({ width: 375, height: 812 }) await page.goto('http://127.0.0.1:5173/login') await page.getByLabel(/ایمیل|Email/).fill('designer@microlearn.test') await page.getByLabel(/رمز عبور|Password/).fill('password') await page.getByRole('button', { name: /ورود|Sign in/ }).click() await expect(page).toHaveURL(/\/app\/dashboard$/) await page.goto('http://127.0.0.1:5173/app/ai-studio') await expect(page.getByRole('heading', { name: 'استودیوی هوش مصنوعی' })).toBeVisible() expect(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth)).toBe(true) await page.screenshot({ path: 'phase13-ai-studio-375.png', fullPage: true }) })