test(qa): verify native Kingbase restore migration and fusion workflows
This commit is contained in:
1 parent
ba5dc7a6af
commit
6e73d34561
23 files changed
+1103
-31
No files matched your search
@@ -0,0 +1,41 @@
|
||||
async (page) => {
|
||||
if (!page.__qaEvidence) throw new Error('Run the protected Chrome login driver first');
|
||||
const blockedHosts=new Set(),requestHosts=new Set();
|
||||
// Real pages/API only; never substitute responses or allow a stored photo URL to contact a device service.
|
||||
await page.route('**/*',async route=>{
|
||||
const url=route.request().url(),host=url.match(/^https?:\/\/([^/]+)/)?.[1];
|
||||
if(host)requestHosts.add(host);
|
||||
if(host&&host!=='127.0.0.1:18088'){blockedHosts.add(host);await route.abort('blockedbyclient');}
|
||||
else await route.continue();
|
||||
});
|
||||
const routes = [
|
||||
['/index', null], ['/person/student', 'Student'], ['/person/teacher', null],
|
||||
['/coursemgr/plan', null], ['/equip/dormitory', null], ['/equip/accommodation', 'Accommodation'],
|
||||
...Object.entries({group:'Group',gateway:'Gateway',device:'Device',face:'Face',auth:'Auth',
|
||||
accesslog:'AccessLog',command:'Command',mqttlog:'MqttLog',config:'ServiceConfig'}).map(([r,c])=>['/iot/'+r,c])
|
||||
];
|
||||
const results=[];
|
||||
for (const [path,expected] of routes) {
|
||||
const start=page.__qaEvidence.responses.length;
|
||||
await page.goto('http://127.0.0.1:18088'+path);
|
||||
await page.waitForLoadState('networkidle');
|
||||
const components=await page.locator('.app-main').evaluate(e=>{
|
||||
function names(v){return v?[v.$options.name||v.$options._componentTag||'',...v.$children.flatMap(names)]:[];}
|
||||
return names(e.__vue__).filter(n=>n&&!n.startsWith('El'));
|
||||
});
|
||||
const api=[...new Map(page.__qaEvidence.responses.slice(start).map(r=>[JSON.stringify(r),r])).values()];
|
||||
const tables=await page.locator('.app-main .el-table').count();
|
||||
const pass=page.url()==='http://127.0.0.1:18088'+path&&
|
||||
(await page.title()).includes('SYFJGYD')&&(!expected||components.includes(expected))&&
|
||||
!components.some(n=>/404|401|ErrorPage/i.test(n))&&api.length>0&&
|
||||
api.every(r=>r.status===200&&(r.code==null||r.code===200))&&page.__qaEvidence.errors.length===0&&blockedHosts.size===0&&
|
||||
(path==='/index'?await page.locator('canvas').count()===4:tables>0);
|
||||
results.push({path,pass,components:[...new Set(components)],tables,api});
|
||||
if(!pass)throw new Error('Actual component/API regression failed: '+JSON.stringify(results.at(-1)));
|
||||
if(path==='/index')await page.screenshot({path:'output/playwright/round5v4-home-final.png',fullPage:true});
|
||||
if(path.startsWith('/iot/'))await page.screenshot({path:'output/playwright/round5v4-'+path.split('/').at(-1)+'-headers.png',
|
||||
mask:[page.locator('.el-table__body-wrapper'),page.locator('.avatar-container')]});
|
||||
}
|
||||
return {pass:true,chrome:page.context().browser().version(),results,errors:page.__qaEvidence.errors,
|
||||
requestHosts:[...requestHosts],blockedExternalHosts:[...blockedHosts]};
|
||||
}
|
||||
Reference in new issue
Block a user