-
Notifications
You must be signed in to change notification settings - Fork 15
Add automated testing for electron app binaries #276
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
Merged
ezewer
merged 48 commits into
bitfinexcom:staging
from
ZIMkaRU:feature/add-automated-testing-for-electron-app-binaries
Jan 2, 2024
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
e3e2917
Merge pull request #287 from bitfinexcom/staging
ezewer d797bc5
Add main dev deps for e2e tests
ZIMkaRU 8e47c61
Add base webdriverio config
ZIMkaRU 03a1de1
Add test case for app title
ZIMkaRU d05239b
Expose electron api in test env for main process
ZIMkaRU a8037e8
Add preload script for browser windows
ZIMkaRU 46c2f10
Expose electron api in test env for browser wins
ZIMkaRU 1b95cd3
Add npm script to launch e2e tests
ZIMkaRU e1e74ea
Prevent removal app unpacked folder for e2e test runner
ZIMkaRU 53aadf7
Improve wdio config
ZIMkaRU e6248b2
Rework electron-builder config to be able to launch e2e tests
ZIMkaRU f4b6c41
Fix app e2e test spec
ZIMkaRU c5fc5f3
Add junit reporter for wdio
ZIMkaRU 45044a4
Add test reports to ignore files
ZIMkaRU 2136dc0
Add linux e2e test runner to github actions
ZIMkaRU 8e1c38e
Launch e2e test runner after builder job
ZIMkaRU 1daca16
Add e2e test report workflow
ZIMkaRU b1b5b96
Fix issue with low uploading speed on gh actions
ZIMkaRU f653335
Fix deps installation for e2e tests
ZIMkaRU 45acf89
Skip redundant files in build
ZIMkaRU db0fdb4
Run e2e tests headlessly by enabling xvfb
ZIMkaRU 907e8cc
Bump electron up to 27.0.3
ZIMkaRU b6d3249
Add script for adding time attr to testsuites tag
ZIMkaRU 7e7dfac
Normalize e2e test report before uploading
ZIMkaRU 90f8f7c
Add mac e2e test runner
ZIMkaRU 6f95691
Add mac e2e test reporter
ZIMkaRU 29b6adf
Add cross-env for dev/test scripts
ZIMkaRU e8d29a0
Add win e2e test runner
ZIMkaRU 72203b0
Add win e2e test reporter
ZIMkaRU d08b967
Bump actions/checkout up to v4
ZIMkaRU b6e070c
Fix unzipping win unpacked build
ZIMkaRU 6d48bbb
Bump electron-builder up to 24.8.1 to have executable name fix
ZIMkaRU 181f1af
Add common executableName opt for all builds
ZIMkaRU e28fb6b
Fix making mac app-update-yml in build
ZIMkaRU f935b67
Fix mac updater for new executable name
ZIMkaRU a8cfff1
Add correct app binary path to wdio conf according to os
ZIMkaRU 4d03af9
Add bash script to turn uninterrupted e2e testing on macOS
ZIMkaRU d9b7060
Add gh workflow step to prepare mac e2e test runner
ZIMkaRU 0b31eff
Move prepare-mac-runner script to local gh actions
ZIMkaRU cb35243
Use macos-11 in gh actions
ZIMkaRU aaf9e26
Prevent spaces in mac unique computer name
ZIMkaRU 5c7fb5b
Fix electron issue with executableName specifying
ZIMkaRU 9c12e64
Bump wdio up to 8.22.0
ZIMkaRU 08b9a05
Bump electon up to 27.0.4
ZIMkaRU 2ffbd3e
Disable enforce macos app location for e2e test runner
ZIMkaRU 6ce902e
Use macos-12 in gh actions
ZIMkaRU 3285cff
Fix npm start script
ZIMkaRU 2af7deb
Fix browser window creation
ZIMkaRU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: 'Prepare Mac runner' | ||
| description: 'Turn uninterrupted testing on mac' | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - run: ${{ github.action_path }}/prepare-mac-runner.sh | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Turn uninterrupted testing on mac | ||
|
|
||
| # Change Local name to avoid name clash causing alert | ||
| uniqueComputerName="mac-e2e-test-runner-$RANDOM" | ||
| sudo scutil --set LocalHostName "$uniqueComputerName" | ||
| sudo scutil --set ComputerName "$uniqueComputerName" | ||
|
|
||
| # Close Notification window | ||
| sudo killall UserNotificationCenter || true | ||
|
|
||
| # Do not disturb | ||
| defaults -currentHost write com.apple.notificationcenterui doNotDisturb -boolean true | ||
| defaults -currentHost write com.apple.notificationcenterui doNotDisturbDate -date "`date -u +\"%Y-%m-%d %H:%M:%S +0000\"`" | ||
| sudo killall NotificationCenter | ||
|
|
||
| # Disable firewall | ||
| sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off | ||
| sudo /usr/libexec/ApplicationFirewall/socketfilterfw -k | ||
|
|
||
| # Close Finder Windows using Apple Script | ||
| sudo osascript -e 'tell application "Finder" to close windows' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: 'E2E Test Report' | ||
| run-name: 'E2E Test Report: Commit ${{ github.sha }}' | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ['Build release'] | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: | ||
| contents: read | ||
| actions: read | ||
| checks: write | ||
|
|
||
| jobs: | ||
| e2e-web-page-report: | ||
| name: E2E Web Page Report | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: dorny/test-reporter@v1 | ||
| id: linux-e2e-test-results | ||
| with: | ||
| artifact: linux-e2e-test-results | ||
| name: Linux E2E Tests | ||
| path: e2e-test-report.xml | ||
| reporter: jest-junit | ||
| - uses: dorny/test-reporter@v1 | ||
| id: win-e2e-test-results | ||
| with: | ||
| artifact: win-e2e-test-results | ||
| name: Win E2E Tests | ||
| path: e2e-test-report.xml | ||
| reporter: jest-junit | ||
| - uses: dorny/test-reporter@v1 | ||
| id: mac-e2e-test-results | ||
| with: | ||
| artifact: mac-e2e-test-results | ||
| name: Mac E2E Tests | ||
| path: e2e-test-report.xml | ||
| reporter: jest-junit | ||
| - name: E2E Test Report Summary | ||
| run: | | ||
| echo "### E2E Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY | ||
| echo "And available at the following links for applicable OSs:" >> $GITHUB_STEP_SUMMARY | ||
| echo "- [Linux](${{ steps.linux-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY | ||
| echo "- [Win](${{ steps.win-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY | ||
| echo "- [Mac](${{ steps.mac-e2e-test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,5 @@ package-lock.json | |
| lastCommit.json | ||
| electronEnv.json | ||
| stub.AppImage | ||
| e2e-test-report.xml | ||
| test-report.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| 'use strict' | ||
|
|
||
| const path = require('path') | ||
| const { | ||
| readFileSync, | ||
| writeFileSync | ||
| } = require('fs') | ||
|
|
||
| const cwd = process.cwd() | ||
| const fileName = process.argv[2] | ||
| const filePath = path.join(cwd, fileName) | ||
|
|
||
| const content = readFileSync(filePath, { encoding: 'utf8' }) | ||
| /* | ||
| * For compatibility with the dorny/test-reporter, | ||
| * there needs to be 'time' attribute to '<testsuites>' tag | ||
| */ | ||
| const normalizedContent = content | ||
| .replace(/<testsuites>/gi, '<testsuites time="0">') | ||
| writeFileSync(filePath, normalizedContent) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use strict' | ||
|
|
||
| const { ipcRenderer, contextBridge } = require('electron') | ||
|
|
||
| // See the Electron documentation for details on how to use preload scripts: | ||
| // https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts | ||
| const isTest = process.env.NODE_ENV === 'test' | ||
|
|
||
| if (isTest) { | ||
| require('wdio-electron-service/preload') | ||
| } | ||
|
|
||
| contextBridge.exposeInMainWorld('electron', { | ||
| openDialog: (method, config) => ipcRenderer | ||
| .send('dialog', method, config) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.