6 lines
4.7 KiB
JavaScript
6 lines
4.7 KiB
JavaScript
// Installed Chromium PWA, real Development endpoints, dedicated fixture only. Read/navigation checks.
|
|
const{chromium}=require('playwright'),fs=require('fs'),assert=require('node:assert/strict');const base='https://dev.plotdirector.com',file=process.argv[2],out='/tmp/pd-refinements-evidence';if(!file?.startsWith('/tmp/pd-dev-browser-'))throw Error('Dedicated private identity required');const identity=JSON.parse(fs.readFileSync(file));assert.equal(identity.Database,'PlotDirector_Development');assert(identity.Email.startsWith('pwa-browser-')&&identity.RefinementFixture);
|
|
(async()=>{const profile=fs.mkdtempSync('/tmp/pd-refinements-dev-pwa-'),context=await chromium.launchPersistentContext(profile,{headless:false,viewport:{width:1440,height:1000}}),cdp=await context.browser().newBrowserCDPSession(),manifestId=base+'/Projects';try{const tab=context.pages()[0];await tab.goto(base+'/Account/Login');await tab.locator('[name=Email]').fill(identity.Email);await tab.locator('[name=Password]').fill(identity.Password);await tab.locator('form button[type=submit]').click();await tab.waitForURL(base+'/Projects');await cdp.send('PWA.install',{manifestId,installUrlOrBundleUrl:base+'/Projects'});await cdp.send('PWA.changeAppUserSettings',{manifestId,displayMode:'standalone'});const opened=context.waitForEvent('page');await cdp.send('PWA.launch',{manifestId,url:base+`/Locations?projectId=${identity.ProjectID}`});const page=await opened;await page.waitForLoadState();assert(await page.evaluate(()=>matchMedia('(display-mode: standalone)').matches));await page.locator('[data-location-records][aria-busy=false]').waitFor();const q=`projectId=${identity.ProjectID}`,response=await page.request.get(base+`/LocationWorkspace/Directory?${q}`),data=await response.json();assert.equal(response.status(),200);assert.equal(data.taxonomy.length,105);assert.equal(data.types.length,97);assert(data.types.every(t=>t.value!==''));const north=identity.RefinementFixture.north;await page.locator(`[data-location-id="${north}"] [data-location-name]`).click();await page.locator('[data-details]').getByRole('button',{name:'Location type',exact:true}).click();let dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search location types'}).fill('Office');assert.equal(await dialog.getByRole('button',{name:'Office',exact:true}).count(),2);await page.screenshot({path:out+'/development-pwa-type-picker.png'});await dialog.getByRole('button',{name:'Cancel',exact:true}).click();await page.getByRole('button',{name:'Change parent',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Old ledger lodging');assert(await dialog.locator(`[data-picker-id="${identity.RefinementFixture.home}"]`).count());await page.screenshot({path:out+'/development-pwa-location-picker.png'});await dialog.locator('[data-dialog-cancel]').click();await page.locator('[data-value="@premises"] .pd-attribute-expand').click();const residential=data.taxonomy.find(t=>t.key==='residential').value;await page.locator(`[data-attribute=type][data-value="${residential}"] .pd-attribute-expand`).click();await page.getByRole('button',{name:'Cards',exact:true}).click();await page.screenshot({path:out+'/development-pwa-locations.png'});const before=context.pages().length;await page.locator('[data-details]').getByRole('link',{name:'Full details',exact:true}).click();await page.waitForURL(/\/Locations\/Details\/\d+/);assert.equal(context.pages().length,before);
|
|
await page.goto(base+`/Characters?${q}`);await page.locator('[data-attribute=importance]').first().waitFor();assert.equal(await page.locator('.character-card').count(),2);assert((await page.locator('.character-card').first().textContent()).includes('A complete synthetic biography.'));const divider=page.getByRole('separator',{name:'Resize Attributes panel'});await divider.press('ArrowRight');await page.screenshot({path:out+'/development-pwa-characters.png'});fs.writeFileSync(out+'/development-refinements-pwa.json',JSON.stringify({status:'passed',target:'Development',installed:true,checks:['real installed Chromium PWA','canonical taxonomy and legacy flat API contract','type picker disambiguates Office','alias/path containment picker','shared Locations taxonomy palette','same-window Details','shared Characters palette, resize and two unchanged biographies']},null,2));console.log('PASS authenticated installed Development PWA, canonical/legacy APIs, both pickers, both shared palettes and same-window navigation.');
|
|
}finally{await cdp.send('PWA.uninstall',{manifestId}).catch(()=>{});await context.close();fs.rmSync(profile,{recursive:true,force:true});}})().catch(e=>{console.error(e);process.exitCode=1;});
|