-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: automated electron tests (#1883)
* feat: first draft of working electron connection test * feat: add workflow for electron tests * chore: cleanup some default electron packages * fix(workflow): fix xvfb run for test * chore: correction workflow branches * feat: add tests to check isBrowser and protocol used * chore: exclude electron-test from eslint
- Loading branch information
Showing
14 changed files
with
11,065 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/doc/ | ||
/dist/ | ||
/build/ | ||
/electron-test/ | ||
|
||
*.js | ||
*.mjs |
This file contains 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,33 @@ | ||
name: Electron Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
browser: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Build MQTT.JS | ||
run: npm run build | ||
|
||
- name: Run headless test | ||
run: cd electron-test && npm i && xvfb-run npm run wdio |
This file contains 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,92 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
.DS_Store | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# Webpack | ||
.webpack/ | ||
|
||
# Vite | ||
.vite/ | ||
|
||
# Electron-Forge | ||
out/ |
This file contains 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,4 @@ | ||
``` | ||
npm i | ||
npm run wdio | ||
``` |
This file contains 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,32 @@ | ||
const { FusesPlugin } = require('@electron-forge/plugin-fuses'); | ||
const { FuseV1Options, FuseVersion } = require('@electron/fuses'); | ||
|
||
module.exports = { | ||
packagerConfig: { | ||
asar: true, | ||
}, | ||
rebuildConfig: {}, | ||
makers: [ | ||
{ | ||
name: '@electron-forge/maker-zip', | ||
platforms: ['linux'], | ||
}, | ||
], | ||
plugins: [ | ||
{ | ||
name: '@electron-forge/plugin-auto-unpack-natives', | ||
config: {}, | ||
}, | ||
// Fuses are used to enable/disable various Electron functionality | ||
// at package time, before code signing the application | ||
new FusesPlugin({ | ||
version: FuseVersion.V1, | ||
[FuseV1Options.RunAsNode]: false, | ||
[FuseV1Options.EnableCookieEncryption]: true, | ||
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, | ||
[FuseV1Options.EnableNodeCliInspectArguments]: false, | ||
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, | ||
[FuseV1Options.OnlyLoadAppFromAsar]: true, | ||
}), | ||
], | ||
}; |
Oops, something went wrong.