Add spectron tests to grunt:test-release

// FREEBIE
This commit is contained in:
lilia 2017-05-05 22:16:48 -07:00 committed by Scott Nonnenberg
parent d63c603c21
commit ab8edd8690
No known key found for this signature in database
GPG key ID: A4931C09644C654B
2 changed files with 37 additions and 0 deletions

View file

@ -220,15 +220,19 @@ module.exports = function(grunt) {
'test-release': {
osx: {
archive: 'mac/Signal.app/Contents/Resources/app.asar',
exe: 'mac/Signal.app/Contents/MacOS/Signal'
},
mas: {
archive: 'mas/Signal.app/Contents/Resources/app.asar',
exe: 'mas/Signal.app/Contents/MacOS/Signal'
},
linux: {
archive: 'linux-unpacked/resources/app.asar',
exe: 'linux-unpacked/signal-desktop'
},
win: {
archive: 'win-unpacked/resources/app.asar',
exe: 'win-unpacked/Signal.exe'
}
},
gitinfo: {} // to be populated by grunt gitinfo
@ -364,6 +368,38 @@ module.exports = function(grunt) {
}
});
var done = this.async();
// A simple test to verify a visible window is opened with a title
var Application = require('spectron').Application;
var assert = require('assert');
var app = new Application({
path: [dir, config.exe].join('/')
});
app.start().then(function () {
return app.client.getWindowCount();
}).then(function (count) {
assert.equal(count, 1);
console.log('window opened');
}).then(function () {
// Get the window's title
return app.client.getTitle();
}).then(function (title) {
// Verify the window's title
assert.equal(title, 'Signal');
console.log('title ok');
}).then(function () {
assert(app.chromeDriver.logLines.indexOf('NODE_ENV ' + environment) > -1);
console.log('environment ok');
}).catch(function (error) {
// Log any failures
console.log('Test failed', error.message);
}).then(function () {
// Stop the application
return app.stop();
}).then(done);
// todo: verify package.json has `environment: <environment>`
});

View file

@ -79,4 +79,5 @@
menu.popup(remote.getCurrentWindow());
}, 30);
});
})();