forked from LHNCBC/formbuilder-lhcforms
-
Notifications
You must be signed in to change notification settings - Fork 1
/
protractor.conf.js
125 lines (109 loc) · 3.97 KB
/
protractor.conf.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Protractor configuration
// https://github.com/angular/protractor/blob/master/referenceConf.js
'use strict';
let envConfig;
try {
envConfig = require('./formbuilder.conf');
} catch(e) {
envConfig = {};
}
const prot = envConfig.https ? 'https' : 'http';
const baseUrl = prot + '://localhost:' + envConfig.port;
const multiCapabilities = [{
browserName: 'chrome',
chromeOptions: {
prefs: {
download: {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': '/tmp'
}
},
args: ['disable-infobars', 'allow-insecure-localhost', 'window-size=1600,1400']
}
}];
exports.config = {
// The timeout for each script run on the browser. This should be longer
// than the maximum time your application needs to stabilize between tasks.
allScriptsTimeout: 110000,
// A base URL for your application under test. Calls to protractor.get()
// with relative paths will be prepended with this.
baseUrl: baseUrl,
// If true, only chromedriver or firefox driver will be started, not a standalone selenium.
// Tests for browsers other than chrome and firefox will not run.
directConnect: true,
// list of files / patterns to load in the browser
specs: [
'test/e2e/**/*.spec.js'
],
// Patterns to exclude.
exclude: [],
// ----- Capabilities to be passed to the webdriver instance ----
//
// For a full list of available capabilities, see
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// and
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
//capabilities: {'browserName': 'chrome'},
// Fix the port number so we can restrict access to it via iptables
seleniumPort: 4444,
multiCapabilities: multiCapabilities,
// ----- The test framework -----
//
// Jasmine and Cucumber are fully supported as a test and assertion framework.
// Mocha has limited beta support. You will need to include your own
// assertion framework if working with mocha.
framework: 'jasmine2',
// ----- Options to be passed to minijasminenode -----
//
// See the full list at https://github.com/juliemr/minijasminenode
jasmineNodeOpts: {
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare: function(){
/**
* By default, protracotor expects it to be angular application. This is used
* to switch between angular and non angular sites.
*
* @param {Boolean} flag
* @returns {void}
*/
global.setAngularSite = function(flag){
browser.ignoreSynchronization = !flag;
};
// Replace default dot reporter with something better.
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
// add jasmine spec reporter
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
// Copied from lforms project to disable animation for testing. -Ajay 04/20/2017
// disable animation
// http://stackoverflow.com/questions/26584451/how-to-disable-animations-in-protractor-for-angular-js-appliction
const disableNgAnimate = function() {
angular
.module('disableNgAnimate', [])
.run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
const disableCssAnimate = function() {
angular
.module('disableCssAnimate', [])
.run(function() {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '* {' +
'-webkit-transition: none !important;' +
'-moz-transition: none !important' +
'-o-transition: none !important' +
'-ms-transition: none !important' +
'transition: none !important' +
'}';
document.getElementsByTagName('head')[0].appendChild(style);
});
};
// disable ng-animate during the testing
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.addMockModule('disableCssAnimate', disableCssAnimate);
}
};