From ba34d333087e4919c7bba87ebd1d3fcd17668d62 Mon Sep 17 00:00:00 2001 From: "chris.dumas" Date: Mon, 26 Oct 2026 17:02:54 +0000 Subject: [PATCH] Cover portal navigation and manager workflows --- e2e/portal.spec.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/e2e/portal.spec.js b/e2e/portal.spec.js index 4daa2ba..7bb8ec0 100644 --- a/e2e/portal.spec.js +++ b/e2e/portal.spec.js @@ -270,4 +270,41 @@ test.describe('ComfyUI Portal read-only UI states', () => { await expect.poll(() => requests).toEqual(['POST']); await expect(page.getByRole('button', { name: 'Restart ComfyUI' })).toBeEnabled(); }); + + test('redirects an authenticated unknown route back to the job monitor', async ({ page }) => { + await mockReadOnlyApi(page); + await page.goto('/does-not-exist'); + await expect(page).toHaveURL(/\/jobs/); + await expect(page.getByRole('heading', { name: 'Job monitor' })).toBeVisible(); + }); + + test('sends the selected Manager version through the mocked switch flow', async ({ page }) => { + let payload = null; + await mockReadOnlyApi(page); + await page.route('**/api/comfy/switch-version', async (route) => { + payload = JSON.parse(route.request().postData() || '{}'); + await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ message: 'Request accepted.' }) }); + }); + await page.goto('/jobs'); + await page.locator('select').selectOption('0.2.9'); + page.once('dialog', dialog => dialog.accept()); + await page.getByRole('button', { name: 'Switch version' }).click(); + await expect(page.getByText('Request accepted.')).toBeVisible(); + await expect.poll(() => payload).toEqual({ version: '0.2.9' }); + }); + + test('enters the update-all busy state after a mocked confirmation', async ({ page }) => { + let requestCount = 0; + await mockReadOnlyApi(page); + await page.route('**/api/comfy/update-all', async (route) => { + requestCount += 1; + await route.fulfill({ status: 202, contentType: 'application/json', body: JSON.stringify({ message: 'Update all started.' }) }); + }); + await page.goto('/jobs'); + page.once('dialog', dialog => dialog.accept()); + await page.getByRole('button', { name: 'Update all' }).click(); + await expect(page.getByRole('button', { name: 'Updating everything…' })).toBeDisabled(); + await expect(page.getByText('Update all started. Checking progress…')).toBeVisible(); + await expect.poll(() => requestCount).toBe(1); + }); });