chore: pdf preview frame regression tests (#9922)

This commit is contained in:
Ryan Willis
2026-05-15 08:36:36 -07:00
committed by GitHub
parent 461a57e428
commit e507572f9c
5 changed files with 19 additions and 0 deletions

View File

Binary file not shown.

View File

@@ -91,6 +91,25 @@ test('can send requests', async ({ page, insomnia }) => {
.toBeVisible();
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
await expect.soft(statusTag).toContainText('200 OK');
const pdfIframe = page.getByTestId('ResponsePDFView');
await expect.soft(pdfIframe).toBeVisible();
await expect.soft(pdfIframe).toHaveAttribute('src', /^blob:/);
// find Electron/Chromium's built-in PDF viewer extension
await expect
.poll(() => page.frames().some(f => f.url().startsWith('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai')), {
timeout: 5000,
message: 'Expected Chromium built-in PDF viewer extension frame to mount inside the PDF preview iframe',
})
.toBe(true);
await expect.soft(pdfIframe).toHaveScreenshot('dummy-pdf-preview.png', {
animations: 'disabled',
maxDiffPixelRatio: 0.15, // 15% discrepancy allowed for CI/environment differences
timeout: 5000,
});
await page.getByRole('tab', { name: 'Console' }).click();
await page.locator('pre').filter({ hasText: '< Content-Type: application/pdf' }).click();

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB