Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 176 lines (154 sloc) 4.809 kb
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
1 module.exports = function(config, specificOptions) {
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
2 config.set({
3 frameworks: ['jasmine'],
4 autoWatch: true,
5 logLevel: config.LOG_INFO,
6 logColors: true,
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
7 browsers: ['Chrome'],
751f058 Vojta Jina chore(travis): increase disconnect timeout
vojtajina authored
8 browserDisconnectTimeout: 10000,
4ee0687 Vojta Jina chore(travis): tolerate 2 disconnects to make the build more stable
vojtajina authored
9 browserDisconnectTolerance: 2,
9a81b86 Vojta Jina chore(travis): give browsers more time to respond
vojtajina authored
10 browserNoActivityTimeout: 20000,
475eddf Vojta Jina chore(karma): longer reconnect timeout
vojtajina authored
11
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
12
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
13 // SauceLabs config for local development.
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
14 sauceLabs: {
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
15 testName: specificOptions.testName || 'AngularJS',
ed4a1fd Vojta Jina chore(travis): force the latest version of selenium
vojtajina authored
16 startConnect: true,
17 options: {
6898ac5 Vojta Jina chore(travis): use latest selenium on SL
vojtajina authored
18 'selenium-version': '2.41.0'
ed4a1fd Vojta Jina chore(travis): force the latest version of selenium
vojtajina authored
19 }
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
20 },
21
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
22 // BrowserStack config for local development.
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
23 browserStack: {
b08427d Vojta Jina chore(travis): add some more info for BrowserStack sessions
vojtajina authored
24 project: 'AngularJS',
25 name: specificOptions.testName,
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
26 startTunnel: true,
fd4b999 Vojta Jina chore(travis): increase BrowserStack timeout to 10min
vojtajina authored
27 timeout: 600 // 10min
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
28 },
29
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
30 // For more browsers on Sauce Labs see:
31 // https://saucelabs.com/docs/platforms/webdriver
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
32 customLaunchers: {
33 'SL_Chrome': {
34 base: 'SauceLabs',
28ef263 Vojta Jina chore(travis): update Chrome on SL to 34
vojtajina authored
35 browserName: 'chrome',
36 version: '34'
7909ebe Vojta Jina chore: run more browsers on Travis (IE8,IE9,IE10,Safari,FF)
vojtajina authored
37 },
38 'SL_Firefox': {
39 base: 'SauceLabs',
162485d Vojta Jina chore(travis): use FF26
vojtajina authored
40 browserName: 'firefox',
41 version: '26'
7909ebe Vojta Jina chore: run more browsers on Travis (IE8,IE9,IE10,Safari,FF)
vojtajina authored
42 },
43 'SL_Safari': {
44 base: 'SauceLabs',
45 browserName: 'safari',
9693a42 Vojta Jina chore(travis): use Safari 7
vojtajina authored
46 platform: 'OS X 10.9',
47 version: '7'
7909ebe Vojta Jina chore: run more browsers on Travis (IE8,IE9,IE10,Safari,FF)
vojtajina authored
48 },
49 'SL_IE_9': {
50 base: 'SauceLabs',
51 browserName: 'internet explorer',
52 platform: 'Windows 2008',
53 version: '9'
54 },
55 'SL_IE_10': {
56 base: 'SauceLabs',
57 browserName: 'internet explorer',
58 platform: 'Windows 2012',
59 version: '10'
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
60 },
0410572 Vojta Jina chore(travis): define a launcher for IE11 (SauceLabs)
vojtajina authored
61 'SL_IE_11': {
62 base: 'SauceLabs',
63 browserName: 'internet explorer',
64 platform: 'Windows 8.1',
65 version: '11'
66 },
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
67
68 'BS_Chrome': {
69 base: 'BrowserStack',
70 browser: 'chrome',
71 os: 'OS X',
72 os_version: 'Mountain Lion'
73 },
74 'BS_Safari': {
75 base: 'BrowserStack',
76 browser: 'safari',
77 os: 'OS X',
78 os_version: 'Mountain Lion'
79 },
80 'BS_Firefox': {
81 base: 'BrowserStack',
82 browser: 'firefox',
83 os: 'Windows',
84 os_version: '8'
85 },
86 'BS_IE_9': {
87 base: 'BrowserStack',
88 browser: 'ie',
89 browser_version: '9.0',
90 os: 'Windows',
91 os_version: '7'
92 },
93 'BS_IE_10': {
94 base: 'BrowserStack',
95 browser: 'ie',
96 browser_version: '10.0',
97 os: 'Windows',
98 os_version: '8'
99 },
100 'BS_IE_11': {
101 base: 'BrowserStack',
102 browser: 'ie',
103 browser_version: '11.0',
104 os: 'Windows',
105 os_version: '8.1'
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
106 }
107 }
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
108 });
c64a985 Vojta Jina chore: use only polling on Travis/SL
vojtajina authored
109
110
111 if (process.env.TRAVIS) {
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
112 var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
113
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
114 config.logLevel = config.LOG_DEBUG;
ddff347 Vojta Jina chore(travis): use only websockets and xhr-polling
vojtajina authored
115 config.transports = ['websocket', 'xhr-polling'];
81147a8 Vojta Jina chore(travis): disable captureTimeout
vojtajina authored
116 config.captureTimeout = 0; // rely on SL timeout
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
117
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
118 config.browserStack.build = buildLabel;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
119 config.browserStack.startTunnel = false;
120
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
121 config.sauceLabs.build = buildLabel;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
122 config.sauceLabs.startConnect = false;
123 config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
ddff347 Vojta Jina chore(travis): use only websockets and xhr-polling
vojtajina authored
124
6127528 Vojta Jina chore(travis): switch back to SauceLabs
vojtajina authored
125 // TODO(vojta): remove once SauceLabs supports websockets.
126 // This speeds up the capturing a bit, as browsers don't even try to use websocket.
127 config.transports = ['xhr-polling'];
128
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
129 // Debug logging into a file, that we print out at the end of the build.
130 config.loggers.push({
131 type: 'file',
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
132 filename: process.env.LOGS_DIR + '/' + (specificOptions.logFile || 'karma.log')
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
133 });
c64a985 Vojta Jina chore: use only polling on Travis/SL
vojtajina authored
134 }
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
135
136
137 // Terrible hack to workaround inflexibility of log4js:
138 // - ignore web-server's 404 warnings,
139 // - ignore DEBUG logs (on Travis), we log them into a file instead.
140 var IGNORED_404 = [
141 '/favicon.ico',
142 '/%7B%7BtestUrl%7D%7D',
143 '/someSanitizedUrl',
144 '/{{testUrl}}'
145 ];
146 var log4js = require('./node_modules/karma/node_modules/log4js');
147 var layouts = require('./node_modules/karma/node_modules/log4js/lib/layouts');
148 var originalConfigure = log4js.configure;
149 log4js.configure = function(log4jsConfig) {
150 var consoleAppender = log4jsConfig.appenders.shift();
151 var originalResult = originalConfigure.call(log4js, log4jsConfig);
152 var layout = layouts.layout(consoleAppender.layout.type, consoleAppender.layout);
153
154
155
156 log4js.addAppender(function(log) {
5d6482b Vojta Jina chore(karma): correct the 404 ignoring
vojtajina authored
157 var msg = log.data[0];
158
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
159 // ignore web-server's 404s
160 if (log.categoryName === 'web-server' && log.level.levelStr === config.LOG_WARN &&
5d6482b Vojta Jina chore(karma): correct the 404 ignoring
vojtajina authored
161 IGNORED_404.some(function(ignoredLog) {return msg.indexOf(ignoredLog) !== -1})) {
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
162 return;
163 }
164
165 // on Travis, ignore DEBUG statements
166 if (process.env.TRAVIS && log.level.levelStr === config.LOG_DEBUG) {
167 return;
168 }
169
170 console.log(layout(log));
171 });
172
173 return originalResult;
174 };
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
175 };
Something went wrong with that request. Please try again.