diff --git a/frontend/e2e/journal-global.spec.js b/frontend/e2e/journal-global.spec.js new file mode 100644 index 0000000..48a94db --- /dev/null +++ b/frontend/e2e/journal-global.spec.js @@ -0,0 +1,35 @@ +import { test, expect } from '@playwright/test'; +import { waitForAppReady, setupConsoleCollector, resetMockState } from './helpers.js'; + +test('global Journal creates an entry in the selected Deal', async ({ page }) => { + const consoleCollector = setupConsoleCollector(page); + await resetMockState(page); + await page.goto('/'); + await waitForAppReady(page); + await page.evaluate(async () => { + await window.go.api.App.WritePluginSettings('verstak.journal', { + 'worklog:workspace:Project': [{ entryId: 'existing-project-entry', workspaceRootPath: 'Project', date: '2026-07-14', title: 'Existing entry', minutes: 5 }], + }); + }); + + await page.locator('.sidebar .plugin-item').filter({ hasText: 'Journal' }).click(); + const journal = page.locator('.journal-root'); + await expect(journal.locator('.journal-title')).toHaveText('Journal'); + await journal.locator('[data-journal-action="add"]').click(); + await journal.locator('[data-journal-input="workspaceRootPath"]').selectOption('Project'); + await journal.locator('[data-journal-input="title"]').fill('Prepare project handoff'); + await journal.locator('[data-journal-input="minutes"]').fill('30'); + await journal.locator('[data-journal-action="save-entry"]').click(); + + await expect.poll(async () => page.evaluate(async () => { + const result = await window.go.api.App.ReadPluginSettings('verstak.journal'); + const settings = Array.isArray(result) ? result[0] : result; + return settings['worklog:workspace:Project']?.[0]?.title; + })).toBe('Prepare project handoff'); + await expect(journal).toContainText('Prepare project handoff'); + + await page.locator('.wt-label').filter({ hasText: 'Project' }).click(); + await page.getByRole('tab', { name: 'Journal' }).click(); + await expect(page.locator('.journal-root')).toContainText('Prepare project handoff'); + consoleCollector.assertNoErrors(); +}); diff --git a/frontend/src/lib/test/wails-mock.js b/frontend/src/lib/test/wails-mock.js index a59cf5e..6b51b57 100644 --- a/frontend/src/lib/test/wails-mock.js +++ b/frontend/src/lib/test/wails-mock.js @@ -8,6 +8,7 @@ import defaultEditorSource from '../../../../../verstak-official-plugins/plugins 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'; import todoSource from '../../../../../verstak-official-plugins/plugins/todo/frontend/src/index.js?raw'; +import journalSource from '../../../../../verstak-official-plugins/plugins/journal/frontend/src/index.js?raw'; (function () { if (window.__wailsMockReady) return; @@ -224,7 +225,7 @@ import todoSource from '../../../../../verstak-official-plugins/plugins/todo/fro source: 'official', icon: 'book-open', provides: ['worklog', 'journal', 'report.worklog'], - permissions: ['storage.namespace', 'ui.register'], + permissions: ['events.publish', 'files.read', 'storage.namespace', 'ui.register'], frontend: { entry: 'frontend/dist/index.js' }, contributes: { views: [{ id: 'verstak.journal.view', title: 'Journal', icon: 'book-open', component: 'JournalView' }], @@ -3558,7 +3559,7 @@ import todoSource from '../../../../../verstak-official-plugins/plugins/todo/fro return Promise.resolve(activitySource); } if (pluginId === 'verstak.journal' && assetPath === 'frontend/dist/index.js') { - return Promise.resolve(journalBundle()); + return Promise.resolve(journalSource); } if (pluginId === 'verstak.browser-inbox' && assetPath === 'frontend/dist/index.js') { return Promise.resolve(browserInboxBundle()); @@ -4175,7 +4176,7 @@ import todoSource from '../../../../../verstak-official-plugins/plugins/todo/fro source: 'official', icon: 'book-open', provides: ['worklog', 'journal', 'report.worklog'], - permissions: ['storage.namespace', 'ui.register'], + permissions: ['events.publish', 'files.read', 'storage.namespace', 'ui.register'], frontend: { entry: 'frontend/dist/index.js' }, contributes: { views: [{ id: 'verstak.journal.view', title: 'Journal', icon: 'book-open', component: 'JournalView' }],