-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[BUG] playwright install doesn't install required browser version #9355
Copy link
Copy link
Closed
Description
Context:
- Playwright Version: 1.15.2
- Operating System: Linux
- Node.js version: 12.18.2
- Browser: Chrome
- Extra: [any specific details about your environment]
Code Snippet
// global-setup.ts
import { chromium, PlaywrightTestConfig } from '@playwright/test'
import dotenv from 'dotenv'
async function globalSetup(config: PlaywrightTestConfig) {
const { baseURL } = config.projects[0].use
// Initialise environment variables
dotenv.config();
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(baseURL);
await page.waitForSelector('#okta-signin-username');
await page.fill('#okta-signin-username', process.env.AUTH_USERNAME);
await page.fill('#okta-signin-password', process.env.AUTH_PASSWORD);
await page.click('#okta-signin-submit');
await page.waitForNavigation(baseURL + '/dashboard');
await page.context().storageState({ path: './tests/tmp/store_manager.json'});
await page.close();
await browser.close();
}
export default globalSetup;// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test'
import dotenv from 'dotenv'
dotenv.config();
const config: PlaywrightTestConfig = {
timeout: 60000,
use: {
baseURL: process.env.BASE_URL,
bypassCSP: true,
headless: true
},
globalSetup: require.resolve('./tests/global-setup')
};
export default config;Describe the bug
When I try to run a simple spec (before it even gets to the spec) I get the following error:
$ playwright test
Using config at /home/christian/projects/playwright-test/playwright.config.ts
browserType.launch: Executable doesn't exist at /home/christian/.cache/ms-playwright/chromium-907428/chrome-linux/chrome
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers: ║
║ ║
║ npx playwright install ║
║ ║
║ <3 Playwright Team ║
╚═════════════════════════════════════════════════════════════════════════╝
at globalSetup (/home/christian/projects/playwright-test/tests/global-setup.ts:9:34)
at Runner._run (/home/christian/projects/playwright-test/node_modules/@playwright/test/lib/test/runner.js:205:125) {
name: 'Error'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If I run npx playwright install it doesn't seem to install the necessary browser and I receive no output. If I run npx playwright install chrome, it doesn't download the version that playwright is asking for and will yield the same error as above when I run playwright test:
❯ npx playwright install chrome
+ is_user_root
+ '[' 1000 -eq 0 ']'
+ maybesudo=sudo
+ grep -q '^google-chrome[[:space:]]*install$'
+ dpkg --get-selections
+ command -v wget
+ cd /tmp
+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
--2021-10-07 17:07:16-- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
Resolving dl.google.com (dl.google.com)... 142.250.66.174, 2404:6800:4006:80e::200e
Connecting to dl.google.com (dl.google.com)|142.250.66.174|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 90273096 (86M) [application/x-debian-package]
Saving to: 'google-chrome-stable_current_amd64.deb’
google-chrome-stable_current_amd64.deb 100%[===============================================================================================================>] 86.09M 6.01MB/s in 15s
2021-10-07 17:07:31 (5.85 MB/s) - 'google-chrome-stable_current_amd64.deb’ saved [90273096/90273096]
+ sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
[sudo] password for christian:
Sorry, try again.
[sudo] password for christian:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'google-chrome-stable' instead of './google-chrome-stable_current_amd64.deb'
google-chrome-stable is already the newest version (94.0.4606.71-1).
The following package was automatically installed and is no longer required:
libllvm11
Use 'sudo apt autoremove' to remove it.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
+ rm -rf ./google-chrome-stable_current_amd64.deb
+ cd -
/home/christian/projects/playwright-test/node_modules/playwright/bin
+ google-chrome --version
Google Chrome 94.0.4606.71
Is there a way to force playwright to download a specific version?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels