Use Spectron to execute test
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const webdriverio = require('webdriverio');
|
||||
const Application = require('spectron').Application;
|
||||
|
||||
const source_root_dir = path.join(__dirname, '../..');
|
||||
const electron_binary_path = (function() {
|
||||
@@ -16,26 +16,14 @@ const electron_binary_path = (function() {
|
||||
const config_file_path = path.join(source_root_dir, 'test/test_config.json');
|
||||
const mattermost_url = 'http://example.com/team';
|
||||
|
||||
var options = {
|
||||
host: 'localhost', // Use localhost as chrome driver server
|
||||
port: 9515, // "9515" is the port opened by chrome driver.
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome',
|
||||
chromeOptions: {
|
||||
binary: electron_binary_path, // Path to your Electron binary.
|
||||
args: ['app=' + path.join(source_root_dir, 'dist'), '--config-file=' + config_file_path] // Optional, perhaps 'app=' + /path/to/your/app/
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
sourceRootDir: source_root_dir,
|
||||
configFilePath: config_file_path,
|
||||
mattermostURL: mattermost_url,
|
||||
spawnChromeDriver: function() {
|
||||
return require('child_process').spawn('node_modules/chromedriver/lib/chromedriver/chromedriver', ['--url-base=wd/hub', '--port=9515']);
|
||||
},
|
||||
getWebDriverIoClient: function() {
|
||||
return webdriverio.remote(options);
|
||||
getSpectronApp: function() {
|
||||
return new Application({
|
||||
path: electron_binary_path,
|
||||
args: [`${path.join(source_root_dir, 'dist')}`, '--config-file=' + config_file_path]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user