Check existing scene workflow items in Intent acceptance

This commit is contained in:
Codex 2026-12-05 09:38:10 +00:00
parent 84a258652c
commit aac04e17d1

View File

@ -34,8 +34,8 @@ let session, stage = 'login';
await session.page.locator('[data-context-tab]').first().selectOption('intent');
const checklist = session.page.locator('[data-intent-checklist]');
const items = checklist.locator('[data-checklist-items] > li');
const getChecklist = () => session.page.evaluate(async ({bookID,chapterID}) =>
(await fetch('/Writing/Context/Intent/Checklist?' + new URLSearchParams({bookID,chapterID}))).json(), base);
const getChecklist = (scope = {}) => session.page.evaluate(async query =>
(await fetch('/Writing/Context/Intent/Checklist?' + new URLSearchParams(query))).json(), {...base,...scope});
stage='empty chapter Intent controls';
await checklist.getByText('No checklist items',{exact:true}).waitFor({state:'visible'});
await checklist.getByRole('button',{name:'Add item',exact:true}).waitFor({state:'visible'});
@ -136,8 +136,14 @@ let session, stage = 'login';
!document.querySelector('[data-checklist-items]').inert);
assert.deepEqual((await getChecklist()).items[0].links,[{key:'character:'+person,name,covered:true}]);
stage='switch to scene checklist and return to chapter';
// Opening Scenes/Edit seeds the existing scene workflow checklist.
const expectedSceneItems = (await getChecklist({sceneID:first})).items.map(item => item.text);
assert(expectedSceneItems.includes('Purpose clear'));
assert(!expectedSceneItems.includes('Establish the setting'));
await checklist.getByLabel('Scene checklist').check();
await checklist.getByText('No checklist items',{exact:true}).waitFor();
const sceneItems = items.getByLabel('Item',{exact:true});
await sceneItems.first().waitFor({state:'visible'});
assert.deepEqual(await sceneItems.evaluateAll(fields => fields.map(field => field.value)), expectedSceneItems);
await checklist.getByLabel('Scene checklist').uncheck();
await items.first().getByLabel('Palette shared name covered').waitFor();
stage='collapse Story Elements';