UNPKG

4.92 kBJavaScriptView Raw
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* Copyright (c) 2018 Mobify Research & Development Inc. All rights reserved. */
3/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
4/* eslint import/no-commonjs:0 */
5require('@babel/register')
6const chromedriver = require('chromedriver')
7const path = require('path')
8
9const NIGHTWATCH_SAUCE_USERNAME = process.env.NIGHTWATCH_SAUCE_USERNAME
10const NIGHTWATCH_SAUCE_ACCESS_KEY = process.env.NIGHTWATCH_SAUCE_ACCESS_KEY
11const NIGHTWATCH_SRC_FOLDERS = (
12 process.env.NIGHTWATCH_SRC_FOLDERS || path.resolve(process.cwd(), 'tests', 'e2e')
13).split(' ')
14const NIGHTWATCH_OUTPUT_FOLDER =
15 process.env.NIGHTWATCH_OUTPUT_FOLDER || path.resolve(process.cwd(), 'tests', 'reports')
16const NIGHTWATCH_SCREENSHOTS_PATH =
17 process.env.NIGHTWATCH_SCREENSHOTS_PATH || path.resolve(process.cwd(), 'tests', 'screenshots')
18
19const nodeModules = path.resolve(process.cwd(), 'node_modules')
20
21module.exports = {
22 src_folders: NIGHTWATCH_SRC_FOLDERS,
23 output_folder: NIGHTWATCH_OUTPUT_FOLDER,
24 custom_commands_path: path.resolve(
25 nodeModules,
26 '@mobify',
27 'test-framework',
28 'src',
29 'mobify-nightwatch-commands',
30 'commands'
31 ),
32 webdriver: {
33 start_process: true
34 },
35
36 test_settings: {
37 default: {
38 webdriver: {
39 server_path: chromedriver.path,
40 port: 9515
41 },
42 globals: {
43 waitForConditionTimeout: 10000,
44 waitForConditionPollInterval: 100
45 },
46 end_session_on_fail: false,
47 silent: true,
48 output: true,
49 exclude: ['page-objects', 'sauce-connect', 'test-scripts'],
50 screenshots: {
51 enabled: true,
52 path: NIGHTWATCH_SCREENSHOTS_PATH,
53 on_failure: true
54 },
55 desiredCapabilities: {
56 browserName: 'chrome',
57 loggingPrefs: {driver: 'OFF', server: 'OFF', browser: 'OFF'},
58 chromeOptions: {
59 mobileEmulation: {
60 deviceName: 'Pixel 2'
61 },
62 args: ['--allow-running-insecure-content', '--test-type']
63 },
64 javascriptEnabled: true,
65 acceptSslCerts: true
66 }
67 },
68 chrome_incognito: {
69 webdriver: {
70 server_path: chromedriver.path,
71 port: 9515,
72 start_process: true
73 },
74 desiredCapabilities: {
75 browserName: 'chrome',
76 chromeOptions: {
77 mobileEmulation: {
78 deviceName: 'Pixel 2'
79 },
80 args: ['--allow-running-insecure-content', '--test-type']
81 },
82 javascriptEnabled: true,
83 acceptSslCerts: true
84 }
85 },
86 // To be run with Appium.
87 // Run the simulator beforehand and accept the certificate
88 safari: {
89 automationName: 'XCUITest',
90 exclude: ['page-objects', 'test-scripts'],
91 selenium_start_process: false,
92 selenium_port: 4723,
93 selenium_host: '0.0.0.0',
94 desiredCapabilities: {
95 app: '',
96 browserName: 'Safari',
97 platformName: 'iOS',
98 platformVersion: '11.2',
99 deviceName: 'iPhone 6s',
100 useNewWDA: 'false',
101 xcodeOrgId: 'KS9S3B73SG',
102 xcodeSigningId: 'iPhone Developer',
103 javascriptEnabled: true
104 }
105 },
106 saucelabs_ios: {
107 selenium_start_process: false,
108 selenium_port: 4445,
109 selenium_host: 'localhost',
110 silent: true,
111 exclude: ['page-objects', 'test-scripts'],
112 username: NIGHTWATCH_SAUCE_USERNAME,
113 access_key: NIGHTWATCH_SAUCE_ACCESS_KEY,
114 desiredCapabilities: {
115 browserName: 'Safari',
116 appiumVersion: '1.7.2',
117 deviceName: 'iPhone 7 Simulator',
118 platformVersion: '11.2',
119 platformName: 'iOS'
120 }
121 },
122 saucelabs_android: {
123 selenium_start_process: false,
124 selenium_port: 4445,
125 selenium_host: 'localhost',
126 silent: true,
127 username: NIGHTWATCH_SAUCE_USERNAME,
128 access_key: NIGHTWATCH_SAUCE_ACCESS_KEY,
129 desiredCapabilities: {
130 browserName: 'Chrome',
131 appiumVersion: '1.7.2',
132 deviceName: 'Google Pixel GoogleAPI Emulator',
133 platformVersion: '7.0',
134 platformName: 'Android'
135 }
136 }
137 }
138}