diff --git a/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs b/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs index e1eb3fc0..a9f20717 100644 --- a/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs +++ b/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs @@ -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';