Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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