#3062·nightwatch

无法在无头模式下运行 Firefox

作者: aakash3771创建于 2022年2月24日更新于 2026年7月1日
标签v2

/* eslint-disable global-require */ require('@babel/register');

module.exports = { src_folders: ['tests'], page_objects_path: 'pages', custom_commands_path: [ 'node_modules/nightwatch-vrt/commands', 'node_modules/nightwatch-coverage/commands', ], custom_assertions_path: ['node_modules/nightwatch-vrt/assertions'], globals_path: 'globals.js', detailed_output: true, output_folder: './dist', output_timestamp: true, backwards_compatibility_mode: false, disable_global_apis: false, report_network_errors: true, disable_error_log: true, disable_colors: false, disable_global_expect: true, disable_typescript: true, silent: true, skip_testcases_on_fail: true, use_xpath: true, element_command_retries: 2, window_size: { width: 1600, height: 1100, }, webdriver: {}, test_settings: { default: { globals: { visual_regression_settings: { latest_screenshots_path: 'vrt/latest', latest_suffix: '_ls', baseline_screenshots_path: 'vrt/baseline', baseline_suffix: '_bs', diff_screenshots_path: 'vrt/diff', diff_suffix: '_ds', threshold: 0.05, prompt: false, always_save_diff_screenshot: false, }, }, screenshots: { enabled: true, path: 'screenshots', on_failure: true, }, desiredCapabilities: { browserName: 'firefox', }, webdriver: { start_process: true, server_path: require('chromedriver').path, }, }, safari: { desiredCapabilities: { browserName: 'safari', alwaysMatch: { acceptInsecureCerts: false, javascriptEnabled: true, acceptSslCerts: true, platform: 'MAC', }, }, webdriver: { start_process: true, server_path: '/usr/bin/safaridriver', }, }, firefox: { desiredCapabilities: { browserName: 'firefox', alwaysMatch: { javascriptEnabled: true, acceptInsecureCerts: true, nativeEvents: true, 'moz:firefoxOptions': { args: ['-headless', '-no-remote', '-incognito'], prefs: { 'pdfjs.disabled': true, 'browser.download.defaultFolder': 'downloads', 'browser.download.useDownloadDir': true, 'browser.download.folderList': 2, 'browser.download.dir': 'downloads', 'browser.helperApps.neverAsk.saveToDisk': 'application/pdf', 'browser.download.manager.showWhenStarting': false, …

内容来源: nightwatchjs/nightwatch