22 lines
2.0 KiB
JavaScript
22 lines
2.0 KiB
JavaScript
const {chromium}=require('playwright');
|
|
const fs=require('node:fs');const os=require('node:os');const path=require('node:path');const assert=require('node:assert/strict');
|
|
(async()=>{
|
|
const fixture=path.join(os.tmpdir(),'pd-paragraph-review-fixture.html');
|
|
assert.ok(fs.existsSync(fixture),'First run dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --paragraph-view');
|
|
const browser=await chromium.launch();try{
|
|
const page=await browser.newPage();const failures=[];page.on('pageerror',e=>failures.push(e.message));
|
|
await page.setContent(fs.readFileSync(fixture,'utf8'));
|
|
assert.equal(await page.locator('article').count(),100,'actual compiled view bounds paragraph pagination');
|
|
assert.equal(await page.locator('script').count(),0,'manuscript markup must remain encoded text');
|
|
assert.equal(await page.locator('select[name="eventKey"] option').first().getAttribute('value'),'Knowledge:9','event kind and ID travel together');
|
|
for(const name of ['Synchronise from Word','Cancel pending snapshot','Refresh saved snapshot'])assert.equal(await page.getByRole(name==='Refresh saved snapshot'?'link':'button',{name,exact:true}).count(),1);
|
|
for(const form of await page.locator('form[method="post"]').all()){
|
|
assert.equal(await form.locator('input[name="__RequestVerificationToken"]').count(),1,'every mutation form has antiforgery');
|
|
assert.match(await form.getAttribute('action'),/^\/manuscript\/paragraphs\/(enable|snapshot|cancel|change)$/,'actions use the existing authorised controller');
|
|
}
|
|
assert.doesNotMatch(await page.locator('body').innerText(),/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i,'opaque identities are hidden inputs, never author labels');
|
|
assert.deepEqual(failures,[]);
|
|
console.log('PASS actual compiled paragraph workspace DOM: bounded results, functional scoped form actions, typed evidence choice, encoded prose and antiforgery; shared-shell/Windows visual qualification not claimed');
|
|
}finally{await browser.close();}
|
|
})().catch(e=>{console.error(e);process.exit(1)});
|