From 04a26f40a0a874df3c9c582817f80e2bfb1b626a Mon Sep 17 00:00:00 2001 From: Giteabot Date: Thu, 9 Jul 2026 06:57:50 -0700 Subject: [PATCH] test(e2e): fix race in pdf file render test (#38380) (#38381) Backport #38380 by @silverwind `data-render-name` is set before the plugin's async render runs, so measuring the container height right after the attribute appears can observe the pre-render 48px height when the `pdfobject` chunk loads slowly (flaked in CI). Poll for the height instead, like the asciicast test in the same file does. Co-authored-by: silverwind --- tests/e2e/file-view-render.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/file-view-render.test.ts b/tests/e2e/file-view-render.test.ts index 707a82a02b..a90a06331c 100644 --- a/tests/e2e/file-view-render.test.ts +++ b/tests/e2e/file-view-render.test.ts @@ -35,7 +35,7 @@ test('pdf file', async ({page, request}) => { await page.goto(`/${owner}/${repoName}/src/branch/main/test.pdf`); const container = page.locator('.file-view-render-container'); await expect(container).toHaveAttribute('data-render-name', 'pdf-viewer'); - expect((await container.boundingBox())!.height).toBeGreaterThan(300); + await expect.poll(async () => (await container.boundingBox())!.height).toBeGreaterThan(300); await assertFlushWithParent(container, page.locator('.file-view')); });