-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from QNimbus/activate-test-e2e
Change suggestion for e2e testing
- Loading branch information
Showing
17 changed files
with
472 additions
and
367 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 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
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 |
---|---|---|
@@ -1,47 +1,69 @@ | ||
const globalSetup = require("./global-setup"); | ||
const app = globalSetup.app; | ||
const helpers = require("./global-setup"); | ||
const path = require("path"); | ||
const request = require("request"); | ||
const chai = require("chai"); | ||
const expect = chai.expect; | ||
|
||
describe("Electron app environment", function () { | ||
this.timeout(20000); | ||
const expect = require("chai").expect; | ||
|
||
const describe = global.describe; | ||
const it = global.it; | ||
const beforeEach = global.beforeEach; | ||
const afterEach = global.afterEach; | ||
|
||
describe("Electron app environment", function() { | ||
helpers.setupTimeout(this); | ||
|
||
var app = null; | ||
|
||
before(function() { | ||
// Set config sample for use in test | ||
process.env.MM_CONFIG_FILE = "tests/configs/env.js"; | ||
}); | ||
|
||
beforeEach(function (done) { | ||
app.start().then(function() { done(); } ); | ||
beforeEach(function() { | ||
return helpers | ||
.startApplication({ | ||
args: ["js/electron.js"] | ||
}) | ||
.then(function(startedApp) { | ||
app = startedApp; | ||
}); | ||
}); | ||
|
||
afterEach(function (done) { | ||
app.stop().then(function() { done(); }); | ||
afterEach(function() { | ||
return helpers.stopApplication(app); | ||
}); | ||
|
||
it("is set to open new app window", function () { | ||
return app.client.waitUntilWindowLoaded() | ||
.getWindowCount().should.eventually.equal(1); | ||
it("should open a browserwindow", function() { | ||
return app.client | ||
.waitUntilWindowLoaded() | ||
.browserWindow.focus() | ||
.getWindowCount() | ||
.should.eventually.equal(1) | ||
.browserWindow.isMinimized() | ||
.should.eventually.be.false.browserWindow.isDevToolsOpened() | ||
.should.eventually.be.false.browserWindow.isVisible() | ||
.should.eventually.be.true.browserWindow.isFocused() | ||
.should.eventually.be.true.browserWindow.getBounds() | ||
.should.eventually.have.property("width") | ||
.and.be.above(0) | ||
.browserWindow.getBounds() | ||
.should.eventually.have.property("height") | ||
.and.be.above(0) | ||
.browserWindow.getTitle() | ||
.should.eventually.equal("Magic Mirror"); | ||
}); | ||
|
||
it("sets correct window title", function () { | ||
return app.client.waitUntilWindowLoaded() | ||
.getTitle().should.eventually.equal("Magic Mirror"); | ||
}); | ||
|
||
it("get request from http://localhost:8080 should return 200", function (done) { | ||
request.get("http://localhost:8080", function (err, res, body) { | ||
it("get request from http://localhost:8080 should return 200", function(done) { | ||
request.get("http://localhost:8080", function(err, res, body) { | ||
expect(res.statusCode).to.equal(200); | ||
done(); | ||
}); | ||
}); | ||
|
||
it("get request from http://localhost:8080/nothing should return 404", function (done) { | ||
request.get("http://localhost:8080/nothing", function (err, res, body) { | ||
it("get request from http://localhost:8080/nothing should return 404", function(done) { | ||
request.get("http://localhost:8080/nothing", function(err, res, body) { | ||
expect(res.statusCode).to.equal(404); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
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
Oops, something went wrong.