fix it on windows
This commit is contained in:
parent
6c18e32514
commit
c6ca57b3b8
|
|
@ -14,6 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import { test, expect } from './npmTest';
|
||||
import { chromium } from '@playwright/test';
|
||||
import path from 'path';
|
||||
|
||||
test.use({ isolateBrowsers: true });
|
||||
|
|
@ -96,14 +97,14 @@ test('install playwright-chromium should work', async ({ exec, installedSoftware
|
|||
await exec('node sanity.js playwright-chromium chromium');
|
||||
});
|
||||
|
||||
test('should print error if recording video without ffmpeg', async ({ exec }) => {
|
||||
test('should print error if recording video without ffmpeg', async ({ exec, writeFiles }) => {
|
||||
await exec('npm i playwright');
|
||||
|
||||
await test.step('BrowserType.launch', async () => {
|
||||
const result = await exec('node', '-e', `"
|
||||
await writeFiles({
|
||||
'launch.js': `
|
||||
const playwright = require('playwright');
|
||||
(async () => {
|
||||
const browser = await playwright.chromium.launch({ channel: 'chrome' });
|
||||
const browser = await playwright.chromium.launch({ executablePath: ${JSON.stringify(chromium.executablePath())} });
|
||||
try {
|
||||
const context = await browser.newContext({ recordVideo: { dir: 'videos' } });
|
||||
const page = await context.newPage();
|
||||
|
|
@ -114,21 +115,26 @@ test('should print error if recording video without ffmpeg', async ({ exec }) =>
|
|||
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', `"
|
||||
`,
|
||||
'launchPersistentContext.js': `
|
||||
const playwright = require('playwright');
|
||||
process.on('unhandledRejection', (e) => console.error('unhandledRejection', e));
|
||||
(async () => {
|
||||
const context = await playwright.chromium.launchPersistentContext('', { channel: 'chrome', recordVideo: { dir: 'videos' } });
|
||||
const context = await playwright.chromium.launchPersistentContext('', { executablePath: ${JSON.stringify(chromium.executablePath())}, recordVideo: { dir: 'videos' } });
|
||||
})().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
"`, { expectToExitWithError: true });
|
||||
`,
|
||||
});
|
||||
|
||||
await test.step('BrowserType.launch', async () => {
|
||||
const result = await exec('node', 'launch.js', { expectToExitWithError: true });
|
||||
expect(result).toContain(`browserContext.newPage: Executable doesn't exist at`);
|
||||
});
|
||||
|
||||
await test.step('BrowserType.launchPersistentContext', async () => {
|
||||
const result = await exec('node', 'launchPersistentContext.js', { expectToExitWithError: true });
|
||||
expect(result).not.toContain('unhandledRejection');
|
||||
expect(result).toContain(`browserType.launchPersistentContext: Executable doesn't exist at`);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue