我试图从节点脚本运行我的夜班测试。
const nightwatch = require('nightwatch');
const configOptions = {
config: 'nightwatch.conf.js',
env: 'local'
};
nightwatch.runner(configOptions, function() {
console.log('done!');
});

一切都很好,所有测试都运行正常。 但是没有调用回调函数。夜视仪保持空转,必须手动杀死它。
当我通过nightwatch cli运行测试时,这种情况不会发生。
我不知道。有人有个主意吗? 提前致谢
编辑: nightwatch.conf.js文件:
var seleniumServerStandalone = require('selenium-server-standalone-jar');
var geckoDriver = require('geckodriver');
var chromeDriver = require('chromedriver');
var SELENIUM_CONFIGURATION = {
start_process: true,
server_path: seleniumServerStandalone.path,
host: '127.0.0.1',
port: 4444,
cli_args : {
'webdriver.chrome.driver' : chromeDriver.path,
'webdriver.gecko.driver': geckoDriver.path
}
};
var FIREFOX_CONFIGURATION = {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true,
elementScrollBehavior: 1
};
var CHROME_CONFIGURATION = {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
elementScrollBehavior: 1,
chromeOptions : {
args: ['window-size=1400,800']
}
};
var LIVE_ENV_VARS = {
validLoginCredentials: {
mail: 'valid-user@mail.net',
password: "validpw"
},
invalidLoginCredentials: {
mail: 'invalid-user@mail.net',
password: "invalidpw"
},
startUrl: 'https://app.hrlab.de'
};
var LOCAL_ENV_VARS = {
validLoginCredentials: {
mail: 'valid-user@mail.net',
password: "validpw"
},
invalidLoginCredentials: {
mail: 'invalid-user@mail.net',
password: "invalidpw"
},
startUrl: 'http://127.0.0.1:3333'
};
var STABLE_VARS = {
reasonableWait: 2000,
reasonableRender: 20000
};
var DEFAULT_CONFIGURATION = {
launch_url: 'http://localhost',
selenium_port: 4444,
selenium_host: 'localhost',
desiredCapabilities: CHROME_CONFIGURATION,
globals: {
environment: LIVE_ENV_VARS,
stable: STABLE_VARS
}
};
var LOCAL_CONFIGURATION = {
launch_url: 'http://localhost:3333',
selenium_port: 4444,
selenium_host: 'localhost',
desiredCapabilities: CHROME_CONFIGURATION,
globals: {
environment: LOCAL_ENV_VARS,
stable: STABLE_VARS
}
};
var LOCAL_CONFIGURATION_FIREFOX = {
launch_url: 'http://localhost:3333',
selenium_port: 4444,
selenium_host: 'localhost',
desiredCapabilities: FIREFOX_CONFIGURATION,
globals: {
environment: LOCAL_ENV_VARS,
stable: STABLE_VARS
}
};
var ENVIRONMENTS = {
default: DEFAULT_CONFIGURATION,
local: LOCAL_CONFIGURATION,
local_firefox: LOCAL_CONFIGURATION_FIREFOX
};
module.exports = {
src_folders: ['test/e2e'],
page_objects_path: 'test/e2e/page_objects',
selenium: SELENIUM_CONFIGURATION,
test_settings: ENVIRONMENTS
};