-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprotractor-sequential.config.js
119 lines (96 loc) · 3.79 KB
/
protractor-sequential.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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',
chromeOptions: {
args: ["--headless", 'no-sandbox', "--disable-gpu", "--window-size=1440x900"]
//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('https://auth.staging.metadatacenter.org/auth/realms/CEDAR/protocol/openid-connect/auth?client_id=cedar-angular-app&redirect_uri=https%3A%2F%2Fcedar.metadatacenter.orgx%2F&response_mode=fragment&response_type=code&scope=openid');
browser.driver.get(testConfig.baseUrl);
browser.getCurrentUrl().then(function(value) {
console.log('testConfig.baseUrl',testConfig.baseUrl);
console.log('browser.getCurrentUrl',value);
});
// browser.getPageSource().then(function(value) {
// console.log("getPageSource");
// console.log(value);
// });
// console.log('exports');
// console.log(exports);
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;
});
});
});
}
};