1 | ;
|
2 | require('babel-polyfill');
|
3 | var argv = require('optimist').argv;
|
4 |
|
5 | var specDirs = argv.specDirs || 'e2e*';
|
6 | var specFiles = argv.specFiles || ['.', specDirs, '**/*Spec.js'].join('/');
|
7 |
|
8 | module.exports = {
|
9 |
|
10 | //
|
11 | // ==================
|
12 | // Specify Test Files
|
13 | // ==================
|
14 | // Define which test specs should run. The pattern is relative to the directory
|
15 | // from which `wdio` was called. Notice that, if you are calling `wdio` from an
|
16 | // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
|
17 | // directory is where your package.json resides, so `wdio` will be called from there.
|
18 | //
|
19 | specs: [specFiles],
|
20 | // Patterns to exclude.
|
21 | exclude: [
|
22 | // 'path/to/excluded/files'
|
23 | ],
|
24 | //
|
25 | // ============
|
26 | // Capabilities
|
27 | // ============
|
28 | // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
29 | // time. Depending on the number of capabilities, WebdriverIO launches several test
|
30 | // sessions. Within your capabilities you can overwrite the spec and exclude options in
|
31 | // order to group specific specs to a specific capability.
|
32 | //
|
33 | // First, you can define how many instances should be started at the same time. Let's
|
34 | // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
35 | // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
36 | // files and you set maxInstances to 10, all spec files will get tested at the same time
|
37 | // and 30 processes will get spawned. The property handles how many capabilities
|
38 | // from the same test should run tests.
|
39 | //
|
40 | maxInstances: 10,
|
41 | //
|
42 | // If you have trouble getting all important capabilities together, check out the
|
43 | // Sauce Labs platform configurator - a great tool to configure your capabilities:
|
44 | // https://docs.saucelabs.com/reference/platforms-configurator
|
45 | //
|
46 | capabilities: [{
|
47 | // maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
48 | // grid with only 5 firefox instances available you can make sure that not more than
|
49 | // 5 instances get started at a time.
|
50 | maxInstances: argv.maxBrowserInstances || 5,
|
51 | //
|
52 | browserName: 'chrome'
|
53 | }],
|
54 | //
|
55 | // ===================
|
56 | // Test Configurations
|
57 | // ===================
|
58 | // Define all options that are relevant for the WebdriverIO instance here
|
59 | //
|
60 | // By default WebdriverIO commands are executed in a synchronous way using
|
61 | // the wdio-sync package. If you still want to run your tests in an async way
|
62 | // e.g. using promises you can set the sync option to false.
|
63 | sync: true,
|
64 | //
|
65 | // Level of logging verbosity: silent | verbose | command | data | result | error
|
66 | logLevel: 'result',
|
67 | //
|
68 | // Enables colors for log output.
|
69 | coloredLogs: true,
|
70 | //
|
71 | // Saves a screenshot to a given path if a command fails.
|
72 | screenshotPath: './test-output/e2e_screenshots/',
|
73 | //
|
74 | // Set a base URL in order to shorten url command calls. If your url parameter starts
|
75 | // with "/", then the base url gets prepended.
|
76 | baseUrl: argv.baseUrl || 'http://127.0.0.1:8080',
|
77 | //
|
78 | // Default timeout for all waitFor* commands.
|
79 | waitforTimeout: 15 * 1000,
|
80 | //
|
81 | // Default timeout in milliseconds for request
|
82 | // if Selenium Grid doesn't send response
|
83 | connectionRetryTimeout: 90 * 1000,
|
84 | //
|
85 | // Default request retries count
|
86 | connectionRetryCount: 3,
|
87 | //
|
88 | // Initialize the browser instance with a WebdriverIO plugin. The object should have the
|
89 | // plugin name as key and the desired plugin options as properties. Make sure you have
|
90 | // the plugin installed before running any tests. The following plugins are currently
|
91 | // available:
|
92 | // WebdriverCSS: https://github.com/webdriverio/webdrivercss
|
93 | // WebdriverRTC: https://github.com/webdriverio/webdriverrtc
|
94 | // Browserevent: https://github.com/webdriverio/browserevent
|
95 | // plugins: {
|
96 | // webdrivercss: {
|
97 | // screenshotRoot: 'my-shots',
|
98 | // failedComparisonsRoot: 'diffs',
|
99 | // misMatchTolerance: 0.05,
|
100 | // screenWidth: [320,480,640,1024]
|
101 | // },
|
102 | // webdriverrtc: {},
|
103 | // browserevent: {}
|
104 | // },
|
105 | //
|
106 | // Test runner services
|
107 | // Services take over a specific job you don't want to take care of. They enhance
|
108 | // your test setup with almost no effort. Unlike plugins, they don't add new
|
109 | // commands. Instead, they hook themselves up into the test process.
|
110 | services: [],
|
111 | //
|
112 | // Framework you want to run your specs with.
|
113 | // The following are supported: Mocha, Jasmine, and Cucumber
|
114 | // see also: http://webdriver.io/guide/testrunner/frameworks.html
|
115 | //
|
116 | // Make sure you have the wdio adapter package for the specific framework installed
|
117 | // before running any tests.
|
118 | framework: 'mocha',
|
119 | //
|
120 | // Test reporter for stdout.
|
121 | // The only one supported by default is 'dot'
|
122 | // see also: http://webdriver.io/guide/testrunner/reporters.html
|
123 | reporters: ['spec'],
|
124 |
|
125 | //
|
126 | // Options to be passed to Mocha.
|
127 | // See the full list at http://mochajs.org/
|
128 | mochaOpts: {
|
129 | ui: 'bdd',
|
130 | timeout: 5 * 60 * 1000
|
131 | },
|
132 | //
|
133 | // =====
|
134 | // Hooks
|
135 | // =====
|
136 | // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
137 | // it and to build services around it. You can either apply a single function or an array of
|
138 | // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
139 | // resolved to continue.
|
140 | //
|
141 | // Gets executed once before all workers get launched.
|
142 | // onPrepare: function (config, capabilities) {
|
143 | // },
|
144 | //
|
145 | // Gets executed before test execution begins. At this point you can access all global
|
146 | // variables, such as `browser`. It is the perfect place to define custom commands.
|
147 | // before: function (capabilities, specs) {
|
148 | // },
|
149 | //
|
150 | // Hook that gets executed before the suite starts
|
151 | // beforeSuite: function (suite) {
|
152 | // },
|
153 | //
|
154 | // Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
155 | // beforeEach in Mocha)
|
156 | // beforeHook: function () {
|
157 | // },
|
158 | //
|
159 | // Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
160 | // afterEach in Mocha)
|
161 | // afterHook: function () {
|
162 | // },
|
163 | //
|
164 | // Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
165 | // beforeTest: function (test) {
|
166 | // },
|
167 | //
|
168 | // Runs before a WebdriverIO command gets executed.
|
169 | // beforeCommand: function (commandName, args) {
|
170 | // },
|
171 | //
|
172 | // Runs after a WebdriverIO command gets executed
|
173 | // afterCommand: function (commandName, args, result, error) {
|
174 | // },
|
175 | //
|
176 | // Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
177 | // afterTest: function (test) {
|
178 | // },
|
179 | //
|
180 | // Hook that gets executed after the suite has ended
|
181 | // afterSuite: function (suite) {
|
182 | // },
|
183 | //
|
184 | // Gets executed after all tests are done. You still have access to all global variables from
|
185 | // the test.
|
186 | // after: function (result, capabilities, specs) {
|
187 | // },
|
188 | //
|
189 | // Gets executed after all workers got shut down and the process is about to exit. It is not
|
190 | // possible to defer the end of the process using a promise.
|
191 | // onComplete: function(exitCode) {
|
192 | // }
|
193 | onError: function(err) {
|
194 | browser.err = err; //to be able to query its err.shotTaken later in afterEach hook
|
195 | }
|
196 | };
|
197 |
|
198 | // Cause all of our Selenium scripts to get transpiled by Babel in real-time into full ES6,
|
199 | // running on Node.js. Allow generator calls to directly go through, since Node.js has efficient
|
200 | // support for those.
|
201 | require('babel-register')({
|
202 | presets: ['es2015']
|
203 | });
|