Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranahmedse committed Oct 28, 2018
1 parent 132dbda commit 39811ae
Show file tree
Hide file tree
Showing 4 changed files with 1,866 additions and 17 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"_build": "react-scripts build",
"start": "concurrently \"yarn _react\" \"wait-on http://localhost:3000 && yarn _electron\" ",
"build": "yarn _build && build --mac --win --linux --x64 --ia32 -p always",
"icons": "electron-icon-maker -i public/img/pennywise.png -o public"
"icons": "electron-icon-maker -i public/img/pennywise.png -o public",
"test": "mocha"
},
"eslintConfig": {
"extends": "react-app"
Expand Down Expand Up @@ -95,7 +96,9 @@
"electron-builder": "^20.28.4",
"electron-icon-maker": "^0.0.4",
"jquery": "^3.3.1",
"mocha": "^5.2.0",
"popper.js": "^1.14.4",
"spectron": "^5.0.0",
"wait-on": "^3.1.0"
}
}
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ yarn start
* [ ] Persist options for the next session
* [ ] Bookmarking links for later use
* [ ] Let the clicks pass through
* [ ] Add more tests

## Contributions
Feel free to implement anything from the roadmap, submit pull requests, create issues, discuss ideas or spread the word.
Expand Down
35 changes: 35 additions & 0 deletions test/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const Application = require('spectron').Application;
const assert = require('assert');
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
const path = require('path');

describe('Application launch', function () {
this.timeout(10000);

beforeEach(function () {
this.app = new Application({
path: electronPath,
args: [path.join(__dirname, '..')]
});
return this.app.start();
});

afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.app.stop();
}
});

it('shows an initial window', function () {
return this.app.client.getWindowCount().then(function (count) {
assert.equal(count, 1);
});
});

it('shows the empty page on load', function () {
return this.app.client.getText('.empty-page h1')
.then((text) => {
assert.equal(text, 'Pennywise');
});
});
});
Loading

0 comments on commit 39811ae

Please sign in to comment.