-
-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: improve get info #4890
base: 3.x
Are you sure you want to change the base?
cli: improve get info #4890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better not to launch browsers
But check otherwise
lib/command/info.js
Outdated
const browsers = await Promise.all( | ||
['chromium', 'firefox', 'webkit'].map(async browser => { | ||
try { | ||
const browserInstance = await playwright[browser].launch() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, launching them seems as too much
can we check them without launching?
Can we do it with this: https://playwright.dev/docs/api/class-browsertype#browser-type-executable-path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one just returns something like this not the version /Library/Caches/ms-playwright/chromium-1155/chrome-mac/Chromium.app/Contents/MacOS/Chromium
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/microsoft/playwright/blob/main/packages/playwright-core/browsers.json exists and contains current browser versions.
I have it installed in ./node_modules/.pnpm/[email protected]/node_modules/playwright-core/browsers.json
.
But not sure how easily/universally get that file on various platforms (OS and npm vs. pnpm)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/microsoft/playwright/blob/main/packages/playwright-core/browsers.json exists and contains current browser versions
But it's for all browsers and there is no info that the browser was really installed. So it's probably useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-Pilot advised me this (and it works). Tested in TypeScript.
import { chromium, firefox, webkit } from "playwright";
import { execSync } from "child_process";
This returns Chromium 133.0.6943.16
const chromeVersion = execSync(
`"${chromium.executablePath()}" --version`
)
.toString()
.trim();
The same way works for Firefox (e.g. Mozilla Firefox 134.0
)
const firefoxVersion = execSync(
`"${firefox.executablePath()}" --version`
)
.toString()
.trim();
Unfortunately if you use the same way for WebKit, you get only WebKitGTK 2.47.2 (unknown)
and not the more common "Safari" version (e.g. 18.2)
const webkitVersion = execSync(`"${webkit.executablePath()}" --version`)
.toString()
.trim();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, I'm not sure if there are easy ways to handle this unless we launch the browsers and get the version.
what do you think we just return the webkit path to acknowledge this webkit browser is available from playwright?
@DavertMik @mirao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for me displaying of Chromium/Firefox version would be great as they change quite often with every Playwright release and as for WebKit any string/build is enough as Safari version doesn't change too often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's see how the playwright team proposes then -> microsoft/playwright#35123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment information:
codeceptVersion: "3.7.2"
nodeInfo: 18.19.0
osInfo: macOS 14.4
cpuInfo: (8) x64 Apple M1 Pro
osBrowsers: "chrome: 134.0.6998.45, edge: 134.0.3124.51, firefox: not installed, safari: 17.4"
playwrightBrowsers: "chromium: 134.0.6998.35, firefox: 135.0, webkit: 18.4"
helpers: {
"Playwright": {
"browser": "chromium",
worked like a charm for now @DavertMik @mirao
Co-authored-by: Michael Bodnarchuk <[email protected]>
…nto improve-get-info
Motivation/Description of the PR
Applicable helpers:
Applicable plugins:
Type of change
Checklist:
npm run docs
)npm run lint
)npm test
)