-
Notifications
You must be signed in to change notification settings - Fork 0
/
protractor.config.js
81 lines (70 loc) · 2.72 KB
/
protractor.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* global browser, jasmine */
// removing transpilation (babel transformers are messing with protractor config ...)
// require('babel-core/register') // write tests in es6
var SpecReporter = require('jasmine-spec-reporter')
var pkg = require('./package.json')
/**
* The default port on which the test will be run is the one specified in package.json under config.port
*
* To overload this port, just pass the flag --port
*
* Use the global goToUrl(relativeUrl) helper (which will use what ever port you defined)
*
*/
var argv = require('minimist')(process.argv.slice(2))
var PORT = argv.port || (pkg.config ? (pkg.config.port ? pkg.config.port : null) : null) || 3000
var BASE_URL = argv['base-url'] || 'http://localhost'
console.log('[INFOS] Testing on ' + BASE_URL + ':' + PORT)
var specs = [
'tests/e2e/**/*.spec.js'
]
var config = {
framework: 'jasmine2',
specs: specs,
onPrepare: function () {
browser.ignoreSynchronization = true
/**
* Helper to use instead of directly `browser.get` so that you don't bother about the port
* baseUrl and port are optional and can be overriden globally when launching protractor
* with the flags --base-url and --port
* @param relativeUrl
* @param baseUrl
* @param port
*/
global.goToUrl = function (relativeUrl, baseUrl, port) {
baseUrl = typeof baseUrl === 'undefined' ? BASE_URL : baseUrl
port = typeof port === 'undefined' ? PORT : port
return browser.get(baseUrl + ':' + port + relativeUrl)
}
global.waitUntilIsElementPresent = function (element, timeout) {
timeout = typeof timeout !== 'undefined' ? timeout : 4000
return browser.driver.wait(() => {
return browser.driver.isElementPresent(element)
}, timeout)
}
jasmine.getEnv().addReporter(new SpecReporter())
}
}
if (process.env.TRAVIS) {
config.sauceUser = process.env.SAUCE_USERNAME
config.sauceKey = process.env.SAUCE_ACCESS_KEY
// You can configure platforms here: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/
config.multiCapabilities = [{
'name': `reflay #${process.env.TRAVIS_BUILD_NUMBER}: MS EDGE v13.10586 on Windows 10`,
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': `${process.env.TRAVIS_BUILD_NUMBER}`,
'platform': 'Windows 10',
'browserName': 'MicrosoftEdge',
'version': '13.10586',
'recordVideo': false
}, {
'name': `reflay #${process.env.TRAVIS_BUILD_NUMBER}: Safari v10.0 on OS X 10.11`,
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
'build': `${process.env.TRAVIS_BUILD_NUMBER}`,
'platform': 'OS X 10.11',
'browserName': 'safari',
'version': '10.0',
'recordVideo': false
}]
}
module.exports.config = exports.config = config