Skip to content

Commit

Permalink
Update Playwright to latest version
Browse files Browse the repository at this point in the history
Should fix broken tests in Github actions.

Add workaround for platform detection when running Playwright tests on Mac which no longer works in latest version.
  • Loading branch information
heyman committed Dec 9, 2024
1 parent 146e33e commit 96ae768
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 30 deletions.
34 changes: 19 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@electron/asar": "^3.2.2",
"@lezer/generator": "^1.5.1",
"@lezer/markdown": "^1.1.2",
"@playwright/test": "^1.40.1",
"@playwright/test": "^1.49.0",
"@replit/codemirror-lang-csharp": "^6.2.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/node": "^20.10.5",
Expand Down
39 changes: 25 additions & 14 deletions webapp/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,36 @@ let autoUpdateCallbacks = null
let currencyData = null

let platform
const uaPlatform = window.navigator?.userAgentData?.platform || window.navigator.platform
if (uaPlatform.indexOf("Win") !== -1) {
platform = {
isMac: false,
isWindows: true,
isLinux: false,
}
} else if (uaPlatform.indexOf("Linux") !== -1) {
platform = {
isMac: false,
isWindows: false,
isLinux: true,
}
} else {

// In the latest version of Playwright, the window.navigator.userAgentData.platform is not reported correctly on Mac,
// wo we'll fallback to deprecated window.navigator.platform which still works
if (__TESTS__ && window.navigator.platform.indexOf("Mac") !== -1) {
platform = {
isMac: true,
isWindows: false,
isLinux: false,
}
} else {
const uaPlatform = window.navigator?.userAgentData?.platform || window.navigator.platform
if (uaPlatform.indexOf("Win") !== -1) {
platform = {
isMac: false,
isWindows: true,
isLinux: false,
}
} else if (uaPlatform.indexOf("Linux") !== -1) {
platform = {
isMac: false,
isWindows: false,
isLinux: true,
}
} else {
platform = {
isMac: true,
isWindows: false,
isLinux: false,
}
}
}
platform.isWebApp = true

Expand Down

0 comments on commit 96ae768

Please sign in to comment.