mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 13:48:41 -09:00
spectron testing on github actions
added screenshot capture after tests
This commit is contained in:
parent
0d210abdd1
commit
e6eed0d4bb
4 changed files with 29 additions and 0 deletions
14
.github/workflows/nodejs.yml
vendored
14
.github/workflows/nodejs.yml
vendored
|
|
@ -34,6 +34,13 @@ jobs:
|
||||||
# echo "::set-env name=CSC_KEY_PASSWORD::${{ secrets.MAC_CERT_P12_PASSWORD }}"
|
# echo "::set-env name=CSC_KEY_PASSWORD::${{ secrets.MAC_CERT_P12_PASSWORD }}"
|
||||||
- name: Build
|
- name: Build
|
||||||
run: yarn run dist --publish=never
|
run: yarn run dist --publish=never
|
||||||
|
- name: Test Spectron
|
||||||
|
run: yarn run test:spectron
|
||||||
|
- name: Archive Spectron test screenshot
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: spectron
|
||||||
|
path: dist/tmp/darwin_test.png
|
||||||
- name: Get macOS Artifact Names
|
- name: Get macOS Artifact Names
|
||||||
id: getmacosfilename
|
id: getmacosfilename
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -135,6 +142,13 @@ jobs:
|
||||||
# env:
|
# env:
|
||||||
#CSC_LINK: ${{ secrets.WIN_CERT_P12_BASE64 }}
|
#CSC_LINK: ${{ secrets.WIN_CERT_P12_BASE64 }}
|
||||||
#CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_P12_PASSWORD }}
|
#CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_P12_PASSWORD }}
|
||||||
|
- name: Test Spectron
|
||||||
|
run: yarn run test:spectron
|
||||||
|
- name: Archive Spectron test screenshot
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: spectron
|
||||||
|
path: dist/tmp/win32_test.png
|
||||||
- name: Get Windows Artifact Names
|
- name: Get Windows Artifact Names
|
||||||
id: getwindowsfilename
|
id: getwindowsfilename
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
9
ava-spectron.config.js
Normal file
9
ava-spectron.config.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
export default {
|
||||||
|
files: ['test/*'],
|
||||||
|
babel: {
|
||||||
|
compileEnhancements: false,
|
||||||
|
compileAsTests: ['**/testUtils/**/*']
|
||||||
|
},
|
||||||
|
extensions: ['ts'],
|
||||||
|
require: ['ts-node/register/transpile-only']
|
||||||
|
};
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"test": "yarn run lint && yarn run test:unit",
|
"test": "yarn run lint && yarn run test:unit",
|
||||||
"test:unit": "ava",
|
"test:unit": "ava",
|
||||||
"test:unit:watch": "yarn run test:unit -- --watch",
|
"test:unit:watch": "yarn run test:unit -- --watch",
|
||||||
|
"test:spectron": "ava --config ava-spectron.config.js",
|
||||||
"postinstall": "webpack --config-name hyper-app && electron-builder install-app-deps && yarn run rebuild-node-pty && cpy --cwd=target --parents \"node_modules/**/*\" \"../app/\"",
|
"postinstall": "webpack --config-name hyper-app && electron-builder install-app-deps && yarn run rebuild-node-pty && cpy --cwd=target --parents \"node_modules/**/*\" \"../app/\"",
|
||||||
"rebuild-node-pty": "electron-rebuild -f -w target/node_modules/node-pty -m target",
|
"rebuild-node-pty": "electron-rebuild -f -w target/node_modules/node-pty -m target",
|
||||||
"dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder",
|
"dist": "yarn run build && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified && electron-builder",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Native
|
// Native
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
|
||||||
// Packages
|
// Packages
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
|
|
@ -35,6 +36,10 @@ test.before(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test.after(async () => {
|
test.after(async () => {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||||
|
await app.browserWindow.capturePage().then(async (imageBuffer) => {
|
||||||
|
await fs.writeFile(`dist/tmp/${process.platform}_test.png`, imageBuffer);
|
||||||
|
});
|
||||||
await app.stop();
|
await app.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue