Add spectron tests to grunt:test-release
// FREEBIE
This commit is contained in:
parent
d63c603c21
commit
ab8edd8690
2 changed files with 37 additions and 0 deletions
36
Gruntfile.js
36
Gruntfile.js
|
@ -220,15 +220,19 @@ module.exports = function(grunt) {
|
||||||
'test-release': {
|
'test-release': {
|
||||||
osx: {
|
osx: {
|
||||||
archive: 'mac/Signal.app/Contents/Resources/app.asar',
|
archive: 'mac/Signal.app/Contents/Resources/app.asar',
|
||||||
|
exe: 'mac/Signal.app/Contents/MacOS/Signal'
|
||||||
},
|
},
|
||||||
mas: {
|
mas: {
|
||||||
archive: 'mas/Signal.app/Contents/Resources/app.asar',
|
archive: 'mas/Signal.app/Contents/Resources/app.asar',
|
||||||
|
exe: 'mas/Signal.app/Contents/MacOS/Signal'
|
||||||
},
|
},
|
||||||
linux: {
|
linux: {
|
||||||
archive: 'linux-unpacked/resources/app.asar',
|
archive: 'linux-unpacked/resources/app.asar',
|
||||||
|
exe: 'linux-unpacked/signal-desktop'
|
||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
archive: 'win-unpacked/resources/app.asar',
|
archive: 'win-unpacked/resources/app.asar',
|
||||||
|
exe: 'win-unpacked/Signal.exe'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
gitinfo: {} // to be populated by grunt gitinfo
|
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>`
|
// todo: verify package.json has `environment: <environment>`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -79,4 +79,5 @@
|
||||||
menu.popup(remote.getCurrentWindow());
|
menu.popup(remote.getCurrentWindow());
|
||||||
}, 30);
|
}, 30);
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue