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