Qualify live Writer journeys and clarify manuscript count coverage

This commit is contained in:
Nick Beckley 2026-11-15 09:23:59 +00:00
parent a0c2367dd9
commit 7f7630e345
3 changed files with 12 additions and 6 deletions

View File

@ -14,7 +14,8 @@ const assert=require('node:assert/strict');
try{for(const pwa of [false,true]){
const context=await browser.newContext({viewport:{width:1440,height:1000}});
if(pwa)await context.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));
const page=await context.newPage();
const page=await context.newPage(); const failures=[];
page.on('response', response=>{if(response.request().isNavigationRequest()&&response.request().frame()===page.mainFrame()&&response.status()>=400)failures.push(response.status()+' '+new URL(response.url()).pathname);});
await page.goto(base+'/Account/Login');await page.locator('[name=Email]').fill(who.Email);await page.locator('[name=Password]').fill(who.Password);
await Promise.all([page.waitForURL('**/Projects'),page.locator('button[type=submit]').click()]);
await page.goto(writer);
@ -46,7 +47,7 @@ const assert=require('node:assert/strict');
if(allBooks)await page.locator('[name=BookID]').selectOption('');
await Promise.all([page.waitForURL('**/Writer/SchedulePreview?writingPlanId=*'),page.getByRole('button',{name:'Create Plan and Generate Schedule'}).click()]);
await page.getByRole('link',{name:'Edit Plan',exact:true}).click();await page.waitForURL('**/Writer/EditWritingPlan?writingPlanId=*');
assert((await page.locator('body').textContent()).includes(allBooks?'All Books':'Writer verification book'));
assert.equal(await page.locator('input[readonly]').nth(1).inputValue(),allBooks?'All Books':'Writer verification book');
await page.locator('[name=PlanName]').fill(allBooks?'Updated project-wide plan':'Updated book plan');
await Promise.all([page.waitForURL('**/Writer/WritingPlans?*'),page.getByRole('button',{name:'Save Plan',exact:true}).click()]);
assert((await page.locator('body').textContent()).includes(allBooks?'Updated project-wide plan':'Updated book plan'));
@ -56,14 +57,15 @@ const assert=require('node:assert/strict');
assert((await page.locator('body').textContent()).includes('Updated book plan'));
}
for(const title of ['Writing Journey','Writing Plan','Workspaces','Reports']){
await page.goto(writer);const link=page.locator('#ribbon-panel-writer a').filter({hasText:new RegExp('^'+title+'$')});
await page.goto(writer);const link=page.locator('#ribbon-panel-writer').getByRole('link',{name:title,exact:true});
assert.equal(await link.count(),1);await link.click();await page.waitForLoadState();assert.equal(await page.locator('h1').count(),1);assert(!(await page.locator('body').textContent()).includes('An error occurred'));
assert(new URL(page.url()).searchParams.get('bookId')===String(scope.book),`${title} retains book`);
}
await page.goto(`${base}/Writer?projectId=${scope.project}&bookId=${scope.other}`);assert.equal(await page.getByRole('heading',{name:'Start Here',exact:true}).isVisible(),true);
await page.goto(writer);assert.equal(await page.getByRole('heading',{name:'Continue Writing',exact:true}).isVisible(),true);
await page.getByRole('link',{name:'Change objective'}).click();assert.equal(await page.locator('[name=Activity]').inputValue(),'Revising');assert.equal(await page.locator('[data-objective-scene]').inputValue(),String(scope.scene));
assert.deepEqual(failures,[]);
console.log(`PASS live Writer author journey: ${pwa?'simulated PWA':'browser'}; real chapter/scene destinations, saved objective, optional scheduling, ribbon and book isolation`);
await context.close();
}}finally{await browser.close();}
})().catch(error=>{console.error(error.message);process.exitCode=1;});
})().catch(error=>{console.error(error.stack);process.exitCode=1;});

View File

@ -11,6 +11,8 @@
var totals=Model.Activity?.Totals.HasAcceptedEvidence==true?Model.Activity.Totals:null;
var showWorkspace = Context.Request.RouteValues["action"]?.ToString() == "Workspaces";
var queues=new[]{("WriteNext","Write Next",Model.WriteNext),("InProgress","In Progress",Model.ContinueWriting),("Revision","Revision",Model.RevisionQueue),("FinalPass","Final Pass",Model.PolishingQueue)};
var latestAccepted = Model.Activity?.Events.FirstOrDefault(e => e.Kind != "Observation");
var manuscriptWords = latestAccepted?.WordsAfter ?? Model.Book?.CurrentWordCount;
var days=Model.Activity?.Days??Array.Empty<PlotLine.Models.WritingActivityDay>();
var maximum=Math.Max(1L,days.Select(x=>x.Added+x.Removed).DefaultIfEmpty(1).Max());
}
@ -37,14 +39,16 @@
{
<section class="writer-card writer-progress" aria-label="Writing Progress">
<div><p class="eyebrow">Writing Progress · last 30 days</p><h2>Your Manuscript</h2>
<p>@(Model.Book?.CurrentWordCount.ToString("N0") ?? "—") words · @(Model.Book?.ChapterCount ?? 0) chapters · @(Model.Book?.SceneCount ?? 0) scenes</p>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Open Chapters</a>}</div>
<p>@(manuscriptWords?.ToString("N0") ?? "—") @(latestAccepted != null ? "words at last accepted snapshot" : "catalogued words") · @(Model.Book?.ChapterCount ?? 0) @(Model.Book?.ChapterCount == 1 ? "chapter" : "chapters") · @(Model.Book?.SceneCount ?? 0) @(Model.Book?.SceneCount == 1 ? "scene" : "scenes")</p>@if(bookId.HasValue){<a asp-controller="Books" asp-action="Details" asp-route-id="@bookId" asp-fragment="chapters">Open Chapters</a>}</div>
@if(totals != null && (totals.Added > 0 || totals.Removed > 0))
{
<div class="writer-activity-graphic"><div class="writer-change-track"><span class="writer-change-added" style="flex:@totals.Added"></span><span class="writer-change-removed" style="flex:@totals.Removed"></span></div><p><strong>+@totals.Added.ToString("N0")</strong> added · <strong>−@totals.Removed.ToString("N0")</strong> removed · <strong>@totals.Net.ToString("+0;-0;0")</strong> net</p></div>
}
else{<p class="writer-empty">@(totals?.HasAcceptedEvidence == true ? "Tracking begins at your manuscript baseline. New accepted changes will appear here." : "Activity begins with your first accepted manuscript baseline. Earlier writing cannot be reconstructed.")</p>}
@if(queues.Any(q=>q.Item3.Count>0)){
<div class="writer-workflow-progress" aria-label="Scenes in writing workspace queues">@foreach(var q in queues.Where(x=>x.Item3.Count>0)){<span class="writer-stage-@q.Item1" style="flex:@q.Item3.Count" title="@q.Item2: @q.Item3.Count scenes"></span>}</div>
<div class="writer-workflow-strip" aria-label="Scene workflow stages">@foreach(var q in queues){<a asp-action="Workspaces" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@bookId" asp-route-workspace="@q.Item1"><strong>@q.Item3.Count</strong> @q.Item2</a>}</div>
}
@if(bookId.HasValue){<a asp-controller="WritingActivity" asp-action="Index" asp-route-bookId="@bookId">Reports &amp; activity settings</a>}
</section>
}

View File

@ -19,7 +19,7 @@ else if(Model.BookID.HasValue)
<div class="writer-start-paths">
<a class="writer-path" href="#objective-setup" data-open-objective><strong>Continue an existing manuscript</strong><span>Choose a chapter or scene and your working activity.</span></a>
<a class="writer-path" asp-action="ScheduleSetup" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID"><strong>Plan your writing time</strong><span>Set availability, goals and a deadline.</span></a>
<a class="writer-path" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters"><strong>Explore your manuscript</strong><span>@Model.Book?.ChapterCount chapters · @Model.Book?.SceneCount scenes</span></a>
<a class="writer-path" asp-controller="Books" asp-action="Details" asp-route-id="@Model.BookID" asp-fragment="chapters"><strong>Explore your manuscript</strong><span>@Model.Book?.ChapterCount @(Model.Book?.ChapterCount == 1 ? "chapter" : "chapters") · @Model.Book?.SceneCount @(Model.Book?.SceneCount == 1 ? "scene" : "scenes")</span></a>
</div>
<details id="objective-setup" open="@editing">
<summary>Choose your working objective</summary>