-
Notifications
You must be signed in to change notification settings - Fork 132
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
Upgrade Electron to v14. Replace Spectron with Playwright. #1985
Conversation
e0abb50
to
41167c5
Compare
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
41167c5
to
2503f8d
Compare
Signed-off-by: Mason Fish <mason@brimsecurity.com>
2503f8d
to
19f1bf7
Compare
Signed-off-by: Mason Fish <mason@brimsecurity.com>
Signed-off-by: Mason Fish <mason@brimsecurity.com>
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 go!!!
xvfb-run -d -s "-screen 0 1280x1024x24" npm run itest -- --ci --forceExit | ||
|
||
integration_test: | ||
playwright_integration_test: |
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.
Are we still testing centos?
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, but I can play around with adding it back in separately
import {app as electronApp, remote} from "electron" | ||
const app = electronApp || (remote && remote.app) | ||
import {app as electronApp} from "electron" | ||
const app = electronApp |
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 can run from the renderer process, so we'll need a way to tell the renderer what the environment looks like. We can make an ipc call and set a global.
|
||
const app = electronApp || (remote && remote.app) | ||
const app = electronApp |
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 also may run from the renderer process.
@@ -1,5 +1,6 @@ | |||
import path from "path" | |||
import fs from "fs-extra" | |||
import {ReadableStream} from "web-streams-polyfill/ponyfill" |
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.
I added a web-file-polyfill for this in my own tests. You'll see it in the upcoming PR.
|
||
export const dialog = { | ||
showMessageBox: jest.fn() | ||
} |
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.
Perfect.
fixes #1934
Lot's of changes here:
Replacing our integration test framework from Spectron to Playwright: Includes 3 of our original spectron test suites (queries, ingest, and zed-events). Unfortunately there is still a lot of inconsistency with running this on Windows (only in CI, I have not seen a single failure when running locally on my PC) but since we are so desperate to upgrade electron (which requires ditching Spectron) then we can test Windows manually in our pre-release cadence for now and tackle the CI issues more later.
Upgrading electron from 11 to 14: There are a few small changes involved here but the most noteworthy is that the
remote
module has been extracted out of theelectron
package and is now it's own npm scoped module at@electron/remote
. I followed their provided migration instructions for this transition and the biggest blocker I hit was changing the way we mock that in our unit tests.There are very few changes to the app itself other than the upgrade-related api changes. I did end up synchronizing/awaiting the
window.loadFile()
uses and re-order the launch of the hidden window. I did this so that the app would open more deterministically which then allowed the new integration tests to perform more consistently. I also re-worked some of the file input logic in the ingest flow so that we use the providedFile
object instead of the filepath. This was also for testing purposes since Playwright does not currently set the filepath onFile
objects the way that Electron does (and for this reason, in tests, we do NOT run or test thebrimcap index
sub-operation facilitated by the brimcap plugin). Finally, we also have upgraded to node 14! I found no issues with that aspect of the upgrade.