Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 190 lines (167 sloc) 5.081 kb
fe1188d 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,
9a81b86 Vojta Jina chore(travis): give browsers more time to respond
vojtajina authored
12 browserNoActivityTimeout: 20000,
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: {
20 'selenium-version': '2.37.0'
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',
9321a5f 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_8': {
52 base: 'SauceLabs',
53 browserName: 'internet explorer',
54 platform: 'Windows 7',
55 version: '8'
56 },
57 'SL_IE_9': {
58 base: 'SauceLabs',
59 browserName: 'internet explorer',
60 platform: 'Windows 2008',
61 version: '9'
62 },
63 'SL_IE_10': {
64 base: 'SauceLabs',
65 browserName: 'internet explorer',
66 platform: 'Windows 2012',
67 version: '10'
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
68 },
0410572 Vojta Jina chore(travis): define a launcher for IE11 (SauceLabs)
vojtajina authored
69 'SL_IE_11': {
70 base: 'SauceLabs',
71 browserName: 'internet explorer',
72 platform: 'Windows 8.1',
73 version: '11'
74 },
ffd075b Vojta Jina chore(travis): let's give BrowserStack a try
vojtajina authored
75
76 'BS_Chrome': {
77 base: 'BrowserStack',
78 browser: 'chrome',
79 os: 'OS X',
80 os_version: 'Mountain Lion'
81 },
82 'BS_Safari': {
83 base: 'BrowserStack',
84 browser: 'safari',
85 os: 'OS X',
86 os_version: 'Mountain Lion'
87 },
88 'BS_Firefox': {
89 base: 'BrowserStack',
90 browser: 'firefox',
91 os: 'Windows',
92 os_version: '8'
93 },
94 'BS_IE_8': {
95 base: 'BrowserStack',
96 browser: 'ie',
97 browser_version: '8.0',
98 os: 'Windows',
99 os_version: '7'
100 },
101 'BS_IE_9': {
102 base: 'BrowserStack',
103 browser: 'ie',
104 browser_version: '9.0',
105 os: 'Windows',
106 os_version: '7'
107 },
108 'BS_IE_10': {
109 base: 'BrowserStack',
110 browser: 'ie',
111 browser_version: '10.0',
112 os: 'Windows',
113 os_version: '8'
114 },
115 'BS_IE_11': {
116 base: 'BrowserStack',
117 browser: 'ie',
118 browser_version: '11.0',
119 os: 'Windows',
120 os_version: '8.1'
33223e2 Vojta Jina chore: set up Sauce Labs with Travis
vojtajina authored
121 }
122 }
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
123 });
c64a985 Vojta Jina chore: use only polling on Travis/SL
vojtajina authored
124
125
126 if (process.env.TRAVIS) {
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
127 var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
128
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
129 config.logLevel = config.LOG_DEBUG;
ddff347 Vojta Jina chore(travis): use only websockets and xhr-polling
vojtajina authored
130 config.transports = ['websocket', 'xhr-polling'];
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
131
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
132 config.browserStack.build = buildLabel;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
133 config.browserStack.startTunnel = false;
134
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
135 config.sauceLabs.build = buildLabel;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
136 config.sauceLabs.startConnect = false;
137 config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
ddff347 Vojta Jina chore(travis): use only websockets and xhr-polling
vojtajina authored
138
6127528 Vojta Jina chore(travis): switch back to SauceLabs
vojtajina authored
139 // TODO(vojta): remove once SauceLabs supports websockets.
140 // This speeds up the capturing a bit, as browsers don't even try to use websocket.
141 config.transports = ['xhr-polling'];
142
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
143 // Debug logging into a file, that we print out at the end of the build.
144 config.loggers.push({
145 type: 'file',
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
146 filename: process.env.LOGS_DIR + '/' + (specificOptions.logFile || 'karma.log')
80d0f98 Vojta Jina chore(travis): clean up logs
vojtajina authored
147 });
c64a985 Vojta Jina chore: use only polling on Travis/SL
vojtajina authored
148 }
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
149
150
151 // Terrible hack to workaround inflexibility of log4js:
152 // - ignore web-server's 404 warnings,
153 // - ignore DEBUG logs (on Travis), we log them into a file instead.
154 var IGNORED_404 = [
155 '/favicon.ico',
156 '/%7B%7BtestUrl%7D%7D',
157 '/someSanitizedUrl',
158 '/{{testUrl}}'
159 ];
160 var log4js = require('./node_modules/karma/node_modules/log4js');
161 var layouts = require('./node_modules/karma/node_modules/log4js/lib/layouts');
162 var originalConfigure = log4js.configure;
163 log4js.configure = function(log4jsConfig) {
164 var consoleAppender = log4jsConfig.appenders.shift();
165 var originalResult = originalConfigure.call(log4js, log4jsConfig);
166 var layout = layouts.layout(consoleAppender.layout.type, consoleAppender.layout);
167
168
169
170 log4js.addAppender(function(log) {
5d6482b Vojta Jina chore(karma): correct the 404 ignoring
vojtajina authored
171 var msg = log.data[0];
172
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
173 // ignore web-server's 404s
174 if (log.categoryName === 'web-server' && log.level.levelStr === config.LOG_WARN &&
fe1188d Michał Gołębiowski refactor(jshint): reduce duplication & test all JS files
mzgol authored
175 IGNORED_404.some(function(ignoredLog) {return msg.indexOf(ignoredLog) !== -1;})) {
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
176 return;
177 }
178
179 // on Travis, ignore DEBUG statements
180 if (process.env.TRAVIS && log.level.levelStr === config.LOG_DEBUG) {
181 return;
182 }
183
184 console.log(layout(log));
185 });
186
187 return originalResult;
188 };
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
189 };
Something went wrong with that request. Please try again.