test: cover global Journal entry assignment
This commit is contained in:
parent
c3836ef1a6
commit
b6290aa8ee
|
|
@ -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();
|
||||||
|
});
|
||||||
|
|
@ -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 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 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 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 () {
|
(function () {
|
||||||
if (window.__wailsMockReady) return;
|
if (window.__wailsMockReady) return;
|
||||||
|
|
@ -224,7 +225,7 @@ import todoSource from '../../../../../verstak-official-plugins/plugins/todo/fro
|
||||||
source: 'official',
|
source: 'official',
|
||||||
icon: 'book-open',
|
icon: 'book-open',
|
||||||
provides: ['worklog', 'journal', 'report.worklog'],
|
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' },
|
frontend: { entry: 'frontend/dist/index.js' },
|
||||||
contributes: {
|
contributes: {
|
||||||
views: [{ id: 'verstak.journal.view', title: 'Journal', icon: 'book-open', component: 'JournalView' }],
|
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);
|
return Promise.resolve(activitySource);
|
||||||
}
|
}
|
||||||
if (pluginId === 'verstak.journal' && assetPath === 'frontend/dist/index.js') {
|
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') {
|
if (pluginId === 'verstak.browser-inbox' && assetPath === 'frontend/dist/index.js') {
|
||||||
return Promise.resolve(browserInboxBundle());
|
return Promise.resolve(browserInboxBundle());
|
||||||
|
|
@ -4175,7 +4176,7 @@ import todoSource from '../../../../../verstak-official-plugins/plugins/todo/fro
|
||||||
source: 'official',
|
source: 'official',
|
||||||
icon: 'book-open',
|
icon: 'book-open',
|
||||||
provides: ['worklog', 'journal', 'report.worklog'],
|
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' },
|
frontend: { entry: 'frontend/dist/index.js' },
|
||||||
contributes: {
|
contributes: {
|
||||||
views: [{ id: 'verstak.journal.view', title: 'Journal', icon: 'book-open', component: 'JournalView' }],
|
views: [{ id: 'verstak.journal.view', title: 'Journal', icon: 'book-open', component: 'JournalView' }],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue