-
-
Notifications
You must be signed in to change notification settings - Fork 10k
Prompt to install missing Playwright browsers on dev #34410
Copy link
Copy link
Open
Description
If addon-vitest is installed, consider prompting the user to install missing Playwright browsers on dev events.
This would let us safely skip Playwright install when --skip-install has been passed to init, without resulting in a broken Storybook Test setup. Currently, --skip-install still installs browsers, which could be considered a bug.
To do
- Add
playwright-coreas a dep ofaddon-vitest(it's already a transitive dep) - Use below script to detect missing browsers with
playwright-core - If they are missing, prompt the user to install them, default to yes
- In
init, respect--skip-installwhen it comes to downloading Playwright browsers
import {firefox, chromium, webkit} from 'playwright-core'
import fs from 'fs'
import {performance} from 'perf_hooks'
function isBrowserInstalled(browserType) {
try {
const execPath = browserType.executablePath();
return fs.existsSync(execPath);
} catch {
return false;
}
}
function measureExecutionTime(label, fn) {
const startTime = performance.now();
const result = fn();
const durationMs = performance.now() - startTime;
console.log(`${label}: ${result} (${durationMs.toFixed(2)} ms)`);
}
measureExecutionTime('Chromium', () => isBrowserInstalled(chromium));
measureExecutionTime('Firefox', () => isBrowserInstalled(firefox));
measureExecutionTime('WebKit', () => isBrowserInstalled(webkit));
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Empathy Backlog