Skip to content

Conversation

@aslushnikov
Copy link
Contributor

Make sure executable exists before launching it. If it doesn't and
we were launched without custom executable path, print a helpful
instruction to run npm i playwright and get browsers downloaded.

Note: there's already a test that makes sure bad executable paths
are treated fairly:

it('should reject if executable path is invalid', async({browserType, defaultBrowserOptions}) => {
let waitError = null;
const options = Object.assign({}, defaultBrowserOptions, {executablePath: 'random-invalid-path'});
await browserType.launch(options).catch(e => waitError = e);
expect(waitError.message).toContain('Failed to launch');
});

This doesn't test missing default browser installation which I think is
fine.

Fixes #3161

Make sure executable exists before launching it. If it doesn't and
we were launched without custom executable path, print a helpful
instruction to run `npm i playwright` and get browsers downloaded.

Note: there's already a test that makes sure bad executable paths
are treated fairly: https://github.com/microsoft/playwright/blob/9132d23b2bfadfcf46461f2135c37d9689d91033/test/launcher.jest.js#L54-L59

This doesn't test missing default browser installation which I think is
fine.

Fixes microsoft#3161
@aslushnikov aslushnikov merged commit e091325 into microsoft:master Jul 30, 2020
@aslushnikov aslushnikov deleted the nice-error-when-there-is-no-browser branch July 30, 2020 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Provide helpful error message when executable is missing

2 participants