Rename public Problem Solver and migrate permanent URL family

This commit is contained in:
Nick Beckley 2026-11-02 16:36:57 +00:00
parent 2f70990a97
commit 88f082f7bf
45 changed files with 299 additions and 148 deletions

View File

@ -0,0 +1,81 @@
{
"note": "Pre-existing modified baseline preserved; unrelated changes are not part of the migration commit.",
"files": [
{
"path": "PlotLine.Tests/Program.cs",
"sha256": "bcfd8484e8f99795e45c581979de17b6e6f958ab17a3dca0912e04f8795be4e2"
},
{
"path": "PlotLine.Tests/SubscriptionEntitlementTests.cs",
"sha256": "e9c99b8c5ec271447f340f048f9a835131e9717a949badb356c0abf358632206"
},
{
"path": "PlotLine.Tests/ToolbarBrowserHost.cs",
"sha256": "4a04ff3f956eeb4f7a60b0071e1c58e01189a8be65651ad036990644d5045b00"
},
{
"path": "PlotLine/Controllers/AdminController.cs",
"sha256": "cbf7e6011e038e398fd33cd28141682ea2e2cb5656fbbfd43415851ff4c3b63e"
},
{
"path": "PlotLine/Controllers/ManageAccountController.cs",
"sha256": "dac472c833527536bc25b29dd350557a729fb41d9ece8a9b072b4039ae9b7d2b"
},
{
"path": "PlotLine/Controllers/PricingController.cs",
"sha256": "8e6612799b6e66733f60e93d8855edead44db4121ea00699f5e9dcd0df0b3c49"
},
{
"path": "PlotLine/Data/SubscriptionRepository.cs",
"sha256": "14fd691816a00e9b13c0d2644599d25b17823d1349baa2ba9e6561dd4a578f31"
},
{
"path": "PlotLine/Services/CoreServices.cs",
"sha256": "3647d8a829f00ee0ff1546406264dee60ee496e6cc45f5f8afe11c25b55f0aea"
},
{
"path": "PlotLine/ViewModels/AuthViewModels.cs",
"sha256": "8ddaa3142ee3a21f454bea1a07906f719c3a1682caa64f7425b1bd4a8a4b2c1f"
},
{
"path": "PlotLine/Views/Admin/Subscriptions.cshtml",
"sha256": "d5bcb571289e857b997ddf8fda6a4610605c4981da398bd5e1b71d66ba1e4150"
},
{
"path": "PlotLine/Views/ManageAccount/Index.cshtml",
"sha256": "84c90b9084e97fd1354953075c293dc7f3b3dd4a53a9d355ed6e1fbedc5692d0"
},
{
"path": "PlotLine/Views/ManageAccount/Subscription.cshtml",
"sha256": "ef0ffa30e0e2f59fbd9496303a8eb38d048ca49e26fc04de815d839495a440a4"
},
{
"path": "PlotLine/Views/Pricing/Index.cshtml",
"sha256": "bcb9dfc38b2342ff45292688f564b7be95dcf8b3498b7dfdddb647631b913979"
},
{
"path": "PlotLine/Views/Projects/Index.cshtml",
"sha256": "794380c40720bfea313a30f49ac8196f94c57282701fc2660a0ac96688aa1e3c"
},
{
"path": "PlotLine/Views/StoryCalendar/_StoryCalendarSurface.cshtml",
"sha256": "a770c919c9f6fbb12b41df8ed632662ac11b060c82785b67a43afaecaa149358"
},
{
"path": "PlotLine/wwwroot/css/application-shell.css",
"sha256": "965b79c30544991db596b7dddcb890f7feb95bc85adbcb840fae52b1a012ec86"
},
{
"path": "PlotLine/wwwroot/js/application-page-context.js",
"sha256": "dc47aff6e7f4ed0730f9f27ceb9b720585cd58df9bc71707a21a0c613b930922"
},
{
"path": "PlotLine/wwwroot/js/story-calendar.js",
"sha256": "f58cf71742668f2f17c7a48c8f60336a4e1cf5222588559ab2919687fb5deaa8"
},
{
"path": "docs/subscription-entitlements.md",
"sha256": "d52874398957f58d75bebd6e0e1c05abfaef58c79c5c06708b28fddcd3ea2d2d"
}
]
}

View File

@ -0,0 +1,44 @@
# Problem Solver naming and URL migration
## Final public architecture
- Public navigation: **Home · Tour · Pricing · Problem Solver · Help**.
- Feature name: **Problem Solver**. Home invitation and entry eyebrow: “The Problem Solver”. The approved entry hero and opening choices remain unchanged.
- Entry: `/problem-solver`.
- **52 permanent results**: `/problem-solver/{existing-slug}`. All diagnosis slugs remain unchanged.
- Interactive state: `/problem-solver?state=…`.
- Browse groups: `/problem-solver/browse` and `/problem-solver/browse/{area}`.
- Workspace recommendation handoff: `/problem-solver/workspace/{capability}`.
## Compatibility
One anonymous catch-all MVC controller permanently redirects the legacy `/writing-problems` family directly to its equivalent new path with **308 Permanent Redirect**. It preserves the raw query string and HTTP method/body, so old opaque state links and cached POST answer forms remain usable. No second migration redirect is needed. Unknown legacy paths lead to their corresponding new 404 rather than an unrelated page.
The state protection purpose/version, diagnostic engine, graph, thresholds, scoring, choices, diagnosis IDs/slugs, recommendation mappings and Review Mode mechanics were not changed. The private result-context cookie now has the new route-family path. Existing server-side journey state still decodes after the redirect; result evidence remains private and cookie-based at clean result URLs.
## Links, names and navigation
Runtime controller/view/service/script links now use the new family, including Home CTA, public navigation/footer, feature cross-links, breadcrumbs, browse/related links, reassurance, result controls, workspace handoff and Review replay destinations. Main navigation order is shared across public pages and retains its existing mobile collapse behavior. Permanent breadcrumbs use the existing trail: Home → Problem Solver → current problem.
A repository-wide search leaves old route/name references only where intentional: the compatibility controller, negative/redirect test cases, internal regression labels, immutable SQL error wording, archived package metadata and historical documentation. No active publication JSON, diagnosis editorial data or screenshot asset required changes. Ordinary concepts such as “Related writing problems” remain unchanged.
## SEO
The existing authored diagnosis metadata remains intact. The entry name changes to “The Problem Solver”. Canonicals, Open Graph URLs and `WebPage` JSON-LD identities all use `/problem-solver`; all 52 titles and descriptions remain unique. Structured data parses; no FAQ or promotional schema was added. Personalised/direct arrivals retain identical public metadata and structured identities.
With Production indexing enabled, the generated sitemap contains **1 entry page + 52 permanent diagnoses**, **0 stateful URLs**, and **0 old `/writing-problems` canonical entries**. The existing browse index and area discovery pages remain additionally eligible under their new paths; these are discovery pages, not extra diagnoses. The generator continues to use publication `Active && Index` flags and editorial area data rather than a list of 52 hardcoded entries.
Development remains globally noindex through its existing proxy safeguard and now also the application-level environment boundary from the prior audit. Production clean pages are indexable under default/enabled rules; interactive states and validation-only variants remain noindex with the clean entry canonical. Production itself is unchanged.
## Verification
See Deployment.md for runtime and live checks. Automated coverage includes:
- Existing solution build and executable regression harness, including unchanged strict acceptance/exhaustive traversal and semantic checks.
- New migration browser checks: exact navigation order/naming at 390/768/1440/1920px across Home, Tour, Pricing, Help, entry and a result; no stale rendered anchors or horizontal overflow; mobile menu; all 52 legacy diagnosis redirects plus entry/browse/workspace; query and POST preservation; real legacy-state restoration and legacy answer-form continuation; permanent breadcrumbs.
- Updated clean-URL suite in isolated Production and Development modes: all 52 direct pages, personal evidence/fresh sharing, Back/Forward, revised answers, JS/no-JS, canonical/social/schema, robots and sitemap.
- Updated rendered SEO audit: all 52 metadata sets, social assets, crawlable browse discovery, exact diagnosis sitemap set, absence of old/stateful URLs, stable personalised structured identity.
- Existing public-site suite: all seven theme preferences, signed-in/out, browser/standalone, responsive navigation, authentication validation and public metadata.
- Existing Review Mode and payoff browser suites cover replay/feedback, seven result families, reassurance and multi-answer journeys without model tuning.
No screenshots, public colours, typography or page compositions were regenerated/redesigned. Only the requested current-problem breadcrumb completes the existing trail.

View File

@ -1,5 +1,5 @@
const{chromium}=require('playwright'),assert=require('node:assert/strict'),fs=require('fs');
const base=process.env.PUBLIC_BASE_URL||'http://127.0.0.1:5238',live=base.includes('dev.plotdirector.com'),output=process.env.PUBLIC_CAPTURE_DIR||'/tmp/home-marketing-browser';fs.mkdirSync(output,{recursive:true});
(async()=>{const b=await chromium.launch(),results=[];try{for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1000},reducedMotion:'reduce'}),p=await c.newPage();await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);for(const name of ['home','tour']){await p.goto(base+(live?(name==='home'?'/':'/features'):`/public-fixture/${name}?anonymous=true`));await p.waitForLoadState('networkidle');for(const picture of await p.locator('[data-marketing-screenshot]').all()){await picture.scrollIntoViewIfNeeded();const img=picture.locator('img');await img.evaluate(e=>e.decode());assert((await img.evaluate(e=>e.currentSrc)).endsWith('.avif'));assert.equal(await img.evaluate(e=>e.naturalWidth>0),true);if(name==='tour'||!(await picture.evaluate(e=>e.closest('.power-composition'))))assert.equal(await picture.getAttribute('data-screenshot-theme'),'plotdirector');}assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,`${name}/${width}`);if(name==='home'){const section=p.locator('.writer-solver-invitation');assert.equal(await section.count(),1);assert.equal(await section.locator('li').count(),4);assert.equal(await section.locator('button,input,select,form').count(),0);assert.match(await section.innerText(),/No sign-up needed/);const link=section.getByRole('link',{name:'Help me find the problem'});assert.equal(await link.getAttribute('href'),'/writing-problems');await link.focus();assert.equal(await link.evaluate(e=>e===document.activeElement),true);await section.screenshot({path:`${output}/invitation-${width}.png`});assert(await p.locator('.writer-problems').evaluate(e=>!!e.nextElementSibling?.matches('.writer-solver-invitation')));assert(await section.evaluate(e=>!!e.nextElementSibling?.matches('.remembers-section')));}await p.evaluate(()=>scrollTo(0,0));await p.screenshot({path:`${output}/${name}-${width}-full.png`,fullPage:true});if(name==='tour'){const failures=await p.evaluate(()=>{const rgb=s=>(s.match(/[\d.]+/g)||[]).map(Number),lin=v=>(v/=255)<=.04045?v/12.92:((v+.055)/1.055)**2.4,lum=c=>.2126*lin(c[0])+.7152*lin(c[1])+.0722*lin(c[2]);const out=[];const walk=document.createTreeWalker(document.querySelector('.writer-tour'),NodeFilter.SHOW_TEXT);while(walk.nextNode()){const n=walk.currentNode,e=n.parentElement;if(!n.textContent.trim()||e.closest('[aria-hidden=true],script,style')||!e.getBoundingClientRect().width)continue;const st=getComputedStyle(e);if(st.visibility==='hidden'||st.display==='none')continue;let bg=null;for(let a=e;a;a=a.parentElement){const col=rgb(getComputedStyle(a).backgroundColor);if(col.length===3||col[3]===1){bg=col;break;}}bg??=[252,243,229];const fg=rgb(st.color),ratio=(Math.max(lum(fg),lum(bg))+.05)/(Math.min(lum(fg),lum(bg))+.05),large=parseFloat(st.fontSize)>=24||(parseFloat(st.fontSize)>=18.66&&parseInt(st.fontWeight)>=700);if(ratio<(large?3:4.5))out.push({text:n.textContent.trim().slice(0,90),ratio,fg:st.color,bg,tag:e.tagName,cls:e.className});}return out;});results.push({width,contrastFailures:failures});assert.deepEqual(failures,[],`Tour contrast ${width}: ${JSON.stringify(failures)}`);}}
(async()=>{const b=await chromium.launch(),results=[];try{for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1000},reducedMotion:'reduce'}),p=await c.newPage();await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);for(const name of ['home','tour']){await p.goto(base+(live?(name==='home'?'/':'/features'):`/public-fixture/${name}?anonymous=true`));await p.waitForLoadState('networkidle');for(const picture of await p.locator('[data-marketing-screenshot]').all()){await picture.scrollIntoViewIfNeeded();const img=picture.locator('img');await img.evaluate(e=>e.decode());assert((await img.evaluate(e=>e.currentSrc)).endsWith('.avif'));assert.equal(await img.evaluate(e=>e.naturalWidth>0),true);if(name==='tour'||!(await picture.evaluate(e=>e.closest('.power-composition'))))assert.equal(await picture.getAttribute('data-screenshot-theme'),'plotdirector');}assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,`${name}/${width}`);if(name==='home'){const section=p.locator('.writer-solver-invitation');assert.equal(await section.count(),1);assert.equal(await section.locator('li').count(),4);assert.equal(await section.locator('button,input,select,form').count(),0);assert.match(await section.innerText(),/No sign-up needed/);const link=section.getByRole('link',{name:'Help me find the problem'});assert.equal(await link.getAttribute('href'),'/problem-solver');await link.focus();assert.equal(await link.evaluate(e=>e===document.activeElement),true);await section.screenshot({path:`${output}/invitation-${width}.png`});assert(await p.locator('.writer-problems').evaluate(e=>!!e.nextElementSibling?.matches('.writer-solver-invitation')));assert(await section.evaluate(e=>!!e.nextElementSibling?.matches('.remembers-section')));}await p.evaluate(()=>scrollTo(0,0));await p.screenshot({path:`${output}/${name}-${width}-full.png`,fullPage:true});if(name==='tour'){const failures=await p.evaluate(()=>{const rgb=s=>(s.match(/[\d.]+/g)||[]).map(Number),lin=v=>(v/=255)<=.04045?v/12.92:((v+.055)/1.055)**2.4,lum=c=>.2126*lin(c[0])+.7152*lin(c[1])+.0722*lin(c[2]);const out=[];const walk=document.createTreeWalker(document.querySelector('.writer-tour'),NodeFilter.SHOW_TEXT);while(walk.nextNode()){const n=walk.currentNode,e=n.parentElement;if(!n.textContent.trim()||e.closest('[aria-hidden=true],script,style')||!e.getBoundingClientRect().width)continue;const st=getComputedStyle(e);if(st.visibility==='hidden'||st.display==='none')continue;let bg=null;for(let a=e;a;a=a.parentElement){const col=rgb(getComputedStyle(a).backgroundColor);if(col.length===3||col[3]===1){bg=col;break;}}bg??=[252,243,229];const fg=rgb(st.color),ratio=(Math.max(lum(fg),lum(bg))+.05)/(Math.min(lum(fg),lum(bg))+.05),large=parseFloat(st.fontSize)>=24||(parseFloat(st.fontSize)>=18.66&&parseInt(st.fontWeight)>=700);if(ratio<(large?3:4.5))out.push({text:n.textContent.trim().slice(0,90),ratio,fg:st.color,bg,tag:e.tagName,cls:e.className});}return out;});results.push({width,contrastFailures:failures});assert.deepEqual(failures,[],`Tour contrast ${width}: ${JSON.stringify(failures)}`);}}
// Ordinary server navigation remains usable without JavaScript and without an account.
await c.close();const nj=await b.newContext({javaScriptEnabled:false,viewport:{width,height:1000}});await nj.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const np=await nj.newPage();await np.goto(base+(live?'/':'/public-fixture/home?anonymous=true'));await np.locator('.writer-solver-invitation a').click();assert.equal(new URL(np.url()).pathname,'/writing-problems');assert.equal(await np.locator('form').count()>0,true);assert(!np.url().includes('Login'));await nj.close();}fs.writeFileSync(output+'/checks.json',JSON.stringify(results,null,2));console.log('PASS Home invitation/anonymous no-JS CTA, canonical screenshot clusters, AVIF loading, all Tour text contrast, full-page captures and overflow at four widths.');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
await c.close();const nj=await b.newContext({javaScriptEnabled:false,viewport:{width,height:1000}});await nj.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const np=await nj.newPage();await np.goto(base+(live?'/':'/public-fixture/home?anonymous=true'));await np.locator('.writer-solver-invitation a').click();assert.equal(new URL(np.url()).pathname,'/problem-solver');assert.equal(await np.locator('form').count()>0,true);assert(!np.url().includes('Login'));await nj.close();}fs.writeFileSync(output+'/checks.json',JSON.stringify(results,null,2));console.log('PASS Home invitation/anonymous no-JS CTA, canonical screenshot clusters, AVIF loading, all Tour text contrast, full-page captures and overflow at four widths.');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -18,8 +18,8 @@ stage='install';await page.goto(base+'/Projects');const manifestId=base+'/Projec
stage='scene areas';await app.setViewportSize({width:1440,height:1000});await app.goto(base+'/Scenes/Edit/'+id.SceneID);for(const area of ['overview','story','people','world','writer','continuity']){if(await app.locator('#ribbon-surface').isHidden())await app.locator('[data-ribbon-tab][aria-selected=true]').click();const g=app.locator('.pd-context-group[aria-label="Edit Scene"]');const compact=g.locator('details[data-compact=true]');if(await compact.count()&&!await compact.getAttribute('open'))await compact.locator('summary').click();await g.locator('button.pd-context-command').filter({hasText:new RegExp('^'+area+'$','i')}).click();assert.equal(await app.locator('[data-scene-workspace]').getAttribute('data-scene-area'),area);}
stage='context menu';await app.goto(base+'/Books/Details/'+id.BookID);const target=app.locator('[data-pd-context]').first();assert(await target.count());await target.click({button:'right'});assert(await app.locator('body > .pd-context-popup').isVisible());await app.screenshot({path:'/tmp/house-theme-live-context-menu.png'});await app.keyboard.press('Escape');
stage='modal';await app.locator('#customiseToolbar').evaluate(e=>bootstrap.Modal.getOrCreateInstance(e).show());await app.locator('#customiseToolbar.show').waitFor();await app.waitForFunction(()=>getComputedStyle(document.getElementById('customiseToolbar')).opacity==='1'&&getComputedStyle(document.querySelector('#customiseToolbar .modal-dialog')).transform==='none');await app.screenshot({path:'/tmp/house-theme-live-modal.png'});await app.locator('#customiseToolbar').evaluate(e=>bootstrap.Modal.getInstance(e).hide());
stage='public isolation';for(const theme of ['plotdirector','modern-dark','baby-blue']){await page.evaluate(t=>localStorage.setItem('plotdirector.applicationTheme',t),theme);for(const url of ['/','/features','/writing-problems','/writing-problems/comparing-different-story-versions','/Account/Login']){await page.goto(base+url);assert.equal(await page.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await page.locator('html').getAttribute('data-app-theme'),null);}}
stage='public isolation';for(const theme of ['plotdirector','modern-dark','baby-blue']){await page.evaluate(t=>localStorage.setItem('plotdirector.applicationTheme',t),theme);for(const url of ['/','/features','/problem-solver','/problem-solver/comparing-different-story-versions','/Account/Login']){await page.goto(base+url);assert.equal(await page.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await page.locator('html').getAttribute('data-app-theme'),null);}}
stage='PWA login';await app.evaluate(()=>localStorage.setItem('plotdirector.applicationTheme','plotdirector'));await app.goto(base+'/Account/Login');assert.equal(await app.locator('html').getAttribute('data-app-theme'),'plotdirector');await app.screenshot({path:'/tmp/house-theme-live-pwa-login.png'});
for(const url of ['/','/writing-problems']){await app.goto(base+url);assert.equal(await app.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await app.locator('html').getAttribute('data-app-theme'),null);}
for(const url of ['/','/problem-solver']){await app.goto(base+url);assert.equal(await app.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await app.locator('html').getAttribute('data-app-theme'),null);}
console.log('PASS real Development: new-user default; explicit alternate persistence; 10 pages at 390/1440 in web and actual installed PWA; Focus/Weave; six Scene areas; modal/context menu; public and web-login isolation across three cached themes; PWA login.');
}catch(e){console.error('FAILED',stage,e.message);process.exitCode=1;}finally{if(installed)await cdp.send('PWA.uninstall',{manifestId:base+'/Projects'}).catch(()=>{});await ctx.close();fs.rmSync(profile,{recursive:true,force:true});}})();

View File

@ -0,0 +1,11 @@
const{chromium}=require('playwright'),fs=require('fs'),assert=require('node:assert/strict');
const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238',live=base.includes('dev.plotdirector.com');
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json'));
(async()=>{const b=await chromium.launch(),c=await b.newContext();try{await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const p=await c.newPage();for(const width of [390,768,1440,1920]){await p.setViewportSize({width,height:1000});for(const path of [live?'/':'/public-fixture/home?anonymous=true',live?'/features':'/public-fixture/tour?anonymous=true',live?'/pricing':'/public-fixture/pricing?anonymous=true','/help','/problem-solver','/problem-solver/'+graph.solutions[0].slug]){await p.goto(base+path);assert.deepEqual(await p.locator('.public-links a').allTextContents(),['Home','Tour','Pricing','Problem Solver','Help']);assert.equal(await p.locator('.public-links a').nth(3).getAttribute('href'),'/problem-solver');assert.equal(await p.locator('a[href*="/writing-problems"]').count(),0);assert(!/Writing Solver|Writing Problem Solver/.test(await p.locator('body').innerText()));assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);if(width===390){const toggle=p.getByRole('button',{name:'Open navigation'});await toggle.click();assert(await p.locator('.public-links a').nth(3).isVisible());await toggle.click();}}}
for(const suffix of ['',...graph.solutions.map(s=>'/'+s.slug),'/browse','/browse/plots','/workspace/plot']){const old='/writing-problems'+suffix,redirect=await c.request.get(base+old,{maxRedirects:0});assert.equal(redirect.status(),308,old);assert.equal(redirect.headers().location,'/problem-solver'+suffix);}
for(const method of ['GET','POST']){const r=await c.request.fetch(base+'/writing-problems/answer?state=opaque%2Btoken%3D&choose=true',{method,maxRedirects:0,data:method==='POST'?'state=opaque&node=welcome':undefined});assert.equal(r.status(),308);assert.equal(r.headers().location,'/problem-solver/answer?state=opaque%2Btoken%3D&choose=true');}
// A valid pre-migration state URL survives the single redirect and restores exactly the same question.
await p.goto(base+'/problem-solver');await p.locator('input[name=choices][value="story-not-working"]').check();await p.locator('.solver-form button[type=submit]').click();const question=await p.locator('.solver-question').innerText(),query=new URL(p.url()).search;assert(query.includes('state='));await p.goto(base+'/writing-problems'+query);assert.equal(new URL(p.url()).pathname,'/problem-solver');assert.equal(await p.locator('.solver-question').innerText(),question);assert.equal(new URL(p.url()).search,query);
await p.locator('.solver-form').evaluate(e=>e.action='/writing-problems/answer');await p.locator('input[name=choices][value=too-many]').check();await p.locator('.solver-form button[type=submit]').click();assert.equal(new URL(p.url()).pathname,'/problem-solver');assert.notEqual(await p.locator('.solver-question').innerText(),question);
await p.goto(base+'/problem-solver/'+graph.solutions[0].slug);const trail=p.locator('nav[aria-label=Breadcrumb]');assert.deepEqual(await trail.locator('a').allTextContents(),['Home','Problem Solver']);assert.equal(await trail.locator('[aria-current=page]').innerText(),graph.solutions[0].title);
console.log('PASS public navigation/name/internal links at four widths; 52 single-hop legacy 308s, entry/browse/workspace redirects, preserved query/POST method semantics, restored opaque state, permanent breadcrumbs.');}finally{await c.close();await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -24,7 +24,7 @@ const themes = ['plotdirector', 'warm-light', 'warm-dark', 'modern-light', 'mode
assert.equal(await page.locator('html').getAttribute('data-site-theme'), 'public');
assert.equal(await page.locator('html').getAttribute('data-app-theme'), null);
assert.equal(await page.locator('html').getAttribute('data-bs-theme'), 'light');
assert.equal(await page.locator('.public-links a').allTextContents().then(a => a.join('|')), 'Home|Tour|Writing Solver|Pricing|Help');
assert.equal(await page.locator('.public-links a').allTextContents().then(a => a.join('|')), 'Home|Tour|Pricing|Problem Solver|Help');
assert.equal(await page.locator('[data-ribbon-shell]').count(), 0);
assert.equal(await page.locator('body').evaluate(el => getComputedStyle(el).backgroundColor), 'rgb(252, 243, 229)');
assert.equal(await page.locator('.public-account').innerText().then(s => s.includes('Your workspace')), !anonymous);

View File

@ -2,7 +2,7 @@ const{chromium}=require('playwright'),assert=require('node:assert/strict'),fs=re
const base=process.env.PUBLIC_BASE_URL||'http://127.0.0.1:5238',live=new URL(base).hostname==='dev.plotdirector.com';
(async()=>{const b=await chromium.launch(),results=[];try{for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1000},reducedMotion:'reduce'});await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);await c.addInitScript(()=>{localStorage.setItem('plotdirector.applicationTheme','modern-dark');localStorage.setItem('plotline.theme','dark')});const p=await c.newPage();
for(const [name,path]of [['home',live?'/':'/public-fixture/home?anonymous=true'],['tour',live?'/features':'/public-fixture/tour?anonymous=true'],['pricing',live?'/pricing':'/public-fixture/pricing?anonymous=true']]){assert.equal((await p.goto(base+path)).status(),200);await p.waitForLoadState('networkidle');assert.equal(await p.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await p.locator('html').getAttribute('data-app-theme'),null);const layer=p.locator('.public-scene'),img=layer.locator('img');assert.equal(await layer.getAttribute('aria-hidden'),'true');assert.equal(await img.getAttribute('loading'),'eager');assert.equal(await img.getAttribute('fetchpriority'),'high');await img.evaluate(e=>e.decode());const selected=await img.evaluate(e=>e.currentSrc);assert(selected.endsWith('.avif'));assert(selected.includes(name+'-'+(width<=600?'mobile':'wide')));assert(!selected.includes('writing-solver'));const box=await layer.boundingBox();assert(Math.abs(box.x)<1&&Math.abs(box.width-width)<1,'Photo is boxed into the content container');assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);const resources=await p.evaluate(()=>performance.getEntriesByType('resource').filter(r=>r.name.includes('/images/public/scenes/')).map(r=>({url:r.name,bytes:r.transferSize,encoded:r.encodedBodySize})));assert.equal(resources.length,1,'Duplicate background variants downloaded');assert(resources[0].encoded<(width<=600?100000:300000));if(width===390)assert(selected.includes('480'));if(name==='home'){assert((await p.locator('h1').innerText()).includes('Finally finish the novel'));assert.equal(await p.locator('.manuscript-sheet').count(),1);}if(name==='tour')assert((await p.locator('.tour-stop').count())>=9);if(name==='pricing')assert((await p.locator('.pricing-card').count())>=1);results.push({name,width,selected,resources});if(process.env.PUBLIC_CAPTURE_DIR){fs.mkdirSync(process.env.PUBLIC_CAPTURE_DIR,{recursive:true});await p.screenshot({path:`${process.env.PUBLIC_CAPTURE_DIR}/${name}-${width}.png`});}}
for(const path of ['/help','/writing-problems/browse','/writing-problems/timeline-doesnt-add-up','/features/plot-lines','/about','/contact','/privacy','/terms',live?'/Account/Login':'/public-fixture/login?anonymous=true',live?'/Account/Register':'/public-fixture/register?anonymous=true']){assert.equal((await p.goto(base+path)).status(),200);assert.equal(await p.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await p.locator('html').getAttribute('data-app-theme'),null);assert.equal(await p.locator('.public-scene').count(),0);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,`${path}/${width}`);if(process.env.PUBLIC_CAPTURE_DIR&&width===390&&['/help','/about',live?'/Account/Login':'/public-fixture/login?anonymous=true'].includes(path))await p.screenshot({path:`${process.env.PUBLIC_CAPTURE_DIR}/other-${path.split('/').at(-1).split('?')[0]}-${width}.png`});}
for(const path of ['/help','/problem-solver/browse','/problem-solver/timeline-doesnt-add-up','/features/plot-lines','/about','/contact','/privacy','/terms',live?'/Account/Login':'/public-fixture/login?anonymous=true',live?'/Account/Register':'/public-fixture/register?anonymous=true']){assert.equal((await p.goto(base+path)).status(),200);assert.equal(await p.locator('html').getAttribute('data-site-theme'),'public');assert.equal(await p.locator('html').getAttribute('data-app-theme'),null);assert.equal(await p.locator('.public-scene').count(),0);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,`${path}/${width}`);if(process.env.PUBLIC_CAPTURE_DIR&&width===390&&['/help','/about',live?'/Account/Login':'/public-fixture/login?anonymous=true'].includes(path))await p.screenshot({path:`${process.env.PUBLIC_CAPTURE_DIR}/other-${path.split('/').at(-1).split('?')[0]}-${width}.png`});}
await c.close();}
// A real WebP path when the browser does not support AVIF.
const c=await b.newContext({viewport:{width:390,height:1000}}),p=await c.newPage();const path=live?'/':'/public-fixture/home?anonymous=true';await p.route(base+path,async route=>{const r=await route.fetch();await route.fulfill({response:r,body:(await r.text()).replaceAll('type="image/avif"','type="image/unsupported"')})});await p.goto(base+path);await p.locator('.public-scene img').evaluate(e=>e.decode());assert((await p.locator('.public-scene img').evaluate(e=>e.currentSrc)).endsWith('mobile-480.webp'));await c.close();fs.writeFileSync(process.env.PUBLIC_METRICS||'/tmp/public-identity-assets.json',JSON.stringify(results,null,2));console.log('PASS coordinated unique scenes at four widths; one responsive AVIF per page, WebP fallback, mobile crop, eager high-priority hero, full-width canvas, no overflow, intact hero/plan/tour structure; ten other public page types remain public and without extra photography despite saved dark app preferences.');}finally{await b.close()}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -1,2 +1,2 @@
const{chromium}=require('playwright'),fs=require('node:fs');
(async()=>{const b=await chromium.launch(),samples=[];try{for(const path of ['/','/features','/writing-problems','/pricing','/writing-problems/timeline-doesnt-add-up'])for(const width of [390,1440])for(let run=0;run<2;run++){const c=await b.newContext({viewport:{width,height:1000},reducedMotion:'reduce'});const p=await c.newPage();await p.addInitScript(()=>{window.metrics={lcp:null,cls:0};new PerformanceObserver(l=>{for(const e of l.getEntries())window.metrics.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(l=>{for(const e of l.getEntries())if(!e.hadRecentInput)window.metrics.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com'+path);await p.waitForLoadState('networkidle');await p.waitForTimeout(400);samples.push(await p.evaluate(({path,width,run})=>({path,width,run,...window.metrics,images:performance.getEntriesByType('resource').filter(r=>/\.(avif|webp|png|jpe?g)(\?|$)/.test(r.name)).map(r=>({url:r.name,transfer:r.transferSize,encoded:r.encodedBodySize})),css:performance.getEntriesByType('resource').filter(r=>r.initiatorType==='link').map(r=>({url:r.name,ms:r.responseEnd-r.startTime})),totalBytes:performance.getEntriesByType('resource').reduce((n,r)=>n+r.transferSize,0)}),{path,width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log('Recorded',samples.length,'live fresh-context measurements');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
(async()=>{const b=await chromium.launch(),samples=[];try{for(const path of ['/','/features','/problem-solver','/pricing','/problem-solver/timeline-doesnt-add-up'])for(const width of [390,1440])for(let run=0;run<2;run++){const c=await b.newContext({viewport:{width,height:1000},reducedMotion:'reduce'});const p=await c.newPage();await p.addInitScript(()=>{window.metrics={lcp:null,cls:0};new PerformanceObserver(l=>{for(const e of l.getEntries())window.metrics.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(l=>{for(const e of l.getEntries())if(!e.hadRecentInput)window.metrics.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com'+path);await p.waitForLoadState('networkidle');await p.waitForTimeout(400);samples.push(await p.evaluate(({path,width,run})=>({path,width,run,...window.metrics,images:performance.getEntriesByType('resource').filter(r=>/\.(avif|webp|png|jpe?g)(\?|$)/.test(r.name)).map(r=>({url:r.name,transfer:r.transferSize,encoded:r.encodedBodySize})),css:performance.getEntriesByType('resource').filter(r=>r.initiatorType==='link').map(r=>({url:r.name,ms:r.responseEnd-r.startTime})),totalBytes:performance.getEntriesByType('resource').reduce((n,r)=>n+r.transferSize,0)}),{path,width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log('Recorded',samples.length,'live fresh-context measurements');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -1,2 +1,2 @@
const{chromium}=require('playwright'),fs=require('node:fs');
(async()=>{const b=await chromium.launch();const samples=[];try{for(const width of [390,1440])for(let run=0;run<3;run++){const c=await b.newContext({viewport:{width,height:1000}});const p=await c.newPage();await p.addInitScript(()=>{window.measured={lcp:0,cls:0};new PerformanceObserver(list=>{for(const e of list.getEntries())window.measured.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(list=>{for(const e of list.getEntries())if(!e.hadRecentInput)window.measured.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com/writing-problems/too-many-storylines-to-manage');await p.waitForLoadState('networkidle');await p.waitForTimeout(700);samples.push(await p.evaluate(({width,run})=>({width,run,...window.measured,images:performance.getEntriesByType('resource').filter(e=>e.initiatorType==='img').map(e=>({url:e.name,transfer:e.transferSize,encoded:e.encodedBodySize})),totalBytes:performance.getEntriesByType('resource').reduce((n,e)=>n+e.transferSize,0)}),{width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log(JSON.stringify(samples));}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
(async()=>{const b=await chromium.launch();const samples=[];try{for(const width of [390,1440])for(let run=0;run<3;run++){const c=await b.newContext({viewport:{width,height:1000}});const p=await c.newPage();await p.addInitScript(()=>{window.measured={lcp:0,cls:0};new PerformanceObserver(list=>{for(const e of list.getEntries())window.measured.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(list=>{for(const e of list.getEntries())if(!e.hadRecentInput)window.measured.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com/problem-solver/too-many-storylines-to-manage');await p.waitForLoadState('networkidle');await p.waitForTimeout(700);samples.push(await p.evaluate(({width,run})=>({width,run,...window.measured,images:performance.getEntriesByType('resource').filter(e=>e.initiatorType==='img').map(e=>({url:e.name,transfer:e.transferSize,encoded:e.encodedBodySize})),totalBytes:performance.getEntriesByType('resource').reduce((n,e)=>n+e.transferSize,0)}),{width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log(JSON.stringify(samples));}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -1,4 +1,4 @@
// Own isolated Development account only. No traces or login screenshots.
const{chromium}=require('playwright'),fs=require('node:fs'),assert=require('node:assert/strict');
(async()=>{const file=process.argv[2];assert(file?.startsWith('/tmp/pd-dev-browser-'));const id=JSON.parse(fs.readFileSync(file));assert.equal(id.Database,'PlotDirector_Development');assert(id.Email.startsWith('pwa-browser-'));const b=await chromium.launch();try{const p=await b.newPage({viewport:{width:1440,height:1000}});await p.goto('https://dev.plotdirector.com/Account/Login');await p.locator('[name=Email]').fill(id.Email);await p.locator('[name=Password]').fill(id.Password);await p.locator('form button[type=submit]').click();await p.waitForURL('**/Projects');await p.locator('#accountMenuButton').click();const first=await p.locator('[data-app-theme-choice=plotdirector]').boundingBox(),picker=await p.locator('.pd-theme-picker').boundingBox();assert(Math.abs(first.width-picker.width)<1);const alternatives=await p.locator('[data-app-theme-choice]:not([data-app-theme-choice=plotdirector])').all();assert.equal(alternatives.length,6);const rects=await Promise.all(alternatives.map(a=>a.boundingBox()));for(let i=0;i<6;i+=2)assert(Math.abs(rects[i].y-rects[i+1].y)<1&&rects[i].width<first.width/2);
await p.goto('https://dev.plotdirector.com/writing-problems');for(const choice of ['story-not-working','too-many','lost','unwanted']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(p.url(),'https://dev.plotdirector.com/writing-problems/too-many-storylines-to-manage');assert(await p.locator('.solver-result-evidence > p').count()>1);assert((await p.locator('.solver-result-cta').innerText()).startsWith('Open '));await p.locator('.solver-tool-visual img').scrollIntoViewIfNeeded();await p.locator('.solver-tool-visual img').evaluate(e=>e.decode());assert(await p.locator('.solver-tool-visual img').evaluate(e=>e.naturalWidth>0));assert.equal(await p.locator('.solver-visual-placeholder').count(),0);console.log('PASS live signed-in completion: personalised evidence, clean slug, real image, workspace CTA; full-width PlotDirector picker row plus three paired alternative rows.');}finally{await b.close();}})().catch(e=>{console.error(e.message);process.exit(1)});
await p.goto('https://dev.plotdirector.com/problem-solver');for(const choice of ['story-not-working','too-many','lost','unwanted']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(p.url(),'https://dev.plotdirector.com/problem-solver/too-many-storylines-to-manage');assert(await p.locator('.solver-result-evidence > p').count()>1);assert((await p.locator('.solver-result-cta').innerText()).startsWith('Open '));await p.locator('.solver-tool-visual img').scrollIntoViewIfNeeded();await p.locator('.solver-tool-visual img').evaluate(e=>e.decode());assert(await p.locator('.solver-tool-visual img').evaluate(e=>e.naturalWidth>0));assert.equal(await p.locator('.solver-visual-placeholder').count(),0);console.log('PASS live signed-in completion: personalised evidence, clean slug, real image, workspace CTA; full-width PlotDirector picker row plus three paired alternative rows.');}finally{await b.close();}})().catch(e=>{console.error(e.message);process.exit(1)});

View File

@ -1,2 +1,2 @@
const{chromium}=require('playwright'),fs=require('node:fs');
(async()=>{const b=await chromium.launch();const samples=[];try{for(const slug of ['too-many-storylines-to-manage','relationship-stops-developing','story-order-differs-from-chronology'])for(const width of [390,1440])for(let run=0;run<2;run++){const c=await b.newContext({viewport:{width,height:1000}});const p=await c.newPage();await p.addInitScript(()=>{window.measured={lcp:null,cls:0};new PerformanceObserver(l=>{for(const e of l.getEntries())window.measured.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(l=>{for(const e of l.getEntries())if(!e.hadRecentInput)window.measured.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com/writing-problems/'+slug);await p.waitForLoadState('networkidle');await p.waitForTimeout(500);samples.push(await p.evaluate(({slug,width,run})=>({slug,width,run,...window.measured,resources:performance.getEntriesByType('resource').filter(e=>e.name.includes('writing-solver')).map(e=>({url:e.name,transfer:e.transferSize,encoded:e.encodedBodySize,initiator:e.initiatorType})),totalBytes:performance.getEntriesByType('resource').reduce((n,e)=>n+e.transferSize,0)}),{slug,width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log('Recorded',samples.length,'fresh-context measurements');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
(async()=>{const b=await chromium.launch();const samples=[];try{for(const slug of ['too-many-storylines-to-manage','relationship-stops-developing','story-order-differs-from-chronology'])for(const width of [390,1440])for(let run=0;run<2;run++){const c=await b.newContext({viewport:{width,height:1000}});const p=await c.newPage();await p.addInitScript(()=>{window.measured={lcp:null,cls:0};new PerformanceObserver(l=>{for(const e of l.getEntries())window.measured.lcp={ms:e.startTime,url:e.url,tag:e.element?.tagName};}).observe({type:'largest-contentful-paint',buffered:true});new PerformanceObserver(l=>{for(const e of l.getEntries())if(!e.hadRecentInput)window.measured.cls+=e.value;}).observe({type:'layout-shift',buffered:true});});await p.goto('https://dev.plotdirector.com/problem-solver/'+slug);await p.waitForLoadState('networkidle');await p.waitForTimeout(500);samples.push(await p.evaluate(({slug,width,run})=>({slug,width,run,...window.measured,resources:performance.getEntriesByType('resource').filter(e=>e.name.includes('writing-solver')).map(e=>({url:e.name,transfer:e.transferSize,encoded:e.encodedBodySize,initiator:e.initiatorType})),totalBytes:performance.getEntriesByType('resource').reduce((n,e)=>n+e.transferSize,0)}),{slug,width,run}));await c.close();}fs.writeFileSync(process.argv[2],JSON.stringify(samples,null,2));console.log('Recorded',samples.length,'fresh-context measurements');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -3,10 +3,10 @@ const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidate
const catalog=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Editorial/pages-v1.json'));
const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238', indexed=process.env.PD_SOLVER_TEST_INDEXING==='true';
(async()=>{const browser=await chromium.launch();try{const context=await browser.newContext();await context.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const page=await context.newPage();
const discovered=new Set();await page.goto(base+'/writing-problems');assert(await page.locator('a[href="/writing-problems/browse"]').count()>0);await page.goto(base+'/writing-problems/browse');
const discovered=new Set();await page.goto(base+'/problem-solver');assert(await page.locator('a[href="/problem-solver/browse"]').count()>0);await page.goto(base+'/problem-solver/browse');
const areas=await page.locator('.solver-browse-areas a').evaluateAll(es=>es.map(e=>e.getAttribute('href')));assert.equal(areas.length,9);
for(const area of areas){await page.goto(base+area);for(const link of await page.locator('.solver-problem-links a').evaluateAll(es=>es.map(e=>e.getAttribute('href'))))discovered.add(link);}
assert.equal(discovered.size,52);
for(const solution of graph.solutions){const article=catalog.pages.find(p=>p.solution===solution.id),path='/writing-problems/'+solution.slug;assert(discovered.has(path));assert.equal((await page.goto(base+path)).status(),200);assert.equal(await page.locator('h1').innerText(),solution.title);assert((await page.title()).includes(article.title));assert.equal(await page.locator('meta[name=description]').getAttribute('content'),article.description);assert((await page.locator('meta[property="og:title"]').getAttribute('content')).includes(article.title));assert.equal(await page.locator('meta[property="og:description"]').getAttribute('content'),article.description);const canonical=await page.locator('link[rel=canonical]').getAttribute('href');assert.equal(canonical,'https://plotdirector.com'+path);assert.equal(await page.locator('meta[property="og:url"]').getAttribute('content'),canonical);const schema=(await page.locator('script[type="application/ld+json"]').allTextContents()).join('');assert(schema.includes(canonical));assert(!schema.includes('FAQPage'));assert.equal(await page.locator('.solver-result-evidence').count(),0);assert.equal(await page.locator('.solver-permanent-copy').count(),1);assert.equal(await page.locator('.solver-permanent-copy li').count(),3);assert.equal(await page.locator('.solver-related li').count(),article.related.length);assert.equal(await page.locator('.solver-result-cta').count(),1);assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),indexed?'index, follow':'noindex, follow');assert(!(await page.locator('body').innerText()).includes('DEVELOPMENT PREVIEW'));}
for(const width of [390,768,1440,1920]){await page.setViewportSize({width,height:1000});for(const id of ['d01','d16','d21','d28','d30','d34','d43','d49','d50']){const s=graph.solutions.find(s=>s.id===id);await page.goto(base+'/writing-problems/'+s.slug);assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);const canvas=await page.locator('.solver-space').boundingBox();assert(canvas.width>=width-2);const copy=await page.locator('.solver-permanent-copy').boundingBox();assert(copy.width<=898);await page.locator('.solver-start').scrollIntoViewIfNeeded();await page.waitForTimeout(100);const img=page.locator('.solver-result-visual img');if(await img.count())assert(await img.evaluate(e=>e.complete&&e.naturalWidth>0));if(id==='d01'&&process.env.EDITORIAL_CAPTURE_DIR){fs.mkdirSync(process.env.EDITORIAL_CAPTURE_DIR,{recursive:true});await page.screenshot({path:process.env.EDITORIAL_CAPTURE_DIR+'/after-'+width+'.png',fullPage:true});}}}
await context.close();const nojs=await browser.newContext({javaScriptEnabled:false,viewport:{width:390,height:1000}});const np=await nojs.newPage();await np.goto(base+'/writing-problems/'+graph.solutions[0].slug);assert.equal(await np.locator('.solver-permanent-copy').count(),1);assert.equal(await np.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);await nojs.close();console.log('PASS editorial: all 52 metadata/content/direct-entry pages; nine crawlable groups reach all 52; nine families × four widths; no overflow; no-JS; preserved previews.');}finally{await browser.close();}})().catch(e=>{console.error(e);process.exit(1)});
for(const solution of graph.solutions){const article=catalog.pages.find(p=>p.solution===solution.id),path='/problem-solver/'+solution.slug;assert(discovered.has(path));assert.equal((await page.goto(base+path)).status(),200);assert.equal(await page.locator('h1').innerText(),solution.title);assert((await page.title()).includes(article.title));assert.equal(await page.locator('meta[name=description]').getAttribute('content'),article.description);assert((await page.locator('meta[property="og:title"]').getAttribute('content')).includes(article.title));assert.equal(await page.locator('meta[property="og:description"]').getAttribute('content'),article.description);const canonical=await page.locator('link[rel=canonical]').getAttribute('href');assert.equal(canonical,'https://plotdirector.com'+path);assert.equal(await page.locator('meta[property="og:url"]').getAttribute('content'),canonical);const schema=(await page.locator('script[type="application/ld+json"]').allTextContents()).join('');assert(schema.includes(canonical));assert(!schema.includes('FAQPage'));assert.equal(await page.locator('.solver-result-evidence').count(),0);assert.equal(await page.locator('.solver-permanent-copy').count(),1);assert.equal(await page.locator('.solver-permanent-copy li').count(),3);assert.equal(await page.locator('.solver-related li').count(),article.related.length);assert.equal(await page.locator('.solver-result-cta').count(),1);assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),indexed?'index, follow':'noindex, follow');assert(!(await page.locator('body').innerText()).includes('DEVELOPMENT PREVIEW'));}
for(const width of [390,768,1440,1920]){await page.setViewportSize({width,height:1000});for(const id of ['d01','d16','d21','d28','d30','d34','d43','d49','d50']){const s=graph.solutions.find(s=>s.id===id);await page.goto(base+'/problem-solver/'+s.slug);assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);const canvas=await page.locator('.solver-space').boundingBox();assert(canvas.width>=width-2);const copy=await page.locator('.solver-permanent-copy').boundingBox();assert(copy.width<=898);await page.locator('.solver-start').scrollIntoViewIfNeeded();await page.waitForTimeout(100);const img=page.locator('.solver-result-visual img');if(await img.count())assert(await img.evaluate(e=>e.complete&&e.naturalWidth>0));if(id==='d01'&&process.env.EDITORIAL_CAPTURE_DIR){fs.mkdirSync(process.env.EDITORIAL_CAPTURE_DIR,{recursive:true});await page.screenshot({path:process.env.EDITORIAL_CAPTURE_DIR+'/after-'+width+'.png',fullPage:true});}}}
await context.close();const nojs=await browser.newContext({javaScriptEnabled:false,viewport:{width:390,height:1000}});const np=await nojs.newPage();await np.goto(base+'/problem-solver/'+graph.solutions[0].slug);assert.equal(await np.locator('.solver-permanent-copy').count(),1);assert.equal(await np.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);await nojs.close();console.log('PASS editorial: all 52 metadata/content/direct-entry pages; nine crawlable groups reach all 52; nine families × four widths; no overflow; no-JS; preserved previews.');}finally{await browser.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -7,7 +7,7 @@ const base='https://dev.plotdirector.com';
const page=await browser.newPage({viewport:{width,height:1100}});
if(process.env.SOLVER_LOCAL_CSS==='true')await page.route('**/css/writing-solver.css*',route=>route.fulfill({contentType:'text/css',body:fs.readFileSync('PlotLine/wwwroot/css/writing-solver.css','utf8')}));
for(const slug of ['comparing-different-story-versions','too-many-storylines-to-manage','']){
const path='/writing-problems'+(slug?'/'+slug:'');await page.goto(base+path);
const path='/problem-solver'+(slug?'/'+slug:'');await page.goto(base+path);
const dimensions=await page.locator('.solver-space').evaluate(e=>{const r=e.getBoundingClientRect(),c=e.querySelector('.solver-content').getBoundingClientRect();return{left:r.left,right:r.right,width:r.width,content:c.width,overflow:document.documentElement.scrollWidth>innerWidth,bg:getComputedStyle(e).backgroundImage}});
assert.equal(dimensions.left,0);assert.equal(dimensions.width,width);assert(!dimensions.overflow);
assert(dimensions.content<= (slug?930:1000));assert(dimensions.bg.includes('writing-solver-desk.png'));
@ -16,7 +16,7 @@ const base='https://dev.plotdirector.com';
console.log('PASS',width,path,JSON.stringify(dimensions));
}
// Third diagnosis and an interactive question use the same full-width canvas.
await page.goto(base+'/writing-problems');await page.locator('input[name=choices]').first().check();await page.locator('button[type=submit]').click();
await page.goto(base+'/problem-solver');await page.locator('input[name=choices]').first().check();await page.locator('button[type=submit]').click();
assert.equal(await page.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),width);
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);
await page.close();
@ -24,6 +24,6 @@ const base='https://dev.plotdirector.com';
const page=await browser.newPage({viewport:{width:1920,height:1100}});
if(process.env.SOLVER_LOCAL_CSS==='true')await page.route('**/css/writing-solver.css*',r=>r.fulfill({contentType:'text/css',body:fs.readFileSync('PlotLine/wwwroot/css/writing-solver.css','utf8')}));
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json'));
const third=graph.solutions.find(s=>s.id==='d02').slug;await page.goto(base+'/writing-problems/'+third);assert.equal(await page.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),1920);
const third=graph.solutions.find(s=>s.id==='d02').slug;await page.goto(base+'/problem-solver/'+third);assert.equal(await page.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),1920);
console.log('PASS third diagnosis',third);
}finally{await browser.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -11,12 +11,12 @@ const indexed=process.env.PD_SOLVER_TEST_INDEXING==='true';
await context.addCookies([{name:'solver-anonymous',value:'true',url:base}]);
const page=await context.newPage();
async function choose(choice){await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const c of ['story-not-working','too-many','lost'])await choose(c);
assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');
await choose('unwanted');
const slug=graph.solutions.find(s=>s.id==='d01').slug;
assert.equal(page.url(),base+'/writing-problems/'+slug);
assert.equal(page.url(),base+'/problem-solver/'+slug);
assert((await page.locator('.solver-result-evidence li').count())>0);
const personal=await page.locator('.solver-result-evidence').innerText();
await page.reload();assert.equal(await page.locator('.solver-result-evidence').innerText(),personal);
@ -27,13 +27,13 @@ const indexed=process.env.PD_SOLVER_TEST_INDEXING==='true';
assert.equal(await direct.locator('.solver-result-cta').count(),1);
await fresh.close();
await page.goBack();assert.equal(await page.locator('input[name=node]').inputValue(),'intent-threads');
await page.goForward();assert.equal(page.url(),base+'/writing-problems/'+slug);
await page.goForward();assert.equal(page.url(),base+'/problem-solver/'+slug);
// Explicit Back preserves the prior accepted answers independently of browser caching.
await page.getByRole('link',{name:'← Back',exact:true}).click();
await page.getByRole('link',{name:'← Back',exact:true}).click();
await page.getByRole('link',{name:'← Back',exact:true}).click();
await choose('dont-connect');await choose('gap');await choose('unwanted');
assert.equal(page.url(),base+'/writing-problems/'+graph.solutions.find(s=>s.id==='d02').slug);
assert.equal(page.url(),base+'/problem-solver/'+graph.solutions.find(s=>s.id==='d02').slug);
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);
const canonical=await page.locator('link[rel=canonical]').getAttribute('href');
assert.equal(new URL(canonical).pathname,new URL(page.url()).pathname);assert(!canonical.includes('?'));
@ -43,9 +43,9 @@ const indexed=process.env.PD_SOLVER_TEST_INDEXING==='true';
await context.close();
}
const context=await browser.newContext();const page=await context.newPage();
for(const solution of graph.solutions){const response=await page.goto(base+'/writing-problems/'+solution.slug);assert.equal(response.status(),200);assert.equal(await page.locator('h1').innerText(),solution.title);assert.equal(await page.locator('.solver-result-cta').count(),1);assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),indexed?'index, follow':'noindex, follow');assert.equal(new URL(await page.locator('link[rel=canonical]').getAttribute('href')).pathname,'/writing-problems/'+solution.slug);assert((await page.locator('meta[name=description]').getAttribute('content')).length>10);assert(await page.locator('a[href^=\"/features/\"]').count()>0);}
for(const solution of graph.solutions){const response=await page.goto(base+'/problem-solver/'+solution.slug);assert.equal(response.status(),200);assert.equal(await page.locator('h1').innerText(),solution.title);assert.equal(await page.locator('.solver-result-cta').count(),1);assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),indexed?'index, follow':'noindex, follow');assert.equal(new URL(await page.locator('link[rel=canonical]').getAttribute('href')).pathname,'/problem-solver/'+solution.slug);assert((await page.locator('meta[name=description]').getAttribute('content')).length>10);assert(await page.locator('a[href^=\"/features/\"]').count()>0);}
const sitemap=await (await context.request.get(base+'/sitemap.xml')).text();assert(!sitemap.includes('state='));
if(indexed)for(const solution of graph.solutions)assert(sitemap.includes('/writing-problems/'+solution.slug));
if(indexed)for(const solution of graph.solutions)assert(sitemap.includes('/problem-solver/'+solution.slug));
console.log('PASS clean URLs: 52 direct pages; private evidence/refresh/fresh sharing; Back/Forward; revised diagnosis; 390/1440; JS/no-JS; canonical/OG/structured data; robots; sitemap'+(indexed?' all 52 indexable':' Development noindex'));
await context.close();
}finally{await browser.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -13,7 +13,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
try {
const context=await browser.newContext({javaScriptEnabled:false,viewport:{width:1440,height:1000}});
const page=await context.newPage();
for (const [kind,pages] of [['writing-problems',graph.solutions],['features',graph.features]]) {
for (const [kind,pages] of [['problem-solver',graph.solutions],['features',graph.features]]) {
for(const record of pages) {
const response=await page.goto(`${base}/${kind}/${record.slug}`);
assert.equal(response.status(),200,record.id);
@ -27,7 +27,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,record.id);
assert(!((await page.locator('main').innerText()).includes('\uFFFD')),`Replacement character in ${record.id}`);
for(const script of await page.locator('script[type="application/ld+json"]').allTextContents()) JSON.parse(script);
if(kind==='writing-problems') {
if(kind==='problem-solver') {
for(const link of record.features) {
const feature=graph.features.find(f=>f.id===link.feature);
assert(await page.locator(`a[href="/features/${feature.slug}"]`).count(),`${record.id}/${feature.id}`);
@ -35,7 +35,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
}
}
}
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const choice of ['unsure','reread-cant-see','using-tool-concern','draft-done','too-much-written']) {
await page.locator(`input[name=choices][value="${choice}"]`).check();
await page.locator('.solver-form button[type=submit]').click();
@ -53,7 +53,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
});
const page=await context.newPage();const errors=[];page.on('pageerror',e=>errors.push(e.message));
for(const id of [13,20,23,50,55,56,58,60]) {
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
const test=cases.find(c=>c.id===id);
for(let i=0;i<test.answers.length;i++) {
const answer=test.answers[i];
@ -70,7 +70,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
assert((await page.evaluate(()=>window.__shifts.reduce((a,b)=>a+b,0)))<.1,`layout shift in case ${id}`);
}
// Browser history returns to the actual prior question; revise to neutral knowledge-state advice.
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const answer of cases.find(c=>c.id===20).answers) {
for(const choice of answer.choices) await page.locator(`input[name=choices][value="${choice}"]`).check();
await page.locator('.solver-form button[type=submit]').click();
@ -84,7 +84,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
// All adoption concerns use their authored content, with at most one relevant capability.
const endpoint=graph.nodes.find(n=>n.neutralEndpoint);
for(const concern of endpoint.choices.filter(c=>c.active)) {
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const [node,choice] of [['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],[endpoint.id,concern.id]]) {
assert.equal(await page.locator('input[name=node]').getAttribute('value'),node);
await page.locator(`input[name=choices][value="${choice}"]`).check();

View File

@ -8,7 +8,7 @@ const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238';
assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
(async()=>{
const browser=await chromium.launch();
async function journey(page,id){await page.goto(base+'/writing-problems');assert.equal(await page.locator('.solver-library').count(),0);for(const answer of cases.find(c=>c.id===id).answers){assert.equal(await page.locator('input[name=node]').inputValue(),answer.node);assert.equal(await page.locator('.solver-library').count(),0);for(const choice of answer.choices)await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}}
async function journey(page,id){await page.goto(base+'/problem-solver');assert.equal(await page.locator('.solver-library').count(),0);for(const answer of cases.find(c=>c.id===id).answers){assert.equal(await page.locator('input[name=node]').inputValue(),answer.node);assert.equal(await page.locator('.solver-library').count(),0);for(const choice of answer.choices)await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}}
try {
for(const width of [390,1440])for(const javaScriptEnabled of [true,false]){
const context=await browser.newContext({javaScriptEnabled,viewport:{width,height:1100}});
@ -42,14 +42,14 @@ assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
[['unsure','reread-cant-see','characters-consistent','who-they-are','same-job','unwanted'],'d09'],
[['unsure','reread-cant-see','story-hangs-together','takes-over','voice','voice'],'d12'],
[['unsure','reread-cant-see','story-hangs-together','takes-over','gaps','disappears'],'d02']]){
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const choice of answers){await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
assert.equal(await page.locator('.solver-result-panel h1').innerText(),graph.solutions.find(s=>s.id===expected).title);
assert.equal(await page.locator('.solver-result-cta').count(),1);
assert((await page.locator('.solver-result-evidence').innerText()).length>30);
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);
}
await page.goto(base+'/writing-problems');for(const [node,choice]of[['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],['existing-barrier','discovery']]){assert.equal(await page.locator('input[name=node]').inputValue(),node);await page.locator(`input[value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
await page.goto(base+'/problem-solver');for(const [node,choice]of[['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],['existing-barrier','discovery']]){assert.equal(await page.locator('input[name=node]').inputValue(),node);await page.locator(`input[value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
assert.equal(await page.locator('.solver-neutral').count(),1);assert.equal(await page.locator('.solver-start,.solver-library,.solver-result-panel').count(),0);
await journey(page,50);assert.equal(await page.locator('.solver-result-panel,.solver-resolution,.solver-library').count(),0);assert((await page.locator('main').innerText()).includes('isn’t enough evidence'));
assert.equal(errors.length,0,errors.join('\n'));await context.close();
@ -58,10 +58,10 @@ assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
const context=await browser.newContext({viewport:{width:1440,height:1000}});const page=await context.newPage();
await journey(page,3);assert.match(await page.locator('.solver-result-cta').innerText(),/^Open .* in my workspace/);
await page.locator('.solver-result-cta').click();assert.equal(await page.locator('select[name=projectId]').count(),1);
const response=await context.request.get(base+'/writing-problems/workspace/plot?projectId=77',{maxRedirects:0});assert.equal(response.status(),302);assert.equal(response.headers().location,'/PlotLineWorkspace?projectId=77');
await page.goto(base+'/writing-problems/workspace/knowledge?projectId=77');assert.equal(await page.locator('select[name=characterId]').count(),1);
const character=await context.request.get(base+'/writing-problems/workspace/knowledge?projectId=77&characterId=88',{maxRedirects:0});assert.equal(character.status(),302);assert.equal(character.headers().location,'/Dynamics/Knowledge/88?projectId=77');
assert.equal((await context.request.get(base+'/writing-problems/workspace/plot?projectId=999')).status(),404);
const response=await context.request.get(base+'/problem-solver/workspace/plot?projectId=77',{maxRedirects:0});assert.equal(response.status(),302);assert.equal(response.headers().location,'/PlotLineWorkspace?projectId=77');
await page.goto(base+'/problem-solver/workspace/knowledge?projectId=77');assert.equal(await page.locator('select[name=characterId]').count(),1);
const character=await context.request.get(base+'/problem-solver/workspace/knowledge?projectId=77&characterId=88',{maxRedirects:0});assert.equal(character.status(),302);assert.equal(character.headers().location,'/Dynamics/Knowledge/88?projectId=77');
assert.equal((await context.request.get(base+'/problem-solver/workspace/plot?projectId=999')).status(),404);
await context.close();
}
console.log('PASS dead-end repair: reported four-answer route; changed hypothesis; knowledge search; six-answer rescue/POV/intended-main routes; Plot Lines, timeline/continuity, relationships, scene/chapter, series, knowledge and character arc; evidence variants; optional secondary/article; explicit missing visuals; no article dump; reassurance/insufficient evidence; no-JS; 390/1440px; Back/Forward/Restart; public theme and noindex; signed-out tour CTA'+(base.includes('127.0.0.1')?'; signed-in authorised project/character selector and real workspace redirects.':'.'));

View File

@ -5,9 +5,9 @@ const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidate
const cases=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/acceptance-paths.json')).cases;
const witnesses=JSON.parse(fs.readFileSync('Docs/WritingSolver/CuratedV2/DeadEndRepair/audit.json')).after.exploration.nodes;
(async()=>{const b=await chromium.launch();const measured=[];try{const c=await b.newContext({viewport:{width:1440,height:900}});await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const p=await c.newPage();
async function path(answers){await p.goto(base+'/writing-problems');for(const a of answers){for(const choice of a.choices)await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}}
for(const result of catalog.results){const s=graph.solutions.find(s=>s.id===result.solution);assert.equal((await p.goto(base+'/writing-problems/'+s.slug)).status(),200);assert.equal(await p.locator('.solver-payoff').getAttribute('data-result-family'),result.family);assert.equal(await p.locator('h1').innerText(),s.title);assert(await p.locator('.solver-start').evaluate(e=>!!(e.compareDocumentPosition(document.querySelector('.solver-deeper-editorial'))&Node.DOCUMENT_POSITION_FOLLOWING)));assert.equal(await p.locator('.solver-result-cta').count(),1);}
async function path(answers){await p.goto(base+'/problem-solver');for(const a of answers){for(const choice of a.choices)await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}}
for(const result of catalog.results){const s=graph.solutions.find(s=>s.id===result.solution);assert.equal((await p.goto(base+'/problem-solver/'+s.slug)).status(),200);assert.equal(await p.locator('.solver-payoff').getAttribute('data-result-family'),result.family);assert.equal(await p.locator('h1').innerText(),s.title);assert(await p.locator('.solver-start').evaluate(e=>!!(e.compareDocumentPosition(document.querySelector('.solver-deeper-editorial'))&Node.DOCUMENT_POSITION_FOLLOWING)));assert.equal(await p.locator('.solver-result-cta').count(),1);}
for(const width of [390,768,1440,1920]){await p.setViewportSize({width,height:900});for(const family of [...new Set(catalog.results.map(r=>r.family))]){const test=cases.find(t=>catalog.results.find(r=>r.solution===t.expectedPrimary)?.family===family);await path(test.answers);assert.equal(await p.locator('.solver-payoff').getAttribute('data-result-family'),family);assert((await p.locator('.solver-result-evidence li').count())>0);const action=await p.locator('.solver-author-action').boundingBox(),help=await p.locator('.solver-specific-help').boundingBox();measured.push({width,family,actionY:action.y,helpY:help.y});if(width>=1440){assert(action.y<700,JSON.stringify(measured.at(-1)));assert(help.y<900,JSON.stringify(measured.at(-1)));}assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);await p.locator('.solver-tool-visual img').first().scrollIntoViewIfNeeded();await p.locator('.solver-tool-visual img').first().evaluate(e=>e.decode());assert((await p.locator('.solver-tool-visual img').first().boundingBox()).width>=(width>=1440?570:250));if(process.env.PAYOFF_CAPTURE_DIR){fs.mkdirSync(process.env.PAYOFF_CAPTURE_DIR,{recursive:true});await p.evaluate(()=>scrollTo({top:0,behavior:"instant"}));await p.screenshot({path:`${process.env.PAYOFF_CAPTURE_DIR}/${family}-${width}.png`});}}}
for(const node of ['final-cast','final-progression']){await path(witnesses[node]);assert.equal(await p.locator('input[name=node]').inputValue(),node);assert.equal(await p.locator('.solver-choice input').last().getAttribute('value'),'unsure');assert.equal(await p.locator('.solver-choice').last().getAttribute('class'),'solver-choice solver-choice--fallback');}
// Ordinary, crawlable reassurance remains journey-based, not a new indexable diagnosis.
await p.goto(base+'/writing-problems');for(const choice of ['story-not-working','too-many','lost','deliberate']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-reassurance').count(),1);assert.equal(await p.locator('.solver-result-cta').count(),0);assert.equal(await p.locator('.solver-tool-visual').count(),0);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);if(process.env.PAYOFF_CAPTURE_DIR){await p.screenshot({path:process.env.PAYOFF_CAPTURE_DIR+'/reassurance.png'});fs.writeFileSync(process.env.PAYOFF_CAPTURE_DIR+'/reassurance-url.txt',p.url());}console.log('PASS all 52 archetypes; seven diagnostic families × four widths with personalised evidence, practical response and real images; known mixed-order uncertainties last in DOM; reassurance has no product CTA/image.');fs.writeFileSync(process.env.PAYOFF_METRICS||'/tmp/payoff-fold.json',JSON.stringify(measured,null,2));await c.close();}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
await p.goto(base+'/problem-solver');for(const choice of ['story-not-working','too-many','lost','deliberate']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-reassurance').count(),1);assert.equal(await p.locator('.solver-result-cta').count(),0);assert.equal(await p.locator('.solver-tool-visual').count(),0);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);if(process.env.PAYOFF_CAPTURE_DIR){await p.screenshot({path:process.env.PAYOFF_CAPTURE_DIR+'/reassurance.png'});fs.writeFileSync(process.env.PAYOFF_CAPTURE_DIR+'/reassurance-url.txt',p.url());}console.log('PASS all 52 archetypes; seven diagnostic families × four widths with personalised evidence, practical response and real images; known mixed-order uncertainties last in DOM; reassurance has no product CTA/image.');fs.writeFileSync(process.env.PAYOFF_METRICS||'/tmp/payoff-fold.json',JSON.stringify(measured,null,2));await c.close();}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -3,7 +3,7 @@ const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238';
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json'));
const catalog=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Presentation/payoff-v1.json'));
(async()=>{const b=await chromium.launch();try{const measurements=[];for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1000}});await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const p=await c.newPage();await p.addInitScript(()=>{window.testCLS=0;new PerformanceObserver(l=>{for(const e of l.getEntries())if(!e.hadRecentInput)window.testCLS+=e.value;}).observe({type:'layout-shift',buffered:true});});
for(const family of [...new Set(catalog.results.map(r=>r.family))]){const map=catalog.results.find(r=>r.family===family),s=graph.solutions.find(s=>s.id===map.solution);const images=[];p.on('request',r=>{if(r.url().includes('/images/writing-solver/'))images.push(r.url())});await p.goto(base+'/writing-problems/'+s.slug);await p.waitForLoadState('networkidle');const main=await p.locator('.solver-content').boundingBox(),action=await p.locator('.solver-author-action').boundingBox(),copy=await p.locator('.solver-permanent-copy').boundingBox(),related=await p.locator('.solver-related').boundingBox();assert(Math.abs(main.x-action.x)<1&&Math.abs(main.width-action.width)<1);assert(Math.abs(copy.x-main.x)<1);assert(Math.abs(related.width-copy.width)<1);assert(copy.width<=896.5);if(width>=1440)assert(copy.width>850);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);
for(const family of [...new Set(catalog.results.map(r=>r.family))]){const map=catalog.results.find(r=>r.family===family),s=graph.solutions.find(s=>s.id===map.solution);const images=[];p.on('request',r=>{if(r.url().includes('/images/writing-solver/'))images.push(r.url())});await p.goto(base+'/problem-solver/'+s.slug);await p.waitForLoadState('networkidle');const main=await p.locator('.solver-content').boundingBox(),action=await p.locator('.solver-author-action').boundingBox(),copy=await p.locator('.solver-permanent-copy').boundingBox(),related=await p.locator('.solver-related').boundingBox();assert(Math.abs(main.x-action.x)<1&&Math.abs(main.width-action.width)<1);assert(Math.abs(copy.x-main.x)<1);assert(Math.abs(related.width-copy.width)<1);assert(copy.width<=896.5);if(width>=1440)assert(copy.width>850);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);
const trigger=p.locator('.solver-start [data-solver-image]');await trigger.scrollIntoViewIfNeeded();await p.locator('.solver-start .solver-tool-visual img').evaluate(e=>e.decode());const full=await trigger.getAttribute('href');const initialResources=await p.evaluate(()=>performance.getEntriesByType('resource').map(r=>({url:r.name,bytes:r.transferSize})));assert(!initialResources.some(r=>r.url===base+full&&r.bytes>0),'Full inspection WebP transferred before opening '+JSON.stringify({width,family,initialResources}));await trigger.focus();const before=await trigger.boundingBox(),scrollBefore=await p.evaluate(()=>scrollY);await p.keyboard.press('Enter');const dialog=p.getByRole('dialog',{name:'Application screenshot'});await dialog.waitFor({state:'visible'});const large=dialog.locator('img');await large.evaluate(e=>e.decode());assert.equal(await large.getAttribute('alt'),await trigger.locator('img').getAttribute('alt'));assert.equal(await p.evaluate(()=>document.documentElement.style.overflow),'hidden');assert.equal(c.pages().length,1);const box=await dialog.boundingBox(),image=await large.boundingBox();assert(box.width<=(width<=700?width-23:width*.9+1),JSON.stringify({width,family,box}));assert(box.height<=(width<=700?976:901));assert(image.x>=box.x&&image.x+image.width<=box.x+box.width+1);const ratio=await large.evaluate(e=>e.naturalWidth/e.naturalHeight);assert(Math.abs(image.width/image.height-ratio)<.01,'Image was distorted/cropped');assert(await dialog.getByRole('button',{name:'Close screenshot'}).evaluate(e=>e===document.activeElement));await p.keyboard.press('Tab');await p.keyboard.press('Shift+Tab');assert(await p.evaluate(()=>document.activeElement.closest('dialog')!==null),'Tab escaped dialog');await p.keyboard.press('Escape');await dialog.waitFor({state:'hidden'});await p.waitForFunction(()=>document.documentElement.style.overflow!=='hidden');assert(await trigger.evaluate(e=>e===document.activeElement));assert.equal(await p.evaluate(()=>document.documentElement.style.overflow),'');assert.equal(await p.evaluate(()=>scrollY),scrollBefore);const after=await trigger.boundingBox();assert(Math.abs(before.x-after.x)<1&&Math.abs(before.width-after.width)<1,'Scrollbar lock shifted layout');await trigger.click();await dialog.getByRole('button',{name:'Close screenshot'}).click();await dialog.waitFor({state:'hidden'});await trigger.click();await p.mouse.click(2,2);await dialog.waitFor({state:'hidden'});assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);assert((await p.evaluate(()=>window.testCLS))<.01);measurements.push({width,family,main:main.width,prose:copy.width,cls:await p.evaluate(()=>window.testCLS),inspectionBytes:(await p.evaluate(()=>performance.getEntriesByType('resource').filter(r=>r.name.endsWith('.webp')).map(r=>({url:r.name,bytes:r.transferSize})))).filter(r=>r.url===base+full)});p.removeAllListeners('request');}
await p.goto(base+'/writing-problems');for(const choice of ['story-not-working','too-many','lost','deliberate']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-reassurance').count(),1);assert.equal(await p.locator('.solver-recap').count(),1);assert.equal(await p.locator('.solver-recap a').innerText(),'Restart');assert.equal(await p.locator('.solver-recap').getAttribute('aria-label'),'Areas discussed');assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);await c.close();}
const nojs=await b.newContext({javaScriptEnabled:false});const p=await nojs.newPage();await p.goto(base+'/writing-problems/'+graph.solutions[0].slug);assert.equal(await p.locator('[data-solver-image]').first().getAttribute('target'),null);assert((await p.locator('[data-solver-image]').first().getAttribute('href')).endsWith('.webp'));await nojs.close();fs.writeFileSync(process.env.POLISH_METRICS||'/tmp/polish-metrics.json',JSON.stringify(measurements,null,2));console.log('PASS seven result families × four widths: aligned main/action, shared wider prose/related area; modal fit/aspect, deferred image, keyboard focus/Tab/Escape, close/backdrop, scroll lock/restoration, no new tab or overflow; reassurance recap; no-JS image fallback.');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
await p.goto(base+'/problem-solver');for(const choice of ['story-not-working','too-many','lost','deliberate']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-reassurance').count(),1);assert.equal(await p.locator('.solver-recap').count(),1);assert.equal(await p.locator('.solver-recap a').innerText(),'Restart');assert.equal(await p.locator('.solver-recap').getAttribute('aria-label'),'Areas discussed');assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);await c.close();}
const nojs=await b.newContext({javaScriptEnabled:false});const p=await nojs.newPage();await p.goto(base+'/problem-solver/'+graph.solutions[0].slug);assert.equal(await p.locator('[data-solver-image]').first().getAttribute('target'),null);assert((await p.locator('[data-solver-image]').first().getAttribute('href')).endsWith('.webp'));await nojs.close();fs.writeFileSync(process.env.POLISH_METRICS||'/tmp/polish-metrics.json',JSON.stringify(measurements,null,2));console.log('PASS seven result families × four widths: aligned main/action, shared wider prose/related area; modal fit/aspect, deferred image, keyboard focus/Tab/Escape, close/backdrop, scroll lock/restoration, no new tab or overflow; reassurance recap; no-JS image fallback.');}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -8,7 +8,7 @@ const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238';
assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
(async()=>{
const browser=await chromium.launch();
async function journey(page,id){await page.goto(base+'/writing-problems');assert.equal(await page.locator('.solver-library').count(),0);for(const answer of cases.find(c=>c.id===id).answers){assert.equal(await page.locator('input[name=node]').inputValue(),answer.node);assert.equal(await page.locator('.solver-library').count(),0);for(const choice of answer.choices)await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}}
async function journey(page,id){await page.goto(base+'/problem-solver');assert.equal(await page.locator('.solver-library').count(),0);for(const answer of cases.find(c=>c.id===id).answers){assert.equal(await page.locator('input[name=node]').inputValue(),answer.node);assert.equal(await page.locator('.solver-library').count(),0);for(const choice of answer.choices)await page.locator(`input[name=choices][value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}}
try {
for(const width of [390,1440])for(const javaScriptEnabled of [true,false]){
const context=await browser.newContext({javaScriptEnabled,viewport:{width,height:1100}});
@ -35,7 +35,7 @@ assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
await page.goForward();assert.equal(await page.locator('.solver-result-panel').count(),1);
await page.getByRole('link',{name:'Start again',exact:true}).click();assert.equal(await page.locator('input[name=node]').inputValue(),'entry');
}
await page.goto(base+'/writing-problems');for(const [node,choice]of[['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],['existing-barrier','discovery']]){assert.equal(await page.locator('input[name=node]').inputValue(),node);await page.locator(`input[value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
await page.goto(base+'/problem-solver');for(const [node,choice]of[['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],['existing-barrier','discovery']]){assert.equal(await page.locator('input[name=node]').inputValue(),node);await page.locator(`input[value="${choice}"]`).check();await page.locator('.solver-form button[type=submit]').click();}
assert.equal(await page.locator('.solver-neutral').count(),1);assert.equal(await page.locator('.solver-start,.solver-library,.solver-result-panel').count(),0);
await journey(page,50);assert.equal(await page.locator('.solver-result-panel,.solver-resolution,.solver-library').count(),0);assert((await page.locator('main').innerText()).includes('isn’t enough evidence'));
assert.equal(errors.length,0,errors.join('\n'));await context.close();
@ -44,10 +44,10 @@ assert(['127.0.0.1:5238','dev.plotdirector.com'].includes(new URL(base).host));
const context=await browser.newContext({viewport:{width:1440,height:1000}});const page=await context.newPage();
await journey(page,3);assert.match(await page.locator('.solver-result-cta').innerText(),/^Open .* in my workspace/);
await page.locator('.solver-result-cta').click();assert.equal(await page.locator('select[name=projectId]').count(),1);
const response=await context.request.get(base+'/writing-problems/workspace/plot?projectId=77',{maxRedirects:0});assert.equal(response.status(),302);assert.equal(response.headers().location,'/PlotLineWorkspace?projectId=77');
await page.goto(base+'/writing-problems/workspace/knowledge?projectId=77');assert.equal(await page.locator('select[name=characterId]').count(),1);
const character=await context.request.get(base+'/writing-problems/workspace/knowledge?projectId=77&characterId=88',{maxRedirects:0});assert.equal(character.status(),302);assert.equal(character.headers().location,'/Dynamics/Knowledge/88?projectId=77');
assert.equal((await context.request.get(base+'/writing-problems/workspace/plot?projectId=999')).status(),404);
const response=await context.request.get(base+'/problem-solver/workspace/plot?projectId=77',{maxRedirects:0});assert.equal(response.status(),302);assert.equal(response.headers().location,'/PlotLineWorkspace?projectId=77');
await page.goto(base+'/problem-solver/workspace/knowledge?projectId=77');assert.equal(await page.locator('select[name=characterId]').count(),1);
const character=await context.request.get(base+'/problem-solver/workspace/knowledge?projectId=77&characterId=88',{maxRedirects:0});assert.equal(character.status(),302);assert.equal(character.headers().location,'/Dynamics/Knowledge/88?projectId=77');
assert.equal((await context.request.get(base+'/problem-solver/workspace/plot?projectId=999')).status(),404);
await context.close();
}
console.log('PASS result presentation: Plot Lines, timeline/continuity, relationships, scene/chapter, series, knowledge and character arc; evidence variants; optional secondary/article; explicit missing visuals; no article dump; reassurance/insufficient evidence; no-JS; 390/1440px; Back/Forward/Restart; public theme and noindex; signed-out tour CTA'+(base.includes('127.0.0.1')?'; signed-in authorised project/character selector and real workspace redirects.':'.'));

View File

@ -2,26 +2,26 @@ const {chromium}=require('playwright'),assert=require('node:assert/strict'),fs=r
const base='http://127.0.0.1:5238',production=process.env.REVIEW_EXPECT_PRODUCTION==='true';
const cases=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/acceptance-paths.json')).cases;
(async()=>{const b=await chromium.launch();const created=[];try{
const ordinary=await b.newContext();await ordinary.addCookies([{name:'pd-solver-review',value:'on',url:base}]);const op=await ordinary.newPage();await op.goto(base+'/writing-problems');assert.equal(await op.locator('.solver-review').count(),0);assert.equal((await ordinary.request.get(base+'/admin/writing-solver-review',{maxRedirects:0})).status(),production?404:403);await ordinary.close();
const ordinary=await b.newContext();await ordinary.addCookies([{name:'pd-solver-review',value:'on',url:base}]);const op=await ordinary.newPage();await op.goto(base+'/problem-solver');assert.equal(await op.locator('.solver-review').count(),0);assert.equal((await ordinary.request.get(base+'/admin/writing-solver-review',{maxRedirects:0})).status(),production?404:403);await ordinary.close();
const anon=await b.newContext();await anon.addCookies([{name:'solver-anonymous',value:'true',url:base},{name:'pd-solver-review',value:'on',url:base}]);assert.equal((await anon.request.get(base+'/admin/writing-solver-review',{maxRedirects:0})).status(),production?404:401);await anon.close();
for(const width of [390,1440]){const c=await b.newContext({viewport:{width,height:1000},javaScriptEnabled:false});await c.addCookies([{name:'solver-reviewer',value:'true',url:base}]);const p=await c.newPage();await p.goto(base+'/writing-problems');assert.equal(await p.locator('.solver-review').count(),0);
for(const width of [390,1440]){const c=await b.newContext({viewport:{width,height:1000},javaScriptEnabled:false});await c.addCookies([{name:'solver-reviewer',value:'true',url:base}]);const p=await c.newPage();await p.goto(base+'/problem-solver');assert.equal(await p.locator('.solver-review').count(),0);
if(production){assert.equal((await c.request.get(base+'/admin/writing-solver-review')).status(),404);await c.addCookies([{name:'pd-solver-review',value:'on',url:base}]);await p.reload();assert.equal(await p.locator('.solver-review').count(),0);await c.close();continue;}
await p.goto(base+'/admin/writing-solver-review');await p.getByRole('button',{name:'Enable Writing Solver Review Mode',exact:true}).click();assert.equal(new URL(p.url()).pathname,'/writing-problems');assert.equal(await p.locator('.solver-review').count(),1);assert.equal(await p.locator('.solver-review').getAttribute('open'),null);await p.locator('.solver-review > summary').click();assert((await p.locator('.solver-review').innerText()).includes('0 accepted answers'));
await p.goto(base+'/admin/writing-solver-review');await p.getByRole('button',{name:'Enable Problem Solver Review Mode',exact:true}).click();assert.equal(new URL(p.url()).pathname,'/problem-solver');assert.equal(await p.locator('.solver-review').count(),1);assert.equal(await p.locator('.solver-review').getAttribute('open'),null);await p.locator('.solver-review > summary').click();assert((await p.locator('.solver-review').innerText()).includes('0 accepted answers'));
async function choose(choice){await p.locator(`.solver-form input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}
for(const answer of ['story-not-working','too-many'])await choose(answer);
await p.goBack();assert.equal(await p.locator('input[name=node]').inputValue(),'story-problem');await p.goForward();
await choose('lost');await choose('unwanted');assert(new URL(p.url()).pathname.endsWith('/too-many-storylines-to-manage'));assert((await p.locator('.solver-result-evidence').innerText()).length>40);
await p.locator('.solver-review > summary').click();const panel=p.locator('.solver-review');assert((await panel.innerText()).includes('4 accepted answers'));assert((await panel.innerText()).includes('Primary: d01'));assert((await panel.innerText()).includes('Priority'));
await panel.locator('select[name=category]').selectOption('Result feels wrong');await panel.locator('textarea[name=note]').fill('Review verification <script>not executed</script>');await panel.getByRole('button',{name:'Capture feedback',exact:true}).click();
const id=new URL(p.url()).pathname.split('/').at(-1);assert.match(id,/^[0-9a-f-]{36}$/);created.push(id);assert.equal(await p.locator('h1').innerText(),'Writing Solver feedback');const response=await c.request.get(base+'/admin/writing-solver-review/'+id+'/export');const item=await response.json();assert.equal(item.Category,'Result feels wrong');assert.equal(item.Captured.AnswerCount,4);assert.equal(item.Captured.Diagnoses.filter(d=>d.Returned)[0].Id,'d01');assert(item.Captured.Signals.every(s=>s.Value===s.Sources.reduce((a,b)=>a+b.Value,0)));assert.equal(item.Page,'/writing-problems/too-many-storylines-to-manage');assert.equal(item.Resolved,false);
const id=new URL(p.url()).pathname.split('/').at(-1);assert.match(id,/^[0-9a-f-]{36}$/);created.push(id);assert.equal(await p.locator('h1').innerText(),'Problem Solver feedback');const response=await c.request.get(base+'/admin/writing-solver-review/'+id+'/export');const item=await response.json();assert.equal(item.Category,'Result feels wrong');assert.equal(item.Captured.AnswerCount,4);assert.equal(item.Captured.Diagnoses.filter(d=>d.Returned)[0].Id,'d01');assert(item.Captured.Signals.every(s=>s.Value===s.Sources.reduce((a,b)=>a+b.Value,0)));assert.equal(item.Page,'/problem-solver/too-many-storylines-to-manage');assert.equal(item.Resolved,false);
await p.getByRole('button',{name:'Replay against current Development graph'}).click();assert.equal(await p.getByRole('heading',{name:'Captured result at the time'}).count(),1);assert.equal(await p.getByRole('heading',{name:'Current result when replayed'}).count(),1);assert.equal((await (await c.request.get(base+'/admin/writing-solver-review/'+id+'/export')).json()).Captured.CapturedUtc,item.Captured.CapturedUtc);
await p.getByRole('button',{name:'Mark resolved',exact:true}).click();assert((await (await c.request.get(base+'/admin/writing-solver-review/'+id+'/export')).json()).Resolved);
await p.getByRole('button',{name:'Resume this journey'}).click();assert(new URL(p.url()).pathname.endsWith('/too-many-storylines-to-manage'));assert((await p.locator('.solver-result-evidence').innerText()).length>40);
await p.getByRole('link',{name:'← Back',exact:true}).click();assert.equal(await p.locator('input[name=node]').inputValue(),'intent-threads');await p.getByRole('link',{name:'← Back',exact:true}).click();await p.getByRole('link',{name:'← Back',exact:true}).click();await choose('dont-connect');await choose('gap');await choose('unwanted');assert(new URL(p.url()).pathname.endsWith('/storyline-disappears-for-too-long'));
// Review mode must not add a panel to fresh direct-entry result resources.
const fresh=await b.newContext();await fresh.addCookies([{name:'solver-reviewer',value:'true',url:base},{name:'pd-solver-review',value:'on',url:base}]);const fp=await fresh.newPage();await fp.goto(base+'/writing-problems/too-many-storylines-to-manage');assert.equal(await fp.locator('.solver-review').count(),0);await fresh.close();
for(const test of [cases.find(c=>c.answers.some(a=>a.choices.length>1)),cases.find(c=>c.id===50)]){await p.goto(base+'/writing-problems');for(const a of test.answers){for(const choice of a.choices)await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-review').count(),1);await p.locator('.solver-review > summary').click();assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);}
await p.goto(base+'/writing-problems');for(const choice of ['unsure','reread-cant-see','using-tool-concern','draft-done','discovery'])await choose(choice);assert.equal(await p.locator('.solver-neutral').count(),1);assert.equal(await p.locator('.solver-review').count(),1);
await p.goto(base+'/admin/writing-solver-review?status=resolved&category='+encodeURIComponent('Result feels wrong'));assert(await p.locator('a[href="/admin/writing-solver-review/'+id+'"]').count());await p.getByRole('button',{name:'Disable Writing Solver Review Mode',exact:true}).click();await p.goto(base+'/writing-problems');assert.equal(await p.locator('.solver-review').count(),0);await c.close();}
const fresh=await b.newContext();await fresh.addCookies([{name:'solver-reviewer',value:'true',url:base},{name:'pd-solver-review',value:'on',url:base}]);const fp=await fresh.newPage();await fp.goto(base+'/problem-solver/too-many-storylines-to-manage');assert.equal(await fp.locator('.solver-review').count(),0);await fresh.close();
for(const test of [cases.find(c=>c.answers.some(a=>a.choices.length>1)),cases.find(c=>c.id===50)]){await p.goto(base+'/problem-solver');for(const a of test.answers){for(const choice of a.choices)await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();}assert.equal(await p.locator('.solver-review').count(),1);await p.locator('.solver-review > summary').click();assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);}
await p.goto(base+'/problem-solver');for(const choice of ['unsure','reread-cant-see','using-tool-concern','draft-done','discovery'])await choose(choice);assert.equal(await p.locator('.solver-neutral').count(),1);assert.equal(await p.locator('.solver-review').count(),1);
await p.goto(base+'/admin/writing-solver-review?status=resolved&category='+encodeURIComponent('Result feels wrong'));assert(await p.locator('a[href="/admin/writing-solver-review/'+id+'"]').count());await p.getByRole('button',{name:'Disable Problem Solver Review Mode',exact:true}).click();await p.goto(base+'/problem-solver');assert.equal(await p.locator('.solver-review').count(),0);await c.close();}
console.log('PASS '+(production?'Production review endpoints 404 and no UI even with forged admin/mode cookies.':'Development review: admin-only opt-in; collapsed observer; signal arithmetic; result snapshot/export/replay/resolve/resume; filters; direct-entry unchanged; revision and Back/Forward; multi-select; neutral and insufficient outcomes; no-JS at 390/1440; forged cookie denied.'));
}finally{await b.close();for(const id of created){const path='PlotLine/App_Data/WritingSolverReview/'+id+'.json';if(fs.existsSync(path))fs.unlinkSync(path);}}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -3,8 +3,8 @@ const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238';assert(['127.0.0
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json'));
const catalog=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Presentation/results-v1.json'));
(async()=>{const b=await chromium.launch();try{const representatives=[];for(const cap of catalog.capabilities){if(representatives.some(c=>c.captureView===cap.captureView))continue;representatives.push(cap);}assert.equal(representatives.length,11);
for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1100}});const p=await c.newPage();for(const cap of representatives){const result=catalog.results.find(r=>r.capability===cap.id);const solution=graph.solutions.find(s=>s.id===result.solution);const images=[];p.on('requestfinished',r=>{if(r.url().includes('/images/writing-solver/'))images.push(r.url());});await p.goto(base+'/writing-problems/'+solution.slug);const img=p.locator('.solver-start .solver-tool-visual img');await img.scrollIntoViewIfNeeded();await img.evaluate(e=>e.decode());assert(await img.evaluate(e=>e.complete&&e.naturalWidth>0));assert.equal(await img.getAttribute('alt'),cap.imageAlt);assert.equal(await p.locator('.solver-visual-placeholder').count(),0);assert.equal(await p.locator('.solver-start .solver-tool-visual picture').count(),1);assert.equal(await p.locator('.solver-start .solver-tool-visual img').count(),1);assert(!(await p.locator('main').innerText()).includes('Development preview'));assert.equal(await p.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),width);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);assert.equal(new URL(p.url()).search,'');assert(images.length>=1&&images.length<=2&&new Set(images).size===images.length,'Only one variant per primary/secondary demonstration should download');assert.equal(await p.locator('.solver-start .solver-image-link').getAttribute('target'),null);assert.equal(await p.locator('.solver-start .solver-image-link').getAttribute('aria-haspopup'),'dialog');assert((await p.locator('.solver-content').boundingBox()).width<=1140);p.removeAllListeners('requestfinished');}await c.close();}
const c=await b.newContext();const p=await c.newPage();for(const solution of graph.solutions){await p.goto(base+'/writing-problems/'+solution.slug);const img=p.locator('.solver-start .solver-tool-visual img');await img.scrollIntoViewIfNeeded();await img.evaluate(e=>e.decode());assert.equal(await img.count(),1);assert(await img.evaluate(e=>e.naturalWidth>0));assert.equal(await p.locator('.solver-visual-placeholder').count(),0);}
for(const width of [390,768,1440,1920]){const c=await b.newContext({viewport:{width,height:1100}});const p=await c.newPage();for(const cap of representatives){const result=catalog.results.find(r=>r.capability===cap.id);const solution=graph.solutions.find(s=>s.id===result.solution);const images=[];p.on('requestfinished',r=>{if(r.url().includes('/images/writing-solver/'))images.push(r.url());});await p.goto(base+'/problem-solver/'+solution.slug);const img=p.locator('.solver-start .solver-tool-visual img');await img.scrollIntoViewIfNeeded();await img.evaluate(e=>e.decode());assert(await img.evaluate(e=>e.complete&&e.naturalWidth>0));assert.equal(await img.getAttribute('alt'),cap.imageAlt);assert.equal(await p.locator('.solver-visual-placeholder').count(),0);assert.equal(await p.locator('.solver-start .solver-tool-visual picture').count(),1);assert.equal(await p.locator('.solver-start .solver-tool-visual img').count(),1);assert(!(await p.locator('main').innerText()).includes('Development preview'));assert.equal(await p.locator('.solver-space').evaluate(e=>e.getBoundingClientRect().width),width);assert.equal(await p.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false);assert.equal(new URL(p.url()).search,'');assert(images.length>=1&&images.length<=2&&new Set(images).size===images.length,'Only one variant per primary/secondary demonstration should download');assert.equal(await p.locator('.solver-start .solver-image-link').getAttribute('target'),null);assert.equal(await p.locator('.solver-start .solver-image-link').getAttribute('aria-haspopup'),'dialog');assert((await p.locator('.solver-content').boundingBox()).width<=1140);p.removeAllListeners('requestfinished');}await c.close();}
const c=await b.newContext();const p=await c.newPage();for(const solution of graph.solutions){await p.goto(base+'/problem-solver/'+solution.slug);const img=p.locator('.solver-start .solver-tool-visual img');await img.scrollIntoViewIfNeeded();await img.evaluate(e=>e.decode());assert.equal(await img.count(),1);assert(await img.evaluate(e=>e.naturalWidth>0));assert.equal(await p.locator('.solver-visual-placeholder').count(),0);}
// Test the normal browser fallback when AVIF is unsupported, without changing the application.
await p.route('**/writing-problems/*',async route=>{const response=await route.fetch();await route.fulfill({response,body:(await response.text()).replace('type="image/avif"','type="image/unsupported"')});});await p.goto(base+'/writing-problems/'+graph.solutions[0].slug);await p.locator('.solver-start .solver-tool-visual img').scrollIntoViewIfNeeded();await p.locator('.solver-start .solver-tool-visual img').evaluate(e=>e.decode());assert((await p.locator('.solver-start .solver-tool-visual img').evaluate(e=>e.currentSrc)).endsWith('.webp'));
await p.route('**/problem-solver/*',async route=>{const response=await route.fetch();await route.fulfill({response,body:(await response.text()).replace('type="image/avif"','type="image/unsupported"')});});await p.goto(base+'/problem-solver/'+graph.solutions[0].slug);await p.locator('.solver-start .solver-tool-visual img').scrollIntoViewIfNeeded();await p.locator('.solver-start .solver-tool-visual img').evaluate(e=>e.decode());assert((await p.locator('.solver-start .solver-tool-visual img').evaluate(e=>e.currentSrc)).endsWith('.webp'));
console.log('PASS all 52 real screenshot mappings; 11 view families at 390/768/1440/1920; one responsive variant per primary/secondary demonstration, AVIF/WebP fallback, alt, stable dimensions, clean URLs, full-width canvas, readable column and no overflow.');await c.close();}finally{await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -1,16 +1,16 @@
// Real Razor metadata/sitemap audit. Production mode is loopback-only: no Production deployment or database.
const{chromium}=require('playwright'),fs=require('fs'),assert=require('node:assert/strict');
const base=process.env.SOLVER_BASE_URL||'http://127.0.0.1:5238',production=process.env.SEO_MODE==='production';assert(!production||new URL(base).hostname==='127.0.0.1');
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json')),expected=graph.solutions.filter(s=>s.active&&s.index).map(s=>'/writing-problems/'+s.slug).sort();
const graph=JSON.parse(fs.readFileSync('PlotLine/Content/WritingSolver/Candidates/curated-v2-stage1-repair/writing-solver-curated-v2-stage1-repair.json')),expected=graph.solutions.filter(s=>s.active&&s.index).map(s=>'/problem-solver/'+s.slug).sort();
(async()=>{const b=await chromium.launch(),c=await b.newContext({javaScriptEnabled:false});try{await c.addCookies([{name:'solver-anonymous',value:'true',url:base}]);const p=await c.newPage(),rows=[];
async function meta(path){const response=await p.goto(base+path);assert.equal(response.status(),200);const data=await p.evaluate(()=>({title:document.title,description:document.querySelector('meta[name=description]')?.content,canonical:document.querySelector('link[rel=canonical]')?.href,robots:document.querySelector('meta[name=robots]')?.content,og:Object.fromEntries([...document.querySelectorAll('meta[property^="og:"]')].map(e=>[e.getAttribute('property'),e.content])),json:[...document.querySelectorAll('script[type="application/ld+json"]')].map(e=>JSON.parse(e.textContent)),h1:document.querySelector('h1')?.textContent.trim(),links:[...document.querySelectorAll('main a[href]')].map(e=>e.getAttribute('href'))}));assert.equal(data.canonical,'https://plotdirector.com'+path);assert.equal(data.og['og:url'],data.canonical);assert(data.title&&data.description&&data.og['og:title']&&data.og['og:description']);assert(data.og['og:image']);const imagePath=new URL(data.og['og:image']).pathname;assert.equal((await c.request.get(base+imagePath)).status(),200);assert.equal(data.robots,production?'index, follow':'noindex, follow');assert(!production||!response.headers()['x-robots-tag']?.includes('noindex'));assert(data.json.length>0);for(const item of data.json){assert.equal(item['@type'],'WebPage');assert.equal(item.url,data.canonical);assert(item.name&&item.description);assert(!JSON.stringify(item).includes('state='));}return data;}
const entry=await meta('/writing-problems');assert(entry.links.includes('/writing-problems/browse'));for(const path of expected){const data=await meta(path);assert(data.links.includes('/writing-problems'));assert(data.links.some(u=>u.startsWith('/features/')));assert(data.links.some(u=>u.startsWith('/writing-problems/browse/')));rows.push({path,...data});}assert.equal(new Set(rows.map(r=>r.title)).size,expected.length);assert.equal(new Set(rows.map(r=>r.description)).size,expected.length);
const entry=await meta('/problem-solver');assert(entry.links.includes('/problem-solver/browse'));for(const path of expected){const data=await meta(path);assert(data.links.includes('/problem-solver'));assert(data.links.some(u=>u.startsWith('/features/')));assert(data.links.some(u=>u.startsWith('/problem-solver/browse/')));rows.push({path,...data});}assert.equal(new Set(rows.map(r=>r.title)).size,expected.length);assert.equal(new Set(rows.map(r=>r.description)).size,expected.length);
// All permanent pages are discoverable through normal SSR browse anchors.
await p.goto(base+'/writing-problems/browse');const areas=await p.locator('main a[href^="/writing-problems/browse/"]').evaluateAll(es=>es.map(e=>e.getAttribute('href'))),linked=new Set();for(const area of areas){await p.goto(base+area);for(const href of await p.locator('.solver-problem-links a').evaluateAll(es=>es.map(e=>e.getAttribute('href'))))linked.add(href);}assert.deepEqual([...linked].sort(),expected);
const xml=await (await c.request.get(base+'/sitemap.xml')).text();const locs=await p.evaluate(xml=>{const d=new DOMParser().parseFromString(xml,'application/xml');if(d.querySelector('parsererror'))throw Error('Invalid sitemap XML');return [...d.getElementsByTagName('loc')].map(e=>e.textContent);},xml);assert.equal(locs.length,new Set(locs).size);assert(locs.every(u=>!new URL(u).search&&!new URL(u).hash));const sitemapPaths=locs.map(u=>new URL(u).pathname),permanent=sitemapPaths.filter(u=>u.startsWith('/writing-problems/')&&!u.startsWith('/writing-problems/browse')).sort();assert.deepEqual(permanent,production?expected:[]);assert.equal(sitemapPaths.includes('/writing-problems'),production);
await p.goto(base+'/problem-solver/browse');const areas=await p.locator('main a[href^="/problem-solver/browse/"]').evaluateAll(es=>es.map(e=>e.getAttribute('href'))),linked=new Set();for(const area of areas){await p.goto(base+area);for(const href of await p.locator('.solver-problem-links a').evaluateAll(es=>es.map(e=>e.getAttribute('href'))))linked.add(href);}assert.deepEqual([...linked].sort(),expected);
const xml=await (await c.request.get(base+'/sitemap.xml')).text();const locs=await p.evaluate(xml=>{const d=new DOMParser().parseFromString(xml,'application/xml');if(d.querySelector('parsererror'))throw Error('Invalid sitemap XML');return [...d.getElementsByTagName('loc')].map(e=>e.textContent);},xml);assert.equal(locs.length,new Set(locs).size);assert(locs.every(u=>!u.includes("/writing-problems")));assert(locs.every(u=>!new URL(u).search&&!new URL(u).hash));const sitemapPaths=locs.map(u=>new URL(u).pathname),permanent=sitemapPaths.filter(u=>u.startsWith('/problem-solver/')&&!u.startsWith('/problem-solver/browse')).sort();assert.deepEqual(permanent,production?expected:[]);assert.equal(sitemapPaths.includes('/problem-solver'),production);
// Personal evidence changes the visible explanation, never the document's public identity.
await p.goto(base+'/writing-problems');let statePath;for(const choice of ['story-not-working','too-many','lost','unwanted']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();if(new URL(p.url()).searchParams.has('state')){statePath=new URL(p.url()).pathname+new URL(p.url()).search;assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/writing-problems');}}
assert(await p.locator('.solver-result-evidence li').count()>0);const path=new URL(p.url()).pathname,personal=await meta(path),direct=rows.find(r=>r.path===path);for(const key of ['title','description','canonical','og','json'])assert.deepEqual(personal[key],direct[key]);await p.goBack();await p.goForward();assert.equal(new URL(p.url()).pathname,path);const invalid=await p.goto(base+'/writing-problems?state=invalid');assert(invalid.headers()['x-robots-tag']?.includes('noindex'));assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/writing-problems');
await p.goto(base+'/writing-problems?choose=true');assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/writing-problems');
await p.goto(base+'/problem-solver');let statePath;for(const choice of ['story-not-working','too-many','lost','unwanted']){await p.locator(`input[name=choices][value="${choice}"]`).check();await p.locator('.solver-form button[type=submit]').click();if(new URL(p.url()).searchParams.has('state')){statePath=new URL(p.url()).pathname+new URL(p.url()).search;assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/problem-solver');}}
assert(await p.locator('.solver-result-evidence li').count()>0);const path=new URL(p.url()).pathname,personal=await meta(path),direct=rows.find(r=>r.path===path);for(const key of ['title','description','canonical','og','json'])assert.deepEqual(personal[key],direct[key]);await p.goBack();await p.goForward();assert.equal(new URL(p.url()).pathname,path);const invalid=await p.goto(base+'/problem-solver?state=invalid');assert(invalid.headers()['x-robots-tag']?.includes('noindex'));assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/problem-solver');
await p.goto(base+'/problem-solver?choose=true');assert.equal(await p.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');assert.equal(await p.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/problem-solver');
if(!production&&new URL(base).hostname==='dev.plotdirector.com')for(const route of ['/','/features','/help','/sitemap.xml','/robots.txt']){const response=await c.request.get(base+route);assert(response.headers()['x-robots-tag']?.includes('noindex'),`Missing environmental noindex: ${route}`);}
const report={mode:production?'Production configuration (isolated)':'Development',permanentFound:expected.length,permanentInSitemap:permanent.length,entryInSitemap:sitemapPaths.includes('/writing-problems'),statefulInSitemap:locs.filter(u=>new URL(u).search||new URL(u).hash).length,uniqueTitles:new Set(rows.map(r=>r.title)).size,uniqueDescriptions:new Set(rows.map(r=>r.description)).size,schemaTypes:[...new Set(rows.flatMap(r=>r.json.map(j=>j['@type'])))],personalIdentityStable:true,rows};fs.writeFileSync(process.env.SEO_REPORT||'/tmp/writing-solver-seo.json',JSON.stringify(report,null,2));console.log('PASS SEO audit',JSON.stringify({...report,rows:undefined}));}finally{await c.close();await b.close();}})().catch(e=>{console.error(e);process.exit(1)});
const report={mode:production?'Production configuration (isolated)':'Development',permanentFound:expected.length,permanentInSitemap:permanent.length,entryInSitemap:sitemapPaths.includes('/problem-solver'),statefulInSitemap:locs.filter(u=>new URL(u).search||new URL(u).hash).length,uniqueTitles:new Set(rows.map(r=>r.title)).size,uniqueDescriptions:new Set(rows.map(r=>r.description)).size,schemaTypes:[...new Set(rows.flatMap(r=>r.json.map(j=>j['@type'])))],personalIdentityStable:true,rows};fs.writeFileSync(process.env.SEO_REPORT||'/tmp/writing-solver-seo.json',JSON.stringify(report,null,2));console.log('PASS SEO audit',JSON.stringify({...report,rows:undefined}));}finally{await c.close();await b.close();}})().catch(e=>{console.error(e);process.exit(1)});

View File

@ -13,7 +13,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
try {
const context=await browser.newContext({javaScriptEnabled:false,viewport:{width:1440,height:1000}});
const page=await context.newPage();
for (const [kind,pages] of [['writing-problems',graph.solutions],['features',graph.features]]) {
for (const [kind,pages] of [['problem-solver',graph.solutions],['features',graph.features]]) {
for(const record of pages) {
const response=await page.goto(`${base}/${kind}/${record.slug}`);
assert.equal(response.status(),200,record.id);
@ -27,7 +27,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth>innerWidth),false,record.id);
assert(!((await page.locator('main').innerText()).includes('\uFFFD')),`Replacement character in ${record.id}`);
for(const script of await page.locator('script[type="application/ld+json"]').allTextContents()) JSON.parse(script);
if(kind==='writing-problems') {
if(kind==='problem-solver') {
for(const link of record.features) {
const feature=graph.features.find(f=>f.id===link.feature);
assert(await page.locator(`a[href="/features/${feature.slug}"]`).count(),`${record.id}/${feature.id}`);
@ -35,7 +35,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
}
}
}
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const choice of ['unsure','reread-cant-see','using-tool-concern','draft-done','too-much-written']) {
await page.locator(`input[name=choices][value="${choice}"]`).check();
await page.locator('.solver-form button[type=submit]').click();
@ -44,7 +44,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
assert.equal(await page.locator('.solver-library').count(),0);
assert(await page.locator('a[href="/features/manuscript-import"]').count());
// A full diagnostic conversation is usable without JavaScript.
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const answer of cases.find(c=>c.id===3).answers) {
for(const choice of answer.choices) await page.locator(`input[name=choices][value="${choice}"]`).check();
await page.locator('.solver-form button[type=submit]').click();
@ -60,16 +60,16 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
new PerformanceObserver(list=>list.getEntries().forEach(e=>{if(!e.hadRecentInput)window.__shifts.push(e.value);})).observe({type:'layout-shift',buffered:true});
});
const page=await context.newPage();
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
const paths=await page.locator('.solver-choices--areas .solver-icon path').evaluateAll(ps=>ps.map(p=>p.getAttribute('d')));
assert.equal(paths.length,6);assert.equal(new Set(paths).size,6);
for(const choice of graph.nodes.find(n=>n.id==='entry').choices.filter(c=>!c.fallback)){
await page.goto(base+'/writing-problems');await page.locator(`input[value="${choice.id}"]`).check();await page.locator('.solver-form button[type=submit]').click();assert.equal(await page.locator('.solver-result').count(),0);assert.equal(await page.locator('input[name=node]').count(),1);
await page.goto(base+'/problem-solver');await page.locator(`input[value="${choice.id}"]`).check();await page.locator('.solver-form button[type=submit]').click();assert.equal(await page.locator('.solver-result').count(),0);assert.equal(await page.locator('input[name=node]').count(),1);
await page.getByRole('link',{name:'Restart',exact:true}).click();assert.equal(await page.locator('input[name=node]').inputValue(),'entry');
}
const errors=[];page.on('pageerror',e=>errors.push(e.message));
for(const id of [1,3,9,13,20,23,50,55,56,57,58,60]) {
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
const test=cases.find(c=>c.id===id);
for(let i=0;i<test.answers.length;i++) {
const answer=test.answers[i];
@ -86,7 +86,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
assert((await page.evaluate(()=>window.__shifts.reduce((a,b)=>a+b,0)))<.1,`layout shift in case ${id}`);
}
// Browser history returns to the actual prior question; revise to neutral knowledge-state advice.
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const answer of cases.find(c=>c.id===20).answers) {
for(const choice of answer.choices) await page.locator(`input[name=choices][value="${choice}"]`).check();
await page.locator('.solver-form button[type=submit]').click();
@ -103,7 +103,7 @@ assert(['127.0.0.1:5238','127.0.0.1:5050','dev.plotdirector.com'].includes(new U
// All adoption concerns use their authored content, with at most one relevant capability.
const endpoint=graph.nodes.find(n=>n.neutralEndpoint);
for(const concern of endpoint.choices.filter(c=>c.active)) {
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
for(const [node,choice] of [['entry','unsure'],['rescue-happening','reread-cant-see'],['rescue-confidence','using-tool-concern'],['existing-stage','draft-done'],[endpoint.id,concern.id]]) {
assert.equal(await page.locator('input[name=node]').getAttribute('value'),node);
await page.locator(`input[name=choices][value="${choice}"]`).check();

View File

@ -15,7 +15,7 @@ const base = process.env.SOLVER_BASE_URL || 'http://127.0.0.1:5238';
const page = await context.newPage();
const errors=[]; page.on('pageerror',e=>errors.push(e.message));
const noOverflow = async () => assert(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),`Overflow at ${width}`);
assert.equal((await page.goto(base+'/writing-problems')).status(),200);
assert.equal((await page.goto(base+'/problem-solver')).status(),200);
await noOverflow();
assert.equal(await page.locator('html').getAttribute('data-site-theme'),'public');
assert.equal(await page.locator('html').getAttribute('data-app-theme'),null);
@ -57,31 +57,31 @@ const base = process.env.SOLVER_BASE_URL || 'http://127.0.0.1:5238';
}
const context=await browser.newContext({javaScriptEnabled:false,viewport:{width:390,height:900}});
const page=await context.newPage();
await page.goto(base+'/writing-problems');
await page.goto(base+'/problem-solver');
await page.locator('input[value=story]').check(); await page.locator('button[type=submit]').click();
assert.match(await page.locator('legend').innerText(),/tangled/);
const response=await page.goto(base+'/writing-problems/managing-interweaving-plot-lines');
const response=await page.goto(base+'/problem-solver/managing-interweaving-plot-lines');
assert.equal(response.status(),200);
assert(await page.locator('h1').innerText().then(t=>t.includes('interweaving')));
assert.equal(await page.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/writing-problems/managing-interweaving-plot-lines');
assert.equal(await page.locator('link[rel=canonical]').getAttribute('href'),'https://plotdirector.com/problem-solver/managing-interweaving-plot-lines');
assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),'noindex, follow');
assert(await page.locator('meta[property="og:description"]').getAttribute('content'));
assert(await page.locator('script[type="application/ld+json"]').count());
assert.equal((await page.goto(base+'/features/plot-lines')).status(),200);
assert.equal((await page.goto(base+'/writing-problems/unknown-diagnosis')).status(),404);
assert.equal((await page.goto(base+'/problem-solver/unknown-diagnosis')).status(),404);
const sitemap=await (await page.request.get(base+'/sitemap.xml')).text();
assert(sitemap.includes('https://plotdirector.com/writing-problems</loc>'));
assert(sitemap.includes('https://plotdirector.com/problem-solver</loc>'));
assert(!sitemap.includes('managing-interweaving-plot-lines'),'Noindex demo leaked into sitemap');
if (!process.env.SOLVER_BASE_URL) {
const curatedSitemap=await (await page.request.get(base+'/sitemap.xml?curated=true')).text();
assert(curatedSitemap.includes('/writing-problems/managing-interweaving-plot-lines</loc>'));
assert(curatedSitemap.includes('/problem-solver/managing-interweaving-plot-lines</loc>'));
assert(curatedSitemap.includes('/features/plot-lines</loc>'));
await page.goto(base+'/writing-problems/managing-interweaving-plot-lines?curated=true');
await page.goto(base+'/problem-solver/managing-interweaving-plot-lines?curated=true');
assert.equal(await page.locator('meta[name=robots]').getAttribute('content'),'index, follow');
}
await page.goto(base+'/writing-problems?state=invalid');
await page.goto(base+'/problem-solver?state=invalid');
assert.match(await page.locator('[role=status]').innerText(),/expired or changed/);
await context.close();
console.log('PASS Writing Solver: desktop/mobile, revision, fallback, multi-feature results, no-JS, canonical/social/JSON-LD, sitemap, invalid anonymous state, no overflow/CLS');
console.log('PASS Problem Solver: desktop/mobile, revision, fallback, multi-feature results, no-JS, canonical/social/JSON-LD, sitemap, invalid anonymous state, no overflow/CLS');
} finally { await browser.close(); }
})().catch(error=>{console.error(error);process.exit(1);});

View File

@ -41,7 +41,7 @@ internal static class WritingProblemEditorialTests
solution.Index=true;
var controller=new WritingProblemsController(new Repository(graph),new EphemeralDataProtectionProvider(),new ConfigurationBuilder().Build(),new(cache),editorial){ControllerContext=new(){HttpContext=new DefaultHttpContext()}};
Check(controller.Solution(solution.Slug).GetAwaiter().GetResult() is ViewResult,"Permanent slug failed.");
Check((string?)controller.ViewData["CanonicalUrl"]=="https://plotdirector.com/writing-problems/"+solution.Slug,"Canonical must use the clean permanent slug.");
Check((string?)controller.ViewData["CanonicalUrl"]=="https://plotdirector.com/problem-solver/"+solution.Slug,"Canonical must use the clean permanent slug.");
Check((string?)controller.ViewData["Robots"]=="index, follow" && controller.ViewData["OgTitle"]?.ToString()?.Contains(article.Title)==true,"Production-ready metadata missing.");
}
// Catch near-copy accidents without asserting exact authored sentences.

View File

@ -53,7 +53,7 @@ internal static class WritingSolverReviewTests
env.EnvironmentName="Production";Check(!await service.Enabled(http),"Production review was enabled.");
try{await new WritingSolverReviewStore(env).List();throw new Exception("Production store allowed access.");}catch(InvalidOperationException){}
env.EnvironmentName="Development";var store=new WritingSolverReviewStore(env);var captured=service.Capture(graph,[]);
var record=new SolverReviewFeedback(Guid.NewGuid(),"Other","Test note","/writing-problems",false,captured);await store.Save(record);
var record=new SolverReviewFeedback(Guid.NewGuid(),"Other","Test note","/problem-solver",false,captured);await store.Save(record);
var restarted=new WritingSolverReviewStore(env);Check((await restarted.Find(record.Id))?.Captured.GraphHash==original,"Feedback not durable across service instances.");
await restarted.Resolve(record.Id,true);Check((await restarted.Find(record.Id))!.Resolved,"Resolved state not durable.");
Check((await restarted.Find(record.Id))!.Captured.CapturedUtc==captured.CapturedUtc,"Updating status modified captured result.");

View File

@ -49,12 +49,12 @@ internal static class WritingSolverSeoTests
Check(urls.All(u => new Uri(u).Query == "" && new Uri(u).Fragment == ""), "Sitemap contains journey/query/fragment state.");
return urls.ToHashSet();
}
var expected = graph.Solutions.Where(p => p.Active && p.Index).Select(p => PublicSeo.AbsoluteUrl(config, "/writing-problems/" + p.Slug)).ToHashSet();
var expected = graph.Solutions.Where(p => p.Active && p.Index).Select(p => PublicSeo.AbsoluteUrl(config, "/problem-solver/" + p.Slug)).ToHashSet();
Check(expected.Count == editorial.Catalog.Pages.Count, "Permanent editorial catalogue/publication eligibility diverged.");
var urls = Sitemap(config);
var actual = urls.Where(u => new Uri(u).AbsolutePath.StartsWith("/writing-problems/") && !new Uri(u).AbsolutePath.StartsWith("/writing-problems/browse")).ToHashSet();
var actual = urls.Where(u => new Uri(u).AbsolutePath.StartsWith("/problem-solver/") && !new Uri(u).AbsolutePath.StartsWith("/problem-solver/browse")).ToHashSet();
Check(expected.SetEquals(actual), "Generated sitemap must contain exactly the eligible permanent diagnoses.");
Check(urls.Contains(PublicSeo.AbsoluteUrl(config, "/writing-problems")), "Solver discovery missing from Production sitemap.");
Check(urls.Contains(PublicSeo.AbsoluteUrl(config, "/problem-solver")), "Solver discovery missing from Production sitemap.");
var titles = new HashSet<string>(); var descriptions = new HashSet<string>();
using var cache = new MemoryCache(new MemoryCacheOptions());
foreach (var solution in graph.Solutions.Where(p => p.Active && p.Index))
@ -65,7 +65,7 @@ internal static class WritingSolverSeoTests
var description = controller.ViewData["SeoDescription"] as string;
Check(!string.IsNullOrWhiteSpace(title) && titles.Add(title), "Missing/duplicate permanent title.");
Check(!string.IsNullOrWhiteSpace(description) && descriptions.Add(description), "Missing/duplicate permanent description.");
var canonical = PublicSeo.AbsoluteUrl(config, "/writing-problems/" + solution.Slug);
var canonical = PublicSeo.AbsoluteUrl(config, "/problem-solver/" + solution.Slug);
Check((string?)controller.ViewData["CanonicalUrl"] == canonical, "Permanent canonical is not clean/stable.");
Check((string?)controller.ViewData["Robots"] == "index, follow" && !controller.Response.Headers.ContainsKey("X-Robots-Tag"), "Production eligible page unexpectedly noindex.");
Check(!string.IsNullOrWhiteSpace(controller.ViewData["OgTitle"] as string) && !string.IsNullOrWhiteSpace(controller.ViewData["OgDescription"] as string), "Missing Open Graph text.");
@ -82,10 +82,10 @@ internal static class WritingSolverSeoTests
transient.Index(choose: true).GetAwaiter().GetResult();
Check((string?)transient.ViewData["Robots"] == "noindex, follow", "Validation-only journey URL must remain noindex.");
var first = graph.Solutions.First(p => p.Active && p.Index); first.Index = false;
Check(!Sitemap(config).Contains(PublicSeo.AbsoluteUrl(config, "/writing-problems/" + first.Slug)), "Unpublished index flag ignored by sitemap."); first.Index = true;
first.Active = false; Check(!Sitemap(config).Contains(PublicSeo.AbsoluteUrl(config, "/writing-problems/" + first.Slug)), "Inactive diagnosis entered sitemap."); first.Active = true;
Check(!Sitemap(config).Contains(PublicSeo.AbsoluteUrl(config, "/problem-solver/" + first.Slug)), "Unpublished index flag ignored by sitemap."); first.Index = true;
first.Active = false; Check(!Sitemap(config).Contains(PublicSeo.AbsoluteUrl(config, "/problem-solver/" + first.Slug)), "Inactive diagnosis entered sitemap."); first.Active = true;
var disabled = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string,string?> { ["WritingSolver:EnableIndexing"] = "false" }).Build();
Check(!Sitemap(disabled).Any(u => new Uri(u).AbsolutePath.StartsWith("/writing-problems")), "Disabled Solver entered sitemap.");
Check(!Sitemap(disabled).Any(u => new Uri(u).AbsolutePath.StartsWith("/problem-solver")), "Disabled Solver entered sitemap.");
foreach (var environment in new[] { "Production", "Development" })
{
using var services = new ServiceCollection().AddSingleton<IWebHostEnvironment>(new Host(environment)).BuildServiceProvider();

View File

@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace PlotLine.Controllers;
[AllowAnonymous]
public sealed class LegacyProblemSolverController : Controller
{
// 308 keeps existing POST answers and opaque query state intact in one hop.
[Route("/writing-problems/{**path}")]
public IActionResult Move()
{
var suffix = Request.Path.Value!["/writing-problems".Length..];
return RedirectPermanentPreserveMethod("/problem-solver" + suffix + Request.QueryString.Value);
}
}

View File

@ -28,13 +28,13 @@ public sealed class SitemapController(IHelpService help, IConfiguration configur
var graph = await solver.GetAsync();
if (configuration.GetValue("WritingSolver:EnableIndexing", true))
{
urls.Add(new("/writing-problems", "monthly", "0.8"));
urls.Add(new("/problem-solver", "monthly", "0.8"));
if(editorial is not null)
{
urls.Add(new("/writing-problems/browse", "monthly", "0.7"));
urls.AddRange(editorial.Catalog.Areas.Select(a=>new SitemapUrl("/writing-problems/browse/"+a.Id,"monthly","0.6")));
urls.Add(new("/problem-solver/browse", "monthly", "0.7"));
urls.AddRange(editorial.Catalog.Areas.Select(a=>new SitemapUrl("/problem-solver/browse/"+a.Id,"monthly","0.6")));
}
urls.AddRange(graph.Solutions.Where(p => p.Active && p.Index).Select(p => new SitemapUrl($"/writing-problems/{p.Slug}", "monthly", "0.7")));
urls.AddRange(graph.Solutions.Where(p => p.Active && p.Index).Select(p => new SitemapUrl($"/problem-solver/{p.Slug}", "monthly", "0.7")));
urls.AddRange(graph.Features.Where(p => p.Active && p.Index).Select(p => new SitemapUrl($"/features/{p.Slug}", "monthly", "0.7")));
}

View File

@ -22,7 +22,7 @@ public sealed class WritingProblemsController(IWritingSolverRepository repositor
if (history is null || history.Version != graph.Version) throw new InvalidDataException("The question collection has changed. Please begin again.");
return history.Answers;
}
[HttpGet("/writing-problems")]
[HttpGet("/problem-solver")]
public async Task<IActionResult> Index(string? state = null, bool choose = false)
{
Response.Headers.CacheControl = "no-store";
@ -36,11 +36,11 @@ public sealed class WritingProblemsController(IWritingSolverRepository repositor
var outcome = WritingSolverEngine.Evaluate(graph,history);
if (state is not null || choose) Response.Headers["X-Robots-Tag"] = "noindex, follow";
if (Complete(graph, outcome) is {} completed) return completed;
SetSeo("The Writing Problem Solver", "Tell us what’s making your novel complicated and find a practical way to untangle it.", "/writing-problems", state is null && !choose);
SetSeo("The Problem Solver", "Tell us what’s making your novel complicated and find a practical way to untangle it.", "/problem-solver", state is null && !choose);
ViewData["BackState"] = outcome.Answers.Count > 0 ? Encode(graph,outcome.Answers.Take(outcome.Answers.Count-1)) : null;
return View(new SolverJourney(graph,outcome,Encode(graph,outcome.Answers),error));
}
[HttpPost("/writing-problems/answer")]
[HttpPost("/problem-solver/answer")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Answer(string state, string node, string[] choices)
{
@ -65,18 +65,18 @@ public sealed class WritingProblemsController(IWritingSolverRepository repositor
resultContext.Save(HttpContext, graph, outcome, solution.Slug);
return RedirectToAction(nameof(Solution), new { slug = solution.Slug });
}
[HttpGet("/writing-problems/browse")]
[HttpGet("/writing-problems/browse/{problemArea}")]
[HttpGet("/problem-solver/browse")]
[HttpGet("/problem-solver/browse/{problemArea}")]
public async Task<IActionResult> Browse(string? problemArea=null)
{
if(editorial is null)return NotFound();
var group=problemArea is null?null:editorial.Catalog.Areas.FirstOrDefault(a=>a.Id==problemArea);
if(problemArea is not null && group is null)return NotFound();
var path="/writing-problems/browse"+(group is null?"":"/"+group.Id);
var path="/problem-solver/browse"+(group is null?"":"/"+group.Id);
SetSeo(group is null?"Browse writing problems":group.Title+" writing problems",group?.Description??"Explore writing problems by area, with practical ways to recognise and inspect them.",path,true);
return View("Browse",new WritingProblemBrowse(await repository.GetAsync(),editorial.Catalog,group));
}
[HttpGet("/writing-problems/{slug}")]
[HttpGet("/problem-solver/{slug}")]
public async Task<IActionResult> Solution(string slug) => await Page(slug,false);
[HttpGet("/features/{slug}")]
public async Task<IActionResult> Feature(string slug) => await Page(slug,true);
@ -86,7 +86,7 @@ public sealed class WritingProblemsController(IWritingSolverRepository repositor
SolverPage? page = feature ? graph.Features.FirstOrDefault(p => p.Active && p.Slug == slug) : graph.Solutions.FirstOrDefault(p => p.Active && p.Slug == slug);
if (page is null) return NotFound();
var article=feature?null:editorial?.Find(page.Id);
SetSeo(article?.Title??page.PageTitle,article?.Description??page.Description,$"/{(feature ? "features" : "writing-problems")}/{page.Slug}",page.Index,page.SocialImage);
SetSeo(article?.Title??page.PageTitle,article?.Description??page.Description,$"/{(feature ? "features" : "problem-solver")}/{page.Slug}",page.Index,page.SocialImage);
SolverJourney? journey = null;
if (!feature)
{

View File

@ -38,7 +38,7 @@ public sealed class WritingSolverReviewController(WritingSolverReview review,Wri
{
if(enabled)Response.Cookies.Append(WritingSolverReview.Cookie,"on",new CookieOptions{HttpOnly=true,Secure=Request.IsHttps,SameSite=SameSiteMode.Strict,IsEssential=true,Path="/",MaxAge=TimeSpan.FromDays(1)});
else Response.Cookies.Delete(WritingSolverReview.Cookie,new CookieOptions{Path="/"});
return Redirect(enabled?"/writing-problems":"/admin/writing-solver-review");
return Redirect(enabled?"/problem-solver":"/admin/writing-solver-review");
}
[HttpPost("feedback")][ValidateAntiForgeryToken]
public async Task<IActionResult> Feedback(string state,string category,string? note)
@ -54,7 +54,7 @@ public sealed class WritingSolverReviewController(WritingSolverReview review,Wri
var captured=review.Capture(graph,history.Answers);
if(captured.AnswerCount!=history.Answers.Count)return BadRequest("This journey is no longer valid. Reopen the solver before capturing feedback.");
var outcome=WritingSolverEngine.Evaluate(graph,history.Answers);
var path=outcome.Solutions.FirstOrDefault() is {} solution?"/writing-problems/"+solution.Slug:"/writing-problems";
var path=outcome.Solutions.FirstOrDefault() is {} solution?"/problem-solver/"+solution.Slug:"/problem-solver";
var item=new SolverReviewFeedback(Guid.NewGuid(),category,string.IsNullOrWhiteSpace(note)?null:note.Trim(),path,false,captured);
await store.Save(item);
return RedirectToAction(nameof(Detail),new{id=item.Id});

View File

@ -7,7 +7,7 @@ namespace PlotLine.Controllers;
[Authorize]
public sealed class WritingSolverWorkspaceController(WritingSolverResults results,IWritingSolverWorkspaceContext context) : Controller
{
[HttpGet("/writing-problems/workspace/{capability}")]
[HttpGet("/problem-solver/workspace/{capability}")]
public async Task<IActionResult> Open(string capability,int? projectId=null,int? characterId=null)
{
Response.Headers.CacheControl="no-store";

View File

@ -28,7 +28,7 @@ public sealed class WritingSolverResultContext(IMemoryCache cache)
context.Response.Cookies.Append(Cookie, token, new CookieOptions
{
HttpOnly = true, Secure = context.Request.IsHttps, SameSite = SameSiteMode.Lax,
Path = "/writing-problems", MaxAge = Lifetime, IsEssential = true
Path = "/problem-solver", MaxAge = Lifetime, IsEssential = true
});
cache.Set(Key(context, token, slug), new Entry(graph.Version,
outcome.Answers.Select(a => new SolverAnswer(a.Node, a.Choices.ToArray())).ToArray()), Lifetime);

View File

@ -6,7 +6,7 @@
}
<div class="admin-dashboard">
@if(Environment.IsDevelopment()){<p><a href="/admin/writing-solver-review">Writing Solver Review Mode →</a></p>}
@if(Environment.IsDevelopment()){<p><a href="/admin/writing-solver-review">Problem Solver Review Mode →</a></p>}
<div class="page-heading compact admin-dashboard__heading">
<div>
<p class="eyebrow">Admin</p>

View File

@ -71,11 +71,11 @@
<section class="writer-solver-invitation" aria-labelledby="home-solver-heading">
<div class="marketing-container writer-solver-grid">
<div>
<p class="marketing-eyebrow">The Writing Problem Solver</p>
<p class="marketing-eyebrow">The Problem Solver</p>
<h2 id="home-solver-heading">Not sure what’s<br />getting in the way?</h2>
<p>Characters, storylines, scene order, continuity. You can feel something getting tangled without knowing what to call it.</p>
<p>Tell us what’s becoming difficult. We’ll help you narrow down what’s happening, what to look at next and where PlotDirector may help.</p>
<a class="marketing-btn marketing-btn--primary" href="/writing-problems">Help me find the problem <span aria-hidden="true">→</span></a>
<a class="marketing-btn marketing-btn--primary" href="/problem-solver">Help me find the problem <span aria-hidden="true">→</span></a>
<p class="writer-solver-note">No sign-up needed.</p>
</div>
<div class="writer-solver-examples">

View File

@ -101,8 +101,8 @@
<div class="public-links">
<a asp-route="@PublicRouteNames.Home">Home</a>
<a asp-route="@PublicRouteNames.Features">Tour</a>
<a href="/writing-problems">Writing Solver</a>
<a asp-route="@PublicRouteNames.Pricing">Pricing</a>
<a href="/problem-solver">Problem Solver</a>
<a asp-route="@PublicRouteNames.Help">Help</a>
</div>
<div class="public-account">
@ -128,7 +128,7 @@
<div class="public-footer-top"><a class="public-wordmark" asp-route="@PublicRouteNames.Home">PlotDirector<span class="gold-dot">.</span></a><p>Your book. Your words.<br />A little less to keep in your head.</p></div>
<nav class="public-footer__nav" aria-label="Footer navigation">
<a asp-route="@PublicRouteNames.Features">Tour</a>
<a href="/writing-problems">Writing Solver</a><a asp-route="@PublicRouteNames.Pricing">Pricing</a><a asp-route="@PublicRouteNames.Help">Help</a><a asp-route="@PublicRouteNames.About">Our story</a><a asp-route="@PublicRouteNames.Contact">Contact</a><a asp-route="@PublicRouteNames.Privacy">Privacy</a><a asp-route="@PublicRouteNames.Terms">Terms</a>
<a asp-route="@PublicRouteNames.Pricing">Pricing</a><a href="/problem-solver">Problem Solver</a><a asp-route="@PublicRouteNames.Help">Help</a><a asp-route="@PublicRouteNames.About">Our story</a><a asp-route="@PublicRouteNames.Contact">Contact</a><a asp-route="@PublicRouteNames.Privacy">Privacy</a><a asp-route="@PublicRouteNames.Terms">Terms</a>
</nav>
<p class="public-colophon">© @DateTime.UtcNow.Year PlotDirector. For the stories only you can tell.</p>
</div>

View File

@ -1,6 +1,6 @@
@model string
@{ ViewData["Title"] = "Writing Solver graph"; }
<h1>Writing Solver graph</h1>
@{ ViewData["Title"] = "Problem Solver graph"; }
<h1>Problem Solver graph</h1>
<p>Immutable graph versions. Inspect nodes, choices, conditional connections, weights, diagnoses and feature mappings below. Validation reports reachability, dead ends, invalid references and unpermitted cycles. Publication preserves earlier snapshots.</p>
@if (ViewData["Report"] is IEnumerable<string> report) { <ul role="status">@foreach(var line in report) { <li>@line</li> }</ul> }
@if(ViewData["Graph"] is PlotLine.Models.WritingSolver.SolverGraph graph)
@ -19,7 +19,7 @@
<div class="table-responsive"><table class="table"><thead><tr><th>Diagnosis / active</th><th>Signals / threshold</th><th>Feature mappings</th></tr></thead><tbody>
@foreach(var solution in graph.Solutions)
{
<tr><td><a href="/writing-problems/@solution.Slug">@solution.PageTitle</a><br />@solution.Id · Active: @solution.Active · Index: @solution.Index</td><td>@string.Join(", ",solution.Signals.Select(w=>$"{w.Key}: {w.Value}"))<br />Threshold: @solution.Threshold</td>
<tr><td><a href="/problem-solver/@solution.Slug">@solution.PageTitle</a><br />@solution.Id · Active: @solution.Active · Index: @solution.Index</td><td>@string.Join(", ",solution.Signals.Select(w=>$"{w.Key}: {w.Value}"))<br />Threshold: @solution.Threshold</td>
<td>@foreach(var link in solution.Features) { <p>@link.Feature (@(link.Primary ? "primary" : "supporting"))<br />@link.Reason</p> }</td></tr>
}
</tbody></table></div>

View File

@ -2,15 +2,15 @@
@model WritingProblemBrowse
@{ Layout="_PublicLayout"; }
<section class="solver-space solver-space--article"><div class="solver-content">
<nav class="solver-trail" aria-label="Breadcrumb"><a href="/writing-problems">Writing Problem Solver</a>@if(Model.Area is not null) { <span>›</span><a href="/writing-problems/browse">Browse writing problems</a> }</nav>
<nav class="solver-trail" aria-label="Breadcrumb"><a href="/">Home</a><span>›</span><a href="/problem-solver">Problem Solver</a>@if(Model.Area is not null) { <span>›</span><a href="/problem-solver/browse">Browse writing problems</a> }</nav>
<h1>@(Model.Area?.Title??"Browse writing problems")</h1>
<p class="solver-recognition">@(Model.Area?.Description??"Find a familiar difficulty, understand what may be happening, and choose what to inspect in your manuscript.")</p>
<p><a class="editorial-link" href="/writing-problems">Prefer a conversation? Find your way with the Writing Problem Solver →</a></p>
<p><a class="editorial-link" href="/problem-solver">Prefer a conversation? Find your way with the Problem Solver →</a></p>
@if(Model.Area is null)
{
<div class="solver-browse-areas">
@foreach(var area in Model.Catalog.Areas)
{ <section><h2><a href="/writing-problems/browse/@area.Id">@area.Title →</a></h2><p>@area.Description</p></section> }
{ <section><h2><a href="/problem-solver/browse/@area.Id">@area.Title →</a></h2><p>@area.Description</p></section> }
</div>
}
else
@ -19,7 +19,7 @@
@foreach(var article in Model.Catalog.Pages.Where(p=>p.Area==Model.Area.Id))
{
var solution=Model.Graph.Solutions.FirstOrDefault(s=>s.Id==article.Solution&&s.Active);
@if(solution is not null) { <li><h2><a href="/writing-problems/@solution.Slug">@solution.Title</a></h2><p>@article.Distinction</p></li> }
@if(solution is not null) { <li><h2><a href="/problem-solver/@solution.Slug">@solution.Title</a></h2><p>@article.Distinction</p></li> }
}
</ul>
}

View File

@ -5,7 +5,7 @@
@{ Layout = "_PublicLayout"; var next = Model.Outcome.Next; var beginning = Model.Outcome.Answers.Count == 0; var presentation=Results.Present(Model.Outcome); }
<section class="solver-space @(beginning ? "solver-space--entry" : "")">
<div class="solver-content">
<p class="marketing-eyebrow">The Writing Problem Solver</p>
<p class="marketing-eyebrow">The Problem Solver</p>
@if (Model.Error is not null) { <p role="status">@Model.Error</p> }
@if (beginning)
{
@ -14,7 +14,7 @@
}
@if (next is not null)
{
<form method="post" action="/writing-problems/answer" class="solver-form">
<form method="post" action="/problem-solver/answer" class="solver-form">
@Html.AntiForgeryToken()
<input type="hidden" name="state" value="@Model.History" />
<input type="hidden" name="node" value="@next.Id" />
@ -34,7 +34,7 @@
</fieldset>
<p class="solver-selection-error" role="alert" hidden>Please choose an answer to continue.</p>
<div class="solver-controls">
@if (ViewData["BackState"] is string back) { <a class="editorial-link" href="/writing-problems?state=@back">← Back</a> }
@if (ViewData["BackState"] is string back) { <a class="editorial-link" href="/problem-solver?state=@back">← Back</a> }
<button class="marketing-btn marketing-btn--primary" type="submit">@(beginning ? "Let’s find your solution" : "Continue") <span aria-hidden="true">→</span></button>
</div>
</form>
@ -62,8 +62,8 @@
}
}
<div class="solver-controls">
@if (ViewData["BackState"] is string resultBack) { <a class="editorial-link" href="/writing-problems?state=@resultBack">← Back</a> }
<a class="marketing-btn marketing-btn--secondary" href="/writing-problems">Start again</a>
@if (ViewData["BackState"] is string resultBack) { <a class="editorial-link" href="/problem-solver?state=@resultBack">← Back</a> }
<a class="marketing-btn marketing-btn--secondary" href="/problem-solver">Start again</a>
</div>
}
@if(Model.Outcome.Answers.Count > 0)
@ -76,10 +76,10 @@
var node=Model.Graph.Nodes.Single(n=>n.Id==answer.Node);
<span>@string.Join(", ",node.Choices.Where(c=>answer.Choices.Contains(c.Id)).Select(c=>c.Text))</span>
}
<a href="/writing-problems">Restart</a>
<a href="/problem-solver">Restart</a>
</nav>
}
else { <p><a class="editorial-link" href="/writing-problems/browse">Browse writing problems →</a></p><p class="solver-promises">A few quiet minutes <span>·</span> No sign-up required <span>·</span> Advice you can use straight away</p> }
else { <p><a class="editorial-link" href="/problem-solver/browse">Browse writing problems →</a></p><p class="solver-promises">A few quiet minutes <span>·</span> No sign-up required <span>·</span> Advice you can use straight away</p> }
@if(Model.Graph.IsDemo) { <p class="solver-demo">Preview journey · This small plot-line demonstration will grow into a curated collection of writing problems.</p> }
<partial name="Review" model="Model" />
@if(presentation is not null){<partial name="ImageDialog" />}

View File

@ -5,7 +5,7 @@
@{ Layout="_PublicLayout"; }
<div class="solver-space solver-space--article">
<div class="solver-content">
<nav class="solver-trail" aria-label="Breadcrumb"><a href="/">Home</a><span>›</span><a href="@(Model.IsFeature ? "/features" : "/writing-problems")">@(Model.IsFeature ? "Features" : "Writing Problem Solver")</a></nav>
<nav class="solver-trail" aria-label="Breadcrumb"><a href="/">Home</a><span>›</span><a href="@(Model.IsFeature ? "/features" : "/problem-solver")">@(Model.IsFeature ? "Features" : "Problem Solver")</a>@if(!Model.IsFeature){<span>›</span><span aria-current="page">@Model.Page.Title</span>}</nav>
@if(Model.Graph.IsDemo) { <p class="solver-demo">Demonstration content · The curated collection is on its way.</p> }
@if(Model.IsFeature)
{
@ -15,7 +15,7 @@
@foreach(var paragraph in feature.Content.Split("\n\n")) { <p class="solver-editorial">@paragraph</p> }
@if(feature.Screenshot is not null) { <img class="solver-screenshot" src="@feature.Screenshot" alt="@feature.Title workspace in PlotDirector" width="1200" height="750" /> }
<h2>Writing problems this can help with</h2>
@foreach(var solution in Model.Graph.Solutions.Where(s=>s.Active && s.Features.Any(f=>f.Feature==feature.Id))) { <p><a href="/writing-problems/@solution.Slug">@solution.PageTitle</a></p> }
@foreach(var solution in Model.Graph.Solutions.Where(s=>s.Active && s.Features.Any(f=>f.Feature==feature.Id))) { <p><a href="/problem-solver/@solution.Slug">@solution.PageTitle</a></p> }
<p><a class="marketing-btn marketing-btn--primary" href="/features">See PlotDirector in action →</a></p>
}
else
@ -26,13 +26,13 @@
@if(Model.Journey is {} completed)
{
<div class="solver-controls">
@if(ViewData["BackState"] is string back) { <a class="editorial-link" href="/writing-problems?state=@back">← Back</a> }
<a class="marketing-btn marketing-btn--secondary" href="/writing-problems">Start again</a>
@if(ViewData["BackState"] is string back) { <a class="editorial-link" href="/problem-solver?state=@back">← Back</a> }
<a class="marketing-btn marketing-btn--secondary" href="/problem-solver">Start again</a>
</div>
<nav class="solver-recap" aria-label="Areas discussed"><span>We’ve talked about:</span>
@foreach(var answer in completed.Outcome.Answers)
{ <span>@string.Join(", ",Model.Graph.Nodes.Single(n=>n.Id==answer.Node).Choices.Where(c=>answer.Choices.Contains(c.Id)).Select(c=>c.Text))</span> }
<a href="/writing-problems">Restart</a>
<a href="/problem-solver">Restart</a>
</nav>
}
@if(Model.Journey is {} reviewJourney) { <partial name="Review" model="reviewJourney" /> }
@ -45,17 +45,17 @@
{
var related=Model.Graph.Solutions.FirstOrDefault(s=>s.Id==id&&s.Active);
var relatedArticle=Editorial.Find(id);
@if(related is not null && relatedArticle is not null) { <li><a href="/writing-problems/@related.Slug">@related.Title</a><p>@relatedArticle.Distinction</p></li> }
@if(related is not null && relatedArticle is not null) { <li><a href="/problem-solver/@related.Slug">@related.Title</a><p>@relatedArticle.Distinction</p></li> }
}
</ul></section>
@foreach(var link in solution.Features.Where(f=>f.Primary))
{ var feature=Model.Graph.Features.Single(f=>f.Id==link.Feature); <p><a class="editorial-link" href="/features/@feature.Slug">Explore @feature.Title →</a></p> }
<p><a class="editorial-link" href="/writing-problems/browse/@permanent.Area">Browse this problem area →</a></p>
<p><a class="editorial-link" href="/problem-solver/browse/@permanent.Area">Browse this problem area →</a></p>
}
}
@if(Model.Page.Questions.Count>0 && (Model.IsFeature || Editorial.Find(Model.Page.Id) is null)) { <h2>Questions this helps answer</h2><ul>@foreach(var question in Model.Page.Questions) { <li>@question</li> }</ul> }
<a class="editorial-link" href="/writing-problems">Find a way through your writing problem →</a>
<a class="editorial-link" href="/problem-solver">Find a way through your writing problem →</a>
@if(!Model.IsFeature){<partial name="ImageDialog" />}
</div>
</div>

View File

@ -29,7 +29,7 @@
@if(treatment.Family!="progression"){<p class="marketing-eyebrow">Start here</p><h3>@tool.Name</h3><p class="solver-specific-help">@content.Reason</p>}
<p class="solver-view-shows">@tool.Shows</p>
<p class="solver-look-for"><strong>Look for</strong> @content.LookFor</p>
<a class="marketing-btn marketing-btn--primary solver-result-cta" href="@(signedIn ? "/writing-problems/workspace/"+tool.Id : tool.Tour)">@(signedIn ? "Open "+tool.Name+" in my workspace" : "See how "+tool.Name+" works") <span aria-hidden="true">→</span></a>
<a class="marketing-btn marketing-btn--primary solver-result-cta" href="@(signedIn ? "/problem-solver/workspace/"+tool.Id : tool.Tour)">@(signedIn ? "Open "+tool.Name+" in my workspace" : "See how "+tool.Name+" works") <span aria-hidden="true">→</span></a>
@if(signedIn) { <p class="solver-context-hint">Choose your project first@(tool.WorkspaceRoute.Contains("{characterId}") ? ", then the character you want to follow." : ".")</p> }
else { <p class="solver-context-hint">Explore the tool without signing in.</p> }
</div>

View File

@ -19,5 +19,5 @@
</div>
}
</div>
<p><a class="editorial-link" href="/writing-problems/@solution.Slug">Read and share this advice →</a></p>
<p><a class="editorial-link" href="/problem-solver/@solution.Slug">Read and share this advice →</a></p>
</article>

View File

@ -13,7 +13,7 @@
}
else
{
<form method="get" action="/writing-problems/workspace/@Model.Capability.Id">
<form method="get" action="/problem-solver/workspace/@Model.Capability.Id">
@if(characterChoice) { <input type="hidden" name="projectId" value="@Model.ProjectId" /> }
<label for="solver-workspace-context">@(characterChoice?"Which character would you like to follow?":"Which project would you like to open?")</label>
<select id="solver-workspace-context" name="@(characterChoice?"characterId":"projectId")" required>
@ -24,5 +24,5 @@
<button type="submit" class="marketing-btn marketing-btn--primary">Open @Model.Capability.Name →</button>
</form>
}
<p><a class="editorial-link" href="/writing-problems">Back to the Writing Problem Solver →</a></p>
<p><a class="editorial-link" href="/problem-solver">Back to the Problem Solver →</a></p>
</div></section>

View File

@ -1,6 +1,6 @@
@model PlotLine.Models.WritingSolver.SolverReviewDetail
@{Layout="_PublicLayout";ViewData["Title"]="Writing Solver feedback";var item=Model.Feedback;}
<h1>Writing Solver feedback</h1>
@{Layout="_PublicLayout";ViewData["Title"]="Problem Solver feedback";var item=Model.Feedback;}
<h1>Problem Solver feedback</h1>
<p><a href="/admin/writing-solver-review">← All feedback</a></p>
<p><strong>@item.Category</strong> · @(item.Resolved?"Resolved":"Unresolved") · @item.Captured.CapturedUtc.ToString("u")<br />Step/page: @item.Page</p>
@if(item.Note is not null){<p>@item.Note</p>}

View File

@ -1,9 +1,9 @@
@model PlotLine.Models.WritingSolver.SolverReviewList
@{Layout="_PublicLayout";ViewData["Title"]="Writing Solver Review";}
<h1>Writing Solver Review</h1>
@{Layout="_PublicLayout";ViewData["Title"]="Problem Solver Review";}
<h1>Problem Solver Review</h1>
<p>Development only. Use the ordinary solver; expand “Review journey” only when you need it.</p>
<form method="post" action="/admin/writing-solver-review/mode">@Html.AntiForgeryToken()<input type="hidden" name="enabled" value="@(!Model.Enabled ? "true":"false")" /><button type="submit" class="btn btn-primary">@(Model.Enabled?"Disable":"Enable") Writing Solver Review Mode</button></form>
<p><a href="/writing-problems">Open the Writing Problem Solver →</a></p>
<form method="post" action="/admin/writing-solver-review/mode">@Html.AntiForgeryToken()<input type="hidden" name="enabled" value="@(!Model.Enabled ? "true":"false")" /><button type="submit" class="btn btn-primary">@(Model.Enabled?"Disable":"Enable") Problem Solver Review Mode</button></form>
<p><a href="/problem-solver">Open the Problem Solver →</a></p>
<form method="get"><label>Category <select name="category"><option value="">All categories</option>@foreach(var category in PlotLine.Services.WritingSolverReview.Categories){<option value="@category" selected="@(Model.Category==category)">@category</option>}</select></label> <label>Status <select name="status"><option value="all" selected="@(Model.Status=="all")">All</option><option value="unresolved" selected="@(Model.Status=="unresolved")">Unresolved</option><option value="resolved" selected="@(Model.Status=="resolved")">Resolved</option></select></label> <button type="submit" class="btn btn-secondary">Filter</button></form>
<p>@Model.Items.Count feedback items · newest first</p>
<ul>@foreach(var item in Model.Items){<li><a href="/admin/writing-solver-review/@item.Id">@item.Category — @item.Captured.CapturedUtc.ToString("u")</a> · @(item.Resolved?"Resolved":"Unresolved") · @item.Captured.AnswerCount answers · @item.Captured.StopReason</li>}</ul>