diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts
index 1886651f95..08ce16e7ec 100644
--- a/tests/playwright-test/expect.spec.ts
+++ b/tests/playwright-test/expect.spec.ts
@@ -511,13 +511,13 @@ test('should support toHaveURL with baseURL from webServer', async ({ runInlineT
import { test, expect } from '@playwright/test';
test('pass', async ({ page }) => {
- await page.goto('/foobar');
- await expect(page).toHaveURL('/foobar');
- await expect(page).toHaveURL('http://localhost:${port}/foobar');
+ await page.goto('/hello');
+ await expect(page).toHaveURL('/hello');
+ await expect(page).toHaveURL('http://localhost:${port}/hello');
});
test('fail', async ({ page }) => {
- await page.goto('/foobar');
+ await page.goto('/hello');
await expect(page).toHaveURL('/kek', { timeout: 1000 });
});
`,
diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts
index ba6020fade..5c5d6c304a 100644
--- a/tests/playwright-test/playwright.trace.spec.ts
+++ b/tests/playwright-test/playwright.trace.spec.ts
@@ -735,28 +735,34 @@ test('should not throw when attachment is missing', async ({ runInlineTest }, te
});
test('should not throw when screenshot on failure fails', async ({ runInlineTest, server }, testInfo) => {
+ server.setRoute('/download', (req, res) => {
+ res.setHeader('Content-Type', 'application/octet-stream');
+ res.setHeader('Content-Disposition', 'attachment; filename=file.txt');
+ res.end(`Hello world`);
+ });
+
const result = await runInlineTest({
'playwright.config.ts': `
module.exports = { use: { trace: 'on', screenshot: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
- test('has pdf page', async ({ page }) => {
+ test('has download page', async ({ page }) => {
await page.goto("${server.EMPTY_PAGE}");
- await page.setContent('open me!');
+ await page.setContent('open me!');
const downloadPromise = page.waitForEvent('download');
await page.click('a');
const download = await downloadPromise;
- expect(download.suggestedFilename()).toBe('empty.pdf');
+ expect(download.suggestedFilename()).toBe('file.txt');
});
`,
}, { workers: 1 });
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
- const trace = await parseTrace(testInfo.outputPath('test-results', 'a-has-pdf-page', 'trace.zip'));
+ const trace = await parseTrace(testInfo.outputPath('test-results', 'a-has-download-page', 'trace.zip'));
const attachedScreenshots = trace.actionTree.filter(s => s.trim() === `attach "screenshot"`);
- // One screenshot for the page, no screenshot for pdf page since it should have failed.
+ // One screenshot for the page, no screenshot for the download page since it should have failed.
expect(attachedScreenshots.length).toBe(1);
});
diff --git a/tests/playwright-test/ui-mode-test-setup.spec.ts b/tests/playwright-test/ui-mode-test-setup.spec.ts
index 65c6aa2533..9ed1dadb0d 100644
--- a/tests/playwright-test/ui-mode-test-setup.spec.ts
+++ b/tests/playwright-test/ui-mode-test-setup.spec.ts
@@ -276,7 +276,7 @@ test('should restart webserver on reload', async ({ runUITest }) => {
'a.test.js': `
import { test, expect } from '@playwright/test';
test('should work', async ({ page }) => {
- await page.goto('http://localhost:${port}');
+ await page.goto('http://localhost:${port}/hello');
});
`
}, { DEBUG: 'pw:webserver' });