-
Notifications
You must be signed in to change notification settings - Fork 4
/
protractor-sharded.config.js
101 lines (85 loc) · 3.16 KB
/
protractor-sharded.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
var testConfig = require('./tests/config/test-env.js');
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs : ['tests/e2e/**/*.js'],
rootElement : 'html',
chromeOnly: true,
directConnect : true,
capabilities: {
browserName: 'chrome',
loggingPrefs: {"driver": "ALL", "server": "ALL", "browser": "ALL"},
chromeOptions: {
args: [ 'no-sandbox', "--disable-gpu", "--window-size=1440x900"]
},
shardTestFiles:false,
maxInstances:1
},
allScriptsTimeout: 500000,
jasmineNodeOpts : {
showColors : true,
defaultTimeoutInterval: 500000,
isVerbose : true
},
onPrepare: function () {
// implicit and page load timeouts
browser.manage().timeouts().pageLoadTimeout(100000);
browser.manage().timeouts().implicitlyWait(5000);
browser.driver.manage().window().maximize();
browser.ignoreSynchronization = true;
// sign in before all tests
browser.driver.get(testConfig.baseUrl);
var disableNgAnimate = function () {
angular
.module('disableNgAnimate', [])
.run(['$animate', function ($animate) {
$animate.enabled(false);
}]);
};
var 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);
});
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.addMockModule('disableCssAnimate', disableCssAnimate);
browser.manage().logs().get('browser').then(function (browserLogs) {
// browserLogs is an array of objects with level and message fields
browserLogs.forEach(function (log) {
//if (log.level.value > 900) { // it's an error log
console.log('Browser console error!');
console.log(log.message);
//}
});
});
browser.driver.findElement(by.id('username')).sendKeys(testConfig.testUser1).then(function () {
browser.driver.findElement(by.id('password')).sendKeys(testConfig.testPassword1).then(function () {
browser.driver.findElement(by.id('kc-login')).click().then(function () {
//browser.driver.wait(browser.driver.isElementPresent(by.id('top-navigation')));
browser.driver.findElements(By.id('top-navigation')).then(function (found) {
console.log(found.length);
});
});
});
});
// wait for new page
return browser.driver.wait(function () {
return browser.driver.getCurrentUrl().then(function (url) {
return browser.driver.findElements(by.className('ng-app')).then(function () {
browser.ignoreSynchronization = false;
return true;
});
});
});
}
};