6 lines
1.0 KiB
JavaScript
6 lines
1.0 KiB
JavaScript
const{chromium}=require('playwright'),fs=require('node:fs'),assert=require('node:assert/strict');
|
|
(async()=>{const b=await chromium.launch();try{const c=await b.newContext(),p=await c.newPage(),snapshot={};for(const path of ['/','/features','/pricing','/help','/about','/contact','/privacy','/terms','/Account/Login','/Account/Register']){
|
|
await p.goto('https://dev.plotdirector.com'+path);
|
|
snapshot[path]={text:await p.locator('main').innerText(),canonical:(await p.locator('link[rel=canonical]').count())?await p.locator('link[rel=canonical]').getAttribute('href'):null,actions:await p.locator('main a').evaluateAll(es=>es.map(e=>({text:e.textContent.trim(),href:e.getAttribute('href')})))};
|
|
}fs.writeFileSync(process.argv[2],JSON.stringify(snapshot,null,2));if(process.argv[3]){assert.deepEqual(snapshot,JSON.parse(fs.readFileSync(process.argv[3])));console.log('PASS ten live public pages retain substantive text, prices, link destinations and canonicals.');}}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
|