-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
79 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const Application = require('spectron').Application; | ||
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules. | ||
const path = require('path'); | ||
|
||
export default function setup() { | ||
beforeEach(async function () { | ||
this.app = new Application({ | ||
// Your electron path can be any binary | ||
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp' | ||
// But for the sake of the example we fetch it from our node_modules. | ||
path: electronPath, | ||
|
||
// Assuming you have the following directory structure | ||
|
||
// |__ my project | ||
// |__ ... | ||
// |__ main.js | ||
// |__ package.json | ||
// |__ index.html | ||
// |__ ... | ||
// |__ test | ||
// |__ spec.js <- You are here! ~ Well you should be. | ||
|
||
// The following line tells spectron to look and use the main.js file | ||
// and the package.json located 1 level above. | ||
args: [path.join(__dirname, '..')], | ||
webdriverOptions: {} | ||
}); | ||
await this.app.start(); | ||
const browser = this.app.client; | ||
await browser.waitUntilWindowLoaded(); | ||
|
||
browser.timeouts('script', 15000); | ||
}); | ||
|
||
afterEach(function () { | ||
if (this.app && this.app.isRunning()) { | ||
return this.app.stop(); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {expect, assert} from 'chai'; | ||
import {SpectronClient} from 'spectron'; | ||
|
||
import commonSetup from './common-setup'; | ||
|
||
describe('angular-electron App', function () { | ||
commonSetup.apply(this); | ||
|
||
let browser: any; | ||
let client: SpectronClient; | ||
|
||
beforeEach(function () { | ||
client = this.app.client; | ||
browser = client as any; | ||
}); | ||
|
||
it('should display message saying App works !', async function () { | ||
const text = await browser.getText('app-home h1'); | ||
expect(text).to.equal('App works !'); | ||
}); | ||
|
||
|
||
it('creates initial windows', async function () { | ||
const count = await client.getWindowCount(); | ||
expect(count).to.equal(2); | ||
}); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters