Run tests for builds vs packages using env variable (#2660)

This commit is contained in:
Opender Singh 2020-09-25 08:14:54 +12:00 committed by GitHub
parent 3e7be75a4f
commit 8a6c5cc9b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 16 deletions

View File

@ -35,6 +35,6 @@ jobs:
- name: Build designer for smoke tests
run: npm run app-build:smoke:designer
- name: Run core smoke tests
run: npm run test:smoke:core
run: npm run test:smoke:core:build
- name: Run designer smoke tests
run: npm run test:smoke:designer
run: npm run test:smoke:designer:build

View File

@ -27,9 +27,10 @@
"preinstall": "node ./scripts/check-version.js",
"app-build:smoke:core": "cross-env SMOKE_TEST=core npm run app-build",
"app-build:smoke:designer": "cross-env SMOKE_TEST=designer npm run app-build",
"test:smoke:core": "npm run test:core:build --prefix packages/insomnia-smoke-test",
"test:smoke:designer": "npm run test:designer:build --prefix packages/insomnia-smoke-test",
"test:smoke:package": "npm run test:package --prefix packages/insomnia-smoke-test"
"test:smoke:core:build": "npm run test:core:build --prefix packages/insomnia-smoke-test",
"test:smoke:designer:build": "npm run test:designer:build --prefix packages/insomnia-smoke-test",
"test:smoke:core:package": "npm run test:core:package --prefix packages/insomnia-smoke-test",
"test:smoke:designer:package": "npm run test:designer:package --prefix packages/insomnia-smoke-test"
},
"lint-staged": {
"{packages,plugins}/**/*.{js,json}": [

View File

@ -36,19 +36,23 @@ export const launchDesigner = async () => {
return await launch(config);
};
const getLaunchPath = config =>
process.env.BUNDLE === 'package'
? { path: config.packagePath }
: {
path: electronPath,
args: [config.buildPath],
};
const launch = async config => {
if (!config) {
throw new Error('Spectron config could not be loaded.');
}
const app = new Application({
// Run after app-package
// path: config.packagePath,
...getLaunchPath(config),
// Run after app-build - mac, Windows, Linux
path: electronPath,
args: [config.buildPath],
// Don't ask why, but don't remove chromeDriverArgs
// Don't remove chromeDriverArgs
// https://github.com/electron-userland/spectron/issues/353#issuecomment-522846725
chromeDriverArgs: ['remote-debugging-port=9222'],

View File

@ -3,10 +3,10 @@
"name": "insomnia-smoke-test",
"version": "2.2.25",
"scripts": {
"spectron:core:build": "xvfb-maybe jest --testPathPattern core",
"spectron:designer:build": "xvfb-maybe jest --testPathPattern designer",
"spectron:core:package": "xvfb-maybe jest --testPathPattern core",
"spectron:designer:package": "xvfb-maybe jest --testPathPattern designer",
"spectron:core:build": "cross-env BUNDLE=build xvfb-maybe jest --testPathPattern core",
"spectron:designer:build": "cross-env BUNDLE=build xvfb-maybe jest --testPathPattern designer",
"spectron:core:package": "cross-env BUNDLE=package xvfb-maybe jest --testPathPattern core",
"spectron:designer:package": "cross-env BUNDLE=package xvfb-maybe jest --testPathPattern designer",
"start:prism": "prism mock prism/oas3.yaml",
"with-mock": "concurrently --names prism,spectron --success first --kill-others \"npm run start:prism\"",
"test:core:build": "npm run with-mock \"npm run spectron:core:build\"",