From 6179ad73e7d6a855bccf4fa93cde33fa30d9572c Mon Sep 17 00:00:00 2001 From: mirivlad Date: Tue, 14 Jul 2026 20:50:14 +0800 Subject: [PATCH] test: cover typed Todo reminder times --- frontend/e2e/todo.spec.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/e2e/todo.spec.js b/frontend/e2e/todo.spec.js index ec934e7..3435272 100644 --- a/frontend/e2e/todo.spec.js +++ b/frontend/e2e/todo.spec.js @@ -28,12 +28,9 @@ test.describe('Todo plugin workflow', () => { await todos.locator('[data-todo-input="priority"]').selectOption('high'); await todos.locator('[data-todo-input="dueAt"]').fill('2000-01-01'); await todos.locator('[data-todo-input="reminderDate"]').fill('2000-01-01'); - const reminderHour = todos.locator('[data-todo-input="reminderHour"]'); - const reminderMinute = todos.locator('[data-todo-input="reminderMinute"]'); - await expect(reminderHour).toHaveCSS('appearance', 'none'); - await expect(reminderMinute).toHaveCSS('appearance', 'none'); - await reminderHour.selectOption('09'); - await reminderMinute.selectOption('30'); + const reminderTime = todos.locator('[data-todo-input="reminderTime"]'); + await expect(reminderTime).toHaveAttribute('type', 'text'); + await reminderTime.fill('09:30'); await todos.locator('[data-todo-action="save"]').click(); await expect(todos).toContainText('Overdue'); @@ -42,13 +39,23 @@ test.describe('Todo plugin workflow', () => { const result = await window.go.api.App.ReadPluginSettings('verstak.todo'); const settings = Array.isArray(result) ? result[0] : result; const todo = settings['todos:global'].find((item) => item.title === 'Prepare project review'); - return todo && [todo.workspaceRootPath, todo.priority, todo.dueAt, todo.reminderAt].join('|'); - })).toBe('Project|high|2000-01-01|2000-01-01T09:30'); + return todo && [todo.workspaceRootPath, todo.priority, todo.dueAt, todo.reminderDate, todo.reminderAt].join('|'); + })).toBe('Project|high|2000-01-01|2000-01-01|2000-01-01T09:30'); await todos.locator('[data-todo-action="edit"]').click(); await todos.locator('[data-todo-input="title"]').fill('Prepare project review updated'); + await todos.locator('[data-todo-input="reminderTime"]').fill('not-a-time'); + await todos.locator('[data-todo-action="save"]').click(); + await expect(todos).toContainText('Enter a valid reminder time'); + await todos.locator('[data-todo-input="reminderTime"]').fill(''); await todos.locator('[data-todo-action="save"]').click(); await expect(todos).toContainText('Prepare project review updated'); + await expect.poll(async () => page.evaluate(async () => { + const result = await window.go.api.App.ReadPluginSettings('verstak.todo'); + const settings = Array.isArray(result) ? result[0] : result; + const todo = settings['todos:global'].find((item) => item.title === 'Prepare project review updated'); + return todo && [todo.reminderDate, todo.reminderAt].join('|'); + })).toBe('2000-01-01|'); await todos.locator('[data-todo-action="mark-done"]').click(); await expect(todos.locator('[data-todo-action="create-journal-entry"]')).toBeVisible();