From 0cd2c2a6abf75193794a7c7a4c3275d347318949 Mon Sep 17 00:00:00 2001 From: mirivlad Date: Tue, 14 Jul 2026 19:38:00 +0800 Subject: [PATCH] test: cover activity deletion confirmation --- scripts/smoke-activity-plugin.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/smoke-activity-plugin.js b/scripts/smoke-activity-plugin.js index ecec755..ff859b4 100644 --- a/scripts/smoke-activity-plugin.js +++ b/scripts/smoke-activity-plugin.js @@ -361,6 +361,13 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w if (!clearButton) throw new Error('clear activity button not found'); clearButton.click(); await flush(); + if (api.storedEvents(projectKey).length === 0) throw new Error('clear action removed activity before confirmation'); + const clearConfirmation = walk(container, (node) => node.getAttribute && node.getAttribute('data-activity-clear-confirmation') === ''); + if (!clearConfirmation) throw new Error('clear activity confirmation was not rendered'); + const confirmClear = walk(clearConfirmation, (node) => node.getAttribute && node.getAttribute('data-activity-clear-confirm') === ''); + if (!confirmClear) throw new Error('clear activity confirmation button was not rendered'); + confirmClear.click(); + await flush(); if (api.storedEvents(projectKey).length !== 0) throw new Error('clear action did not remove activity events'); if (api.storedEvents('work-session-candidates:workspace:Project').length !== 0) throw new Error('clear action did not remove cached candidates'); @@ -531,6 +538,13 @@ async function mountWithApi(api, props = { workspaceNode: { name: 'Project' }, w const rawClear = walk(rawView.container, (node) => node.getAttribute && node.getAttribute('data-activity-action') === 'clear'); rawClear.click(); await flush(); + if (rawApi.storedData('activity-events').length === 0) throw new Error('append-only activity was removed before confirmation'); + const rawClearConfirmation = walk(rawView.container, (node) => node.getAttribute && node.getAttribute('data-activity-clear-confirmation') === ''); + if (!rawClearConfirmation) throw new Error('append-only activity confirmation was not rendered'); + const rawConfirmClear = walk(rawClearConfirmation, (node) => node.getAttribute && node.getAttribute('data-activity-clear-confirm') === ''); + if (!rawConfirmClear) throw new Error('append-only activity confirmation button was not rendered'); + rawConfirmClear.click(); + await flush(); if (rawApi.storedData('activity-events').length !== 0) throw new Error('clear activity did not replace append-only data'); component.unmount && component.unmount(rawView.container);