-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprotractor.conf.js
60 lines (52 loc) · 2.08 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
exports.config = {
baseUrl: 'http://localhost:3000',
specs: [ 'test/e2e/**/*Spec.js' ],
capabilities: {
browserName: 'chrome'
},
onPrepare: function () {
browser.addMockModule('httpBackendMock', function() {
angular.module('httpBackendMock', ['ngMockE2E']).run(['$httpBackend', function($httpBackend) {
function _createData(slug) {
return {
"id": 1,
"slug": slug,
"description": "foo",
"last_build_id": 2,
"last_build_number": "3",
"last_build_status": 1,
"last_build_result": 1,
"last_build_duration": 123,
"last_build_language": null,
"last_build_started_at": "2017-01-15T01:21:50Z",
"last_build_finished_at": "2017-01-15T01:23:45Z",
"active": true
};
}
var regex = /^https:\/\/api\.travis\-ci\.(org|com)\/repos\?(member|owner_name)=egeloen$/;
var response = function (method, url, data, headers) {
var matches = regex.exec(url);
if (matches[1] === 'org' && headers.Authorization !== 'token public-token') {
return [403];
}
if (matches[1] === 'com' && headers.Authorization !== 'token private-token') {
return [403];
}
return [200, [_createData('repository-' + matches[1] + '-' + matches[2])]];
};
$httpBackend
.whenGET(regex)
.respond(response);
$httpBackend
.whenGET(/.*/)
.passThrough();
}]);
});
}
};
if (process.env.TRAVIS) {
exports.config.capabilities.chromeOptions = {
binary: './chrome-linux/chrome',
args: ['--no-sandbox']
};
}