From 87b15b12f6c3258cba3bdaec2bc5458ffba82bf3 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:28:31 +0100 Subject: [PATCH] test: check Keep offline in the Files app --- integration/tests/22-ent-offline.spec.ts | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/integration/tests/22-ent-offline.spec.ts b/integration/tests/22-ent-offline.spec.ts index 694c02931..5e2b6e642 100644 --- a/integration/tests/22-ent-offline.spec.ts +++ b/integration/tests/22-ent-offline.spec.ts @@ -863,6 +863,42 @@ test('nothing of a kept message is readable on the device', async ({ browser }) await page.context().close(); }); +test('Keep offline in the Files app keeps the file, and the settings list it', async ({ browser }) => { + const name = `kept-${RUN}.txt`; + const client = await jmapAs(ENT.alice); + const auth = 'Basic ' + Buffer.from(`${ENT.alice}:${process.env.IT_ENT_PASSWORD}`).toString('base64'); + const upload = await fetch(`${JMAP_URL}/jmap/upload/${client.accountId}/`, { method: 'POST', headers: { Authorization: auth, 'Content-Type': 'text/plain' }, body: `Kept file ${RUN}` }); + expect(upload.ok).toBe(true); + const { blobId } = await upload.json() as { blobId: string }; + const made = await client.request([['FileNode/set', { accountId: client.accountId, create: { f: { name, blobId, parentId: null, type: 'text/plain' } } }, '0']], ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:filenode']); + const created = made.methodResponses[0][1].created?.f as { id: string } | undefined; + expect(created, JSON.stringify(made.methodResponses[0][1])).toBeTruthy(); + try { + const page = await userPage(browser, ENT.alice); + await enableOffline(page); + await page.goto('/files'); + const row = page.getByText(name, { exact: true }).first(); + await expect(row).toBeVisible({ timeout: 60_000 }); + await row.click({ button: 'right' }); + await page.getByRole('menuitem', { name: 'Keep offline' }).click(); + await page.goto('/settings/backup/offline'); + await expect(page.getByTestId('offline-kept-file').filter({ hasText: name })).toHaveAttribute('data-kept', 'true', { timeout: 120_000 }); + await page.getByTestId('offline-kept-files').scrollIntoViewIfNeeded(); + await shot(page, 'do-storage-page-kept-files'); + + await page.goto('/files'); + await expect(row).toBeVisible({ timeout: 60_000 }); + await row.click({ button: 'right' }); + await page.getByRole('menuitem', { name: 'Stop keeping offline' }).click(); + await page.goto('/settings/backup/offline'); + await expect(page.getByTestId('offline-account')).toBeVisible({ timeout: 60_000 }); + await expect(page.getByTestId('offline-kept-file').filter({ hasText: name })).toHaveCount(0, { timeout: 30_000 }); + await page.context().close(); + } finally { + await client.request([['FileNode/set', { accountId: client.accountId, destroy: [created!.id] }, '0']], ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:filenode']).catch(() => {}); + } +}); + test('the admin page saves the caps and no longer promises 30 days or 250 MB', async ({ browser }) => { const admin = await adminContext(browser); const page = await admin.newPage();