Skip to content

Commit

Permalink
Added spectron.
Browse files Browse the repository at this point in the history
Fixed app component specs.
Closes #602.
  • Loading branch information
imolorhe committed Mar 9, 2019
1 parent 7d7e671 commit 6e6d5ca
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 9 deletions.
41 changes: 41 additions & 0 deletions electron/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const Application = require('spectron').Application;
const assert = require('assert');
const path = require('path');

console.log(__dirname);
let electronPath = path.join(__dirname, '../../node_modules', '.bin', 'electron');
const appPath = path.join(__dirname, '../main');
if (process.platform === 'win32') {
electronPath += '.cmd';
}
const app = new Application({
path: electronPath,
args: [appPath],
env: {
ELECTRON_ENABLE_LOGGING: true,
ELECTRON_ENABLE_STACK_DUMPING: true,
NODE_ENV: 'development'
},
startTimeout: 20000,
});

app.start().then(() => {
// Check if the window is visible
return app.browserWindow.isVisible();
}).then((isVisible) => {
// Verify the window is visible
assert.equal(isVisible, true);
}).then(() => {
// Get the window's title
return app.client.getTitle();
}).then((title) => {
// Verify the window's title
assert.equal(title, 'Altair');
}).then(() => {
// Stop the application
return app.stop();
}).catch((error) => {
// Log any failures
console.error('Test failed', error.message);
return app.stop();
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"ncp": "^2.0.0",
"ngrx-store-freeze": "^0.2.0",
"protractor": "^5.2.2",
"spectron": "^5.0.0",
"ts-node": "^8.0.3",
"tslint": "^5.9.1",
"typescript": ">=3.1.1 <3.2",
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/query-editor/query-editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="variables-editor-inner" [ngClass]="{ 'hide': !showVariableDialog }">
<div class="variables-editor-input-container">
<app-variables-editor
[variables]="variables.variables"
[variables]="variables?.variables"
(variablesChange)="variablesChange.emit($event)"
></app-variables-editor>
</div>
Expand All @@ -25,7 +25,7 @@
</a>

<div class="variables-files-list">
<div class="variables-file-item" *ngFor="let file of variables.files; let index = index;">
<div class="variables-file-item" *ngFor="let file of variables?.files; let index = index;">
<div class="variables-file-item-name-input-wrapper">
<input
type="text"
Expand Down
1 change: 1 addition & 0 deletions src/app/containers/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe('AppComponent', () => {
services.ElectronAppService,
services.KeybinderService,
services.NotifyService,
services.StorageService,
{ provide: services.QueryService, useValue: {
loadQuery: () => {},
loadUrl: () => {},
Expand Down

0 comments on commit 6e6d5ca

Please sign in to comment.