51 lines
3.6 KiB
JavaScript
51 lines
3.6 KiB
JavaScript
import { chromium } from "playwright";
|
|
const BASE="http://app.localhost:3000"; const R=[];
|
|
const ck=(n,ok,d="")=>R.push(`${ok?"✓":"✗"} ${n}${d?" — "+d:""}`);
|
|
const b=await chromium.launch(); const ctx=await b.newContext({viewport:{width:1440,height:900}}); const p=await ctx.newPage();
|
|
const errs=[]; p.on("pageerror",e=>errs.push("PAGEERR: "+e.message)); p.on("console",m=>{if(m.type()==="error")errs.push("console: "+m.text().slice(0,90));});
|
|
const open=async()=>{await p.locator('[data-ui-id="ui.action.shell.more"]').click(); await p.waitForTimeout(400);};
|
|
const dash=async()=>{await p.goto(`${BASE}/e2e-readiness/dashboard`,{waitUntil:"networkidle"}); await p.waitForTimeout(400);};
|
|
await p.goto(`${BASE}/login`,{waitUntil:"domcontentloaded"});
|
|
await p.fill('input[name="email"]',"e2e.readiness@example.test"); await p.fill('input[name="password"]',"ReadinessPass123!");
|
|
await p.click('button[type="submit"]'); await p.waitForTimeout(1500); await dash();
|
|
// collapse
|
|
const sb=p.locator('[data-ui-id="ui.surface.app.sidebar"]'); const w0=(await sb.boundingBox())?.width??0;
|
|
await p.locator('[data-ui-id="ui.surface.app.sidebar"] button').first().click(); await p.waitForTimeout(450);
|
|
const w1=(await sb.boundingBox())?.width??0; ck("Collapse",w1<w0-50,`${Math.round(w0)}->${Math.round(w1)}`);
|
|
await p.locator('[data-ui-id="ui.surface.app.sidebar"] button').first().click(); await p.waitForTimeout(450);
|
|
const w2=(await sb.boundingBox())?.width??0; ck("Expand",w2>w1+50,`${Math.round(w1)}->${Math.round(w2)}`);
|
|
// search
|
|
await p.locator('[data-ui-id="ui.action.shell.search"]').click(); await p.waitForTimeout(500);
|
|
ck("Suche->Palette",await p.locator('[data-ui-id^="ui.surface.commandPalette"],[cmdk-root],[role="dialog"]').first().isVisible().catch(()=>false));
|
|
await p.keyboard.press("Escape"); await p.waitForTimeout(300);
|
|
// theme toggle (regex fix)
|
|
const hb=await p.locator("html").getAttribute("class")??""; await open();
|
|
const ti=p.getByText(/dunkl|hell|dark mode|light mode/i).first();
|
|
const tfound=await ti.isVisible().catch(()=>false); ck("Theme-Item da",tfound);
|
|
if(tfound){await ti.click(); await p.waitForTimeout(1500);}
|
|
const ha=await p.locator("html").getAttribute("class")??""; ck("Theme aendert html",hb!==ha,`"${hb}"->"${ha}"`);
|
|
// profil
|
|
await dash(); await open();
|
|
await p.locator('[data-ui-id="ui.action.shell.profile"]').click(); await p.waitForTimeout(900);
|
|
ck("Profil navigiert",/settings\/profile/.test(p.url()),p.url().replace(BASE,""));
|
|
// tenant switch
|
|
await dash(); await open();
|
|
const nest=p.getByText(/Profil ausw|Arbeitsbereich|wechseln/i).first();
|
|
if(await nest.isVisible().catch(()=>false)){await nest.click(); await p.waitForTimeout(500);
|
|
const wagner=p.getByText(/Wagner|Klein/).first();
|
|
if(await wagner.isVisible().catch(()=>false)){await wagner.click(); await p.waitForTimeout(1200); ck("Tenant-Switch",/wagner|klein/i.test(p.url()),p.url().replace(BASE,""));}
|
|
else ck("Tenant-Eintrag sichtbar",false);
|
|
} else ck("Tenant-Nested sichtbar",false);
|
|
// bell
|
|
await dash(); await p.locator('[data-ui-id="ui.action.shell.notifications"]').click(); await p.waitForTimeout(800);
|
|
ck("Glocke->Notifications",/notifications/.test(p.url()),p.url().replace(BASE,""));
|
|
// nav
|
|
await dash(); await p.locator('[data-ui-id="ui.nav.app.crm"]').first().click(); await p.waitForTimeout(800);
|
|
ck("Nav CRM",/\/crm/.test(p.url()),p.url().replace(BASE,""));
|
|
// logout LAST
|
|
await dash(); await open();
|
|
await p.locator('[data-ui-id="ui.action.shell.signOut"]').click(); await p.waitForTimeout(1500);
|
|
ck("Logout",/\/login|:3000\/?$/.test(p.url()),p.url().replace(BASE,""));
|
|
console.log(R.join("\n")); console.log("ERRORS:",errs.length);
|
|
await b.close();
|