Skip to content
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

tests: setup e2e #3634

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
},
env: {
browser: true,
node: true
node: true,
"jest/globals": true
},
extends: [
"standard",
Expand All @@ -23,7 +24,8 @@ module.exports = {
__static: true
},
plugins: [
"prettier"
"prettier",
"jest"
],
rules: {
"linebreak-style": [1, "unix"],
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on:
push:
paths-ignore:
Expand All @@ -7,9 +8,33 @@ on:
- "LICENCE"

jobs:
test-e2e:
name: e2e tests on node ${{ matrix.node_version }}
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [14, 16]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Set Node.js version ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}

- name: Install packages
run: yarn

- name: Run e2e tests
run: yarn test:e2e

linux:
name: Linux build on node ${{ matrix.node_version }}
runs-on: ubuntu-latest
needs: [test-e2e]
strategy:
matrix:
node_version: [14, 16]
Expand Down Expand Up @@ -56,6 +81,7 @@ jobs:
windows:
name: Windows build on node ${{ matrix.node_version }}
runs-on: windows-latest
needs: [test-e2e]
strategy:
matrix:
node_version: [14, 16]
Expand Down Expand Up @@ -92,6 +118,7 @@ jobs:
mac:
name: Mac build on node ${{ matrix.node_version }}
runs-on: macOS-latest
needs: [test-e2e]
strategy:
matrix:
node_version: [14, 16]
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "thermal",
"license": "null",
"description": "Git made simpler.",
"description": "Git made simpler.",
"version": "0.0.4",
"private": true,
"private": true,
"copyright": "Copyright © 2019 CodeCarrot",
"author": {
"name": "CodeCarrot, Inc.",
Expand All @@ -27,7 +27,8 @@
"pack": "npm run pack:main && npm run pack:renderer",
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
"postinstall": "electron-builder install-app-deps"
"postinstall": "electron-builder install-app-deps",
"test:e2e": "yarn pack && jest"
},
"engines": {
"node": "14.x.x || 16.x.x"
Expand Down Expand Up @@ -133,19 +134,22 @@
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^3.0.2",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-node": "10.0.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"eslint-plugin-vue": "^5.2.3",
"file-loader": "4.2.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^27.0.4",
"mini-css-extract-plugin": "0.8.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.12.0",
"prettier": "^1.18.2",
"sass-loader": "^7.2.0",
"spectron": "^15.0.0",
"style-loader": "1.0.0",
"url-loader": "^2.1.0",
"vue-apexcharts": "^1.4.0",
Expand Down
12 changes: 12 additions & 0 deletions tests/e2e/launch.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import utils from "./utils";

describe("lunch", () => {
beforeEach(utils.beforeEach);
afterEach(utils.afterEach);

it("should show application title", () => {
return this.app.client.getTitle().then(title => {
expect(title).to.equal("Thermal");
});
});
});
23 changes: 23 additions & 0 deletions tests/e2e/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import electron from "electron";
import { Application } from "spectron";

export default {
afterEach() {
this.timeout(10000);

if (this.app && this.app.isRunning()) {
return this.app.stop();
}
},
beforeEach() {
this.timeout(10000);
this.app = new Application({
path: electron,
args: ["dist/electron/main.js"],
startTimeout: 10000,
waitTimeout: 10000
});

return this.app.start();
}
};