Add assertion to confirm Node.js is disabled in rederer by executing require()

This commit is contained in:
Yuya Ochiai
2016-06-25 21:21:10 +09:00
parent 7fc963125a
commit b6e975aa21
3 changed files with 44 additions and 33 deletions

View File

@@ -35,6 +35,27 @@ module.exports = {
chaiAsPromised.transferPromiseness = app.transferPromiseness
return app;
},
addClientCommands: function(client) {
client.addCommand('loadSettingsPage', function async() {
return this
.url('file://' + path.join(source_root_dir, 'dist/browser/settings.html'))
.waitUntilWindowLoaded();
});
client.addCommand('isNodeEnabled', function async() {
return this.execute(function() {
try {
return require('child_process') ? true : false;
}
catch (e) {
return false;
}
}).then((require_result) => {
return require_result.value;
});
});
},
// execute the test only when `condition` is true
shouldTest: function(it, condition) {
return condition ? it : it.skip;