Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Dec 12, 2024
1 parent 12104c3 commit 6c18e32
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/installation/playwright-cli-install-should-work.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,33 @@ test('should print error if recording video without ffmpeg', async ({ exec }) =>

await test.step('BrowserType.launch', async () => {
const result = await exec('node', '-e', `"
import playwright from 'playwright';
const browser = await playwright.chromium.launch({ channel: 'chrome' });
const context = await browser.newContext({ recordVideo: { dir: 'videos' } });
const page = await context.newPage();
const playwright = require('playwright');
(async () => {
const browser = await playwright.chromium.launch({ channel: 'chrome' });
try {
const context = await browser.newContext({ recordVideo: { dir: 'videos' } });
const page = await context.newPage();
} finally {
await browser.close();
}
})().catch(e => {
console.error(e);
process.exit(1);
});
"`, { expectToExitWithError: true });
expect(result).toContain(`browserContext.newPage: Executable doesn't exist at`);
});

await test.step('BrowserType.launchPersistentContext', async () => {
const result = await exec('node', '-e', `"
import playwright from 'playwright';
const playwright = require('playwright');
process.on('unhandledRejection', (e) => console.error('unhandledRejection', e));
const context = await playwright.chromium.launchPersistentContext('', { channel: 'chrome', recordVideo: { dir: 'videos' } });
(async () => {
const context = await playwright.chromium.launchPersistentContext('', { channel: 'chrome', recordVideo: { dir: 'videos' } });
})().catch(e => {
console.error(e);
process.exit(1);
});
"`, { expectToExitWithError: true });
expect(result).not.toContain('unhandledRejection');
expect(result).toContain(`browserType.launchPersistentContext: Executable doesn't exist at`);
Expand Down

0 comments on commit 6c18e32

Please sign in to comment.