diff --git a/.github/workflows/reusable_build-and-test.yaml b/.github/workflows/reusable_build-and-test.yaml index bdf550d81..9e562b8f8 100644 --- a/.github/workflows/reusable_build-and-test.yaml +++ b/.github/workflows/reusable_build-and-test.yaml @@ -216,7 +216,7 @@ jobs: go env GOWORK - run: docker compose up -d --wait --wait-timeout 240 - env: - PLAYWRIGHT_TESTS_TO_RUN: roundtrip + PLAYWRIGHT_TESTS_TO_RUN: roundtrip huge run: |- ./wait-and-test.sh platform diff --git a/web-app/tests/tests/huge.spec.ts b/web-app/tests/tests/huge.spec.ts index e9822a6e1..c670ce61d 100644 --- a/web-app/tests/tests/huge.spec.ts +++ b/web-app/tests/tests/huge.spec.ts @@ -2,6 +2,12 @@ import { test, expect, type Page } from '@playwright/test'; import fs from 'node:fs'; import { authorize, loadFile } from './acts.js'; +test.use({ + launchOptions: { + args: ['--js-flags=--max-old-space-size=512'], + }, +}); + test.beforeEach(async ({ page }) => { page.on('pageerror', (err) => { console.error(err); @@ -13,7 +19,10 @@ test.beforeEach(async ({ page }) => { test('Large File', async ({ page }) => { await authorize(page); - await page.goto(`${appUrl}?segmentBatchSize=2&maxConcurrentSegmentBatches=1`); + const currentUrl = new URL(page.url()); + currentUrl.searchParams.set('segmentBatchSize', '2'); + currentUrl.searchParams.set('maxConcurrentSegmentBatches', '1'); + await page.goto(currentUrl.toString()); await expect(page.locator('#sessionState')).toHaveText('loggedin'); const decryptTuningLogs: string[] = []; diff --git a/web-app/tests/tests/roundtrip.spec.ts b/web-app/tests/tests/roundtrip.spec.ts index 6b69b69d6..7fc814356 100644 --- a/web-app/tests/tests/roundtrip.spec.ts +++ b/web-app/tests/tests/roundtrip.spec.ts @@ -100,3 +100,60 @@ test('Remote Source Streaming', async ({ page }) => { server.close(); } }); + +test('Large File', async ({ page }) => { + await authorize(page); + const currentUrl = new URL(page.url()); + currentUrl.searchParams.set('segmentBatchSize', '2'); + currentUrl.searchParams.set('maxConcurrentSegmentBatches', '1'); + await page.goto(currentUrl.toString()); + await expect(page.locator('#sessionState')).toHaveText('loggedin'); + + const decryptTuningLogs: string[] = []; + page.on('console', (message) => { + const text = message.text(); + if (text.includes('Using decrypt read tuning')) { + decryptTuningLogs.push(text); + } + }); + + const threeGigs = 3 * 2 ** 30; + await page.locator('#randomSelector').fill(threeGigs.toString()); + + const downloadPromise = page.waitForEvent('download'); + await page.locator('#fileSink').click(); + await page.locator('#encryptButton').click(); + + const download = await downloadPromise; + const cipherTextPath = await download.path(); + try { + expect(download.suggestedFilename()).toContain('bytes'); + expect(cipherTextPath).toBeTruthy(); + if (!cipherTextPath) { + throw new Error(); + } + + await page.locator('#randomSelector').clear(); + await loadFile(page, cipherTextPath); + const plainDownloadPromise = await page.waitForEvent('download', { timeout: 60000 }); + await page.locator('#fileSink').click(); + await page.locator('#decryptButton').click(); + const download2 = await plainDownloadPromise; + expect(download2.suggestedFilename()).toContain('.decrypted'); + expect(decryptTuningLogs).toEqual([ + 'Using decrypt read tuning {"segmentBatchSize":2,"maxConcurrentSegmentBatches":1}', + ]); + const plainTextPath = await download2.path(); + if (!plainTextPath) { + throw new Error(); + } + try { + const stats = fs.statSync(plainTextPath); + expect(stats).toHaveProperty('size', threeGigs); + } finally { + plainTextPath && fs.unlinkSync(plainTextPath); + } + } finally { + cipherTextPath && fs.unlinkSync(cipherTextPath); + } +});