test: cover activity deletion confirmation
This commit is contained in:
parent
fe64e1f822
commit
e223ccccc6
|
|
@ -27,6 +27,38 @@ test.describe('Activity workflow', () => {
|
|||
await expect(activity.locator('[data-activity-action="clear"]')).toBeDisabled();
|
||||
});
|
||||
|
||||
test('clearing activity requires destructive confirmation for the current case', async ({ page }) => {
|
||||
await page.evaluate(async () => {
|
||||
await window.go.api.App.WritePluginSettings('verstak.activity', {
|
||||
'events:workspace:Project': [{
|
||||
activityId: 'activity-to-clear',
|
||||
occurredAt: '2026-06-30T08:00:00.000Z',
|
||||
type: 'note.saved',
|
||||
title: 'Keep until confirmed',
|
||||
workspaceRootPath: 'Project',
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
await page.getByRole('tab', { name: 'Activity' }).click();
|
||||
const activity = page.locator('.activity-root');
|
||||
await expect(activity.locator('.activity-count')).toHaveText('1 event');
|
||||
|
||||
await activity.locator('[data-activity-action="clear"]').click();
|
||||
const confirmation = activity.locator('[data-activity-clear-confirmation]');
|
||||
await expect(confirmation).toBeVisible();
|
||||
await expect(confirmation).toContainText(/Project|Дело/);
|
||||
await expect(activity.locator('.activity-count')).toHaveText('1 event');
|
||||
|
||||
await confirmation.locator('[data-activity-clear-cancel]').click();
|
||||
await expect(confirmation).toHaveCount(0);
|
||||
await expect(activity.locator('.activity-count')).toHaveText('1 event');
|
||||
|
||||
await activity.locator('[data-activity-action="clear"]').click();
|
||||
await activity.locator('[data-activity-clear-confirm]').click();
|
||||
await expect(activity.locator('.activity-count')).toHaveText('0 events');
|
||||
});
|
||||
|
||||
test('workspace activity keeps raw events and renders factual work session candidates', async ({ page }) => {
|
||||
await page.evaluate(async () => {
|
||||
await window.go.api.App.WritePluginSettings('verstak.activity', {
|
||||
|
|
@ -75,7 +107,7 @@ test.describe('Activity workflow', () => {
|
|||
const candidate = candidateSection.locator('[data-work-session-candidate]');
|
||||
await expect(candidate).toHaveCount(1);
|
||||
await expect(candidate).toContainText('Workspace: Project');
|
||||
await expect(candidate).toContainText('Estimated duration: 20 min');
|
||||
await expect(candidate).toContainText('Estimated duration: 10 min');
|
||||
await expect(candidate).toContainText('Activities: 2');
|
||||
await expect(candidate).not.toContainText('Project work on');
|
||||
await expect(candidate.locator('[data-work-session-action="review"]')).toBeVisible();
|
||||
|
|
@ -111,10 +143,10 @@ test.describe('Activity workflow', () => {
|
|||
const journal = page.locator('.journal-root');
|
||||
await expect(journal).toBeVisible({ timeout: 10000 });
|
||||
await expect(journal.locator('[data-journal-candidate]')).toContainText('Workspace: Project');
|
||||
await expect(journal.locator('[data-journal-candidate]')).toContainText('Estimated duration: 20 min');
|
||||
await expect(journal.locator('[data-journal-candidate]')).toContainText('Estimated duration: 10 min');
|
||||
await expect(journal.locator('[data-journal-input="title"]')).toHaveValue('');
|
||||
await expect(journal.locator('[data-journal-input="summary"]')).toHaveValue('');
|
||||
await expect(journal.locator('[data-journal-input="minutes"]')).toHaveValue('20');
|
||||
await expect(journal.locator('[data-journal-input="minutes"]')).toHaveValue('10');
|
||||
|
||||
const activityInputs = journal.locator('[data-journal-candidate-activity]');
|
||||
await expect(activityInputs).toHaveCount(2);
|
||||
|
|
@ -126,7 +158,7 @@ test.describe('Activity workflow', () => {
|
|||
await journal.locator('[data-journal-action="save-entry"]').click();
|
||||
|
||||
await expect(journal).toContainText('Review research capture');
|
||||
await expect(journal).toContainText('20 min');
|
||||
await expect(journal).toContainText('10 min');
|
||||
const stored = await page.evaluate(async () => {
|
||||
const result = await window.go.api.App.ReadPluginSettings('verstak.journal');
|
||||
return Array.isArray(result) ? result[0]['worklog:workspace:Project'] : result['worklog:workspace:Project'];
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
import defaultEditorSource from '../../../../../verstak-official-plugins/plugins/default-editor/frontend/src/index.js?raw';
|
||||
import secretsSource from '../../../../../verstak-official-plugins/plugins/secrets/frontend/src/index.js?raw';
|
||||
import activitySource from '../../../../../verstak-official-plugins/plugins/activity/frontend/src/index.js?raw';
|
||||
|
||||
(function () {
|
||||
if (window.__wailsMockReady) return;
|
||||
|
|
@ -3536,8 +3537,8 @@ import secretsSource from '../../../../../verstak-official-plugins/plugins/secre
|
|||
if (pluginId === 'verstak.notes' && assetPath === 'frontend/dist/index.js') {
|
||||
return Promise.resolve(simplePluginBundle('verstak.notes', 'NotesView', 'notes-root', 'Notes'));
|
||||
}
|
||||
if (pluginId === 'verstak.activity' && assetPath === 'frontend/dist/index.js') {
|
||||
return Promise.resolve(activityBundle());
|
||||
if (pluginId === 'verstak.activity') {
|
||||
return Promise.resolve(activitySource);
|
||||
}
|
||||
if (pluginId === 'verstak.journal' && assetPath === 'frontend/dist/index.js') {
|
||||
return Promise.resolve(journalBundle());
|
||||
|
|
|
|||
Loading…
Reference in New Issue