forked from statisticsnorway/klass-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotractor.config.js
66 lines (59 loc) · 2.47 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
// Inspired by https://github.com/topheman/react-es6-redux
//require('babel-core/register');// write tests in es6 // removing transpilation (babel transformers are messing with protractor config ...)
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 = [
'test/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;
config.capabilities = {
// 'name': 'react-es6-redux E2E node v' + process.env.TRAVIS_NODE_VERSION,
'browserName': 'chrome',
'seleniumVersion': '2.53.1',
'chromedriverVersion': '2.22'
// 'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
// 'build': process.env.TRAVIS_BUILD_NUMBER
};
// }
module.exports.config = exports.config = config;