Retain layout regression coverage for purposeful workspace surfaces
This commit is contained in:
parent
a5af2e8b20
commit
2c61c196ae
@ -7,7 +7,7 @@ const paths=['Write','Explore','Plan','Review','Reflect'];
|
||||
if(identity){await p.goto(base+'/Account/Login');await p.locator('[name=Email]').fill(w.Email);await p.locator('[name=Password]').fill(w.Password);await Promise.all([p.waitForURL('**/Projects'),p.locator('button[type=submit]').click()]);}
|
||||
const expand=async()=>{const x=p.locator('[data-ribbon-collapse]');if(await x.getAttribute('aria-expanded')==='false')await x.click();await p.waitForFunction(()=>!document.querySelector('[data-ribbon-collapse]').disabled);};
|
||||
const snap=async name=>{if(out&&pwa){await p.mouse.move(2,995);await p.waitForTimeout(200);fs.mkdirSync(out,{recursive:true});await p.screenshot({path:out+'/'+name+'.png',animations:'disabled'});}};
|
||||
for(const d of paths){await p.goto(`${base}/Writer/${d}?projectId=${w.project}&bookId=${w.book}`);await p.evaluate(()=>{for(const k of Object.keys(localStorage).filter(k=>k.startsWith('plotdirector.writerLayout.')))localStorage.removeItem(k)});await p.reload();if(!before)await expand();await p.waitForTimeout(150);const toggle=p.locator(before?'.writer3-layout-tools button':'[data-writer-companion-toggle]').first();assert(await p.locator('.writer3-reference').isVisible());const measure=()=>p.locator('.writer3-main').evaluate(n=>({working:(n.querySelector('.writer-objective-form,.writer3-explore-paths,.reader-controls,.writer3-stat-grid,.writer3-inset')||n).getBoundingClientRect().width,width:n.clientWidth,scroll:getComputedStyle(n).overflowY,child:[...n.children].filter(n=>n.getBoundingClientRect().width>0).map(n=>n.getBoundingClientRect().width),max:Math.max(...[...n.children].map(n=>n.getBoundingClientRect().width))}));const shown=await measure();await snap(d+'-shown');await toggle.click();await p.waitForTimeout(100);assert(await p.locator('.writer3-reference').isHidden());const hidden=await measure();await snap(d+'-hidden');
|
||||
for(const d of paths){await p.goto(`${base}/Writer/${d}?projectId=${w.project}&bookId=${w.book}`);await p.evaluate(()=>{for(const k of Object.keys(localStorage).filter(k=>k.startsWith('plotdirector.writerLayout.')))localStorage.removeItem(k)});await p.reload();if(!before)await expand();await p.waitForTimeout(150);if(!before&&['Explore','Plan','Reflect'].includes(d)){assert.equal(await p.locator('.writer3-reference').count(),0,d+' intentionally has one working surface without a Word/reference column');assert(await p.locator('[data-writer-companion-toggle]').isHidden());assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));assert.equal(await p.locator('.writer3-layout-tools').count(),0);assert.equal(await p.locator('.writer3-header .writer3-cover').count(),0);await snap(d+'-working-surface');results.push({pwa,d,layout:'phase2-purposeful-surface'});continue;}const toggle=p.locator(before?'.writer3-layout-tools button':'[data-writer-companion-toggle]').first();assert(await p.locator('.writer3-reference').isVisible());const measure=()=>p.locator('.writer3-main').evaluate(n=>({working:(n.querySelector('.writer-objective-form,.writer3-explore-paths,.reader-controls,.writer3-stat-grid,.writer3-inset')||n).getBoundingClientRect().width,width:n.clientWidth,scroll:getComputedStyle(n).overflowY,child:[...n.children].filter(n=>n.getBoundingClientRect().width>0).map(n=>n.getBoundingClientRect().width),max:Math.max(...[...n.children].map(n=>n.getBoundingClientRect().width))}));const shown=await measure();await snap(d+'-shown');await toggle.click();await p.waitForTimeout(100);assert(await p.locator('.writer3-reference').isHidden());const hidden=await measure();await snap(d+'-hidden');
|
||||
if(!before){assert(hidden.width>shown.width+200);assert(hidden.working>shown.working+150,d+' internal working surface reflow');assert.equal(hidden.scroll,'visible');assert.equal(await p.locator('.writer3-layout-tools').count(),0);assert.equal(await p.locator('.writer3-header .writer3-cover').count(),0);assert.equal(await p.locator('.writer3-connection').count(),0);assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await p.reload();assert(await p.locator('.writer3-reference').isHidden());await p.locator('[data-writer-companion-toggle]').click();assert(await p.locator('.writer3-reference').isVisible());const divider=p.locator('.writer3-divider');await divider.focus();const a=await p.locator('.writer3-reference').evaluate(n=>n.getBoundingClientRect().width);await p.keyboard.press('ArrowLeft');const z=await p.locator('.writer3-reference').evaluate(n=>n.getBoundingClientRect().width);assert(z>=a+5);await p.locator('[data-help-key="writer3.layout"] button').click();await p.locator('.plotline-help-popover').waitFor();await p.keyboard.press('Escape');}
|
||||
results.push({pwa,d,shown,hidden});
|
||||
}
|
||||
|
||||
@ -19,13 +19,13 @@
|
||||
</div>
|
||||
<button type="button" class="btn btn-link" hidden="@(focus==null||editing)" data-change-focus>Change focus</button>
|
||||
<div id="objective-setup" hidden="@(focus!=null&&!editing)">@if(focus==null||editing){<partial name="_WriterFocusForm" model="Model" />}</div>
|
||||
<div class="writer3-authoring" data-writer-authoring data-inspect-url="@(focus?.ChapterID.HasValue==true?Url.Action("Inspect","WriterAuthoring",new{bookId=Model.BookID,chapterId=focus.ChapterID,sceneId=focus.SceneID}):null)" aria-live="polite"><p>Loading your recorded intentions…</p></div>
|
||||
@if(!Model.ActivityIsPrivate){
|
||||
@if(focus != null && !editing){<div class="button-row writer3-focus-actions"><button type="button" class="btn btn-outline-primary" data-record-focus disabled>Record this session</button><button type="button" class="btn btn-outline-secondary" data-plan-focus>Plan writing time</button></div>}
|
||||
<label data-record-kind-choice hidden>Record proofreading as<select class="form-select" data-record-kind><option value="">Choose a compatible recording activity</option><option value="Editing">Editing</option><option value="Reading">Reading review</option></select></label>
|
||||
<p class="writer3-caption" data-focus-recording-hint></p><p role="status" data-focus-message></p><p class="writer3-caption" data-focus-session-difference hidden></p>
|
||||
<div class="writer3-session-block"><h3>Work sessions & Audio Review</h3><p class="writer3-caption">Recording keeps your saved working focus. Audio Review is recorded for a chapter.</p><partial name="_WriterWorkToolbar" model="new PlotLine.Models.WriterWorkToolbar(Model.BookID!.Value, focus?.ChapterID, focus?.ChapterTitle, Model.ObjectiveChoices, kind, true)" /></div>}
|
||||
else{<p class="muted">Work-session evidence is private to the book owner. Your chapter and scene tools remain available.</p>}
|
||||
<div class="writer3-authoring" data-writer-authoring data-inspect-url="@(focus?.ChapterID.HasValue==true?Url.Action("Inspect","WriterAuthoring",new{bookId=Model.BookID,chapterId=focus.ChapterID,sceneId=focus.SceneID}):null)" aria-live="polite"><p>Loading your recorded intentions…</p></div>
|
||||
</section>
|
||||
<aside class="writer3-panel writer3-reference" tabindex="0" aria-label="Writing tools">
|
||||
<h2>Keep your story close</h2><div class="button-row writer3-window-actions"><button type="button" class="btn btn-sm btn-outline-secondary" data-open-writing-context>Open Context <span aria-hidden="true">↗</span></button><button type="button" class="btn btn-sm btn-outline-secondary" data-open-writing-intent>Open Intent <span aria-hidden="true">↗</span></button></div><p data-writing-workspace-message role="status"></p><partial name="_WriterWord" model="Model" /><div data-authoring-references></div><p>Open the existing tools when you need more detail.</p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user