feat(auth): add recovery UI and stable viewport login interactions
This commit is contained in:
@@ -38,14 +38,19 @@ const assert=require('node:assert/strict');
|
||||
const accountSections=await page.locator('#account-content > div > section').evaluateAll(elements=>elements.map(el=>{const r=el.getBoundingClientRect();return {x:r.x,right:r.right,width:r.width}}));
|
||||
assert.equal(accountSections.length,2);
|
||||
assert.ok(accountSections[0].right<=accountSections[1].x,'Brand panel and credentials occupy separate columns');
|
||||
const accountFits=async()=>assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+1&&document.documentElement.scrollHeight<=innerHeight+1),'Account document fits both viewport axes');
|
||||
const accountControlsFit=async()=>assert.ok(await page.locator('#account-content input, #account-content button[type="submit"]').evaluateAll(elements=>elements.every(el=>{const r=el.getBoundingClientRect();return r.left>=0&&r.right<=innerWidth&&r.top>=0&&r.bottom<=innerHeight})),'Account inputs and submit button remain visible, not merely clipped');
|
||||
await accountFits();await accountControlsFit();
|
||||
await page.screenshot({path:dir+'/account-desktop.png',fullPage:true});
|
||||
await page.getByRole('button',{name:'创建账户',exact:true}).click();
|
||||
await page.getByRole('heading',{name:'创建你的账户',exact:true}).waitFor();
|
||||
await page.screenshot({path:dir+'/account-register.png',fullPage:true});
|
||||
await page.getByRole('button',{name:'登录',exact:true}).click();
|
||||
await page.setViewportSize({width:390,height:844});
|
||||
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),'Mobile account page must not overflow horizontally');
|
||||
await accountFits();await accountControlsFit();
|
||||
await page.screenshot({path:dir+'/account-mobile.png',fullPage:true});
|
||||
await page.setViewportSize({width:320,height:568});await accountFits();await accountControlsFit();
|
||||
await page.screenshot({path:dir+'/account-mobile-compact.png',fullPage:true});
|
||||
await page.setViewportSize({width:1100,height:1000});
|
||||
await page.goto(base+'/graphic',{waitUntil:'networkidle'});
|
||||
assert.equal(new URL(page.url()).pathname,'/graphic');
|
||||
|
||||
Reference in New Issue
Block a user