Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 183 lines (160 sloc) 5.154 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;
2db0aab Vojta Jina chore(travis): enable both SauceLabs and BrowserStack
vojtajina authored
117 // Karma (with socket.io 1.x) buffers by 50 and 50 tests can take a long time on IEs;-)
118 config.browserNoActivityTimeout = 120000;
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;
2db0aab Vojta Jina chore(travis): enable both SauceLabs and BrowserStack
vojtajina authored
122 config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
123
338f949 Vojta Jina chore(travis): set SauceLabs build id
vojtajina authored
124 config.sauceLabs.build = buildLabel;
7615723 Vojta Jina chore: make it simpler to run tests on SL/BS during local development
vojtajina authored
125 config.sauceLabs.startConnect = false;
126 config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
42d497d Vojta Jina chore(travis): enable SL video recording
vojtajina authored
127 config.sauceLabs.recordScreenshots = true;
ddff347 Vojta Jina chore(travis): use only websockets and xhr-polling
vojtajina authored
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 });
2db0aab Vojta Jina chore(travis): enable both SauceLabs and BrowserStack
vojtajina authored
134
135 if (process.env.BROWSER_PROVIDER === 'saucelabs' || !process.env.BROWSER_PROVIDER) {
136 // Allocating a browser can take pretty long (eg. if we are out of capacity and need to wait
137 // for another build to finish) and so the `captureTimeout` typically kills
138 // an in-queue-pending request, which makes no sense.
139 config.captureTimeout = 0;
140 }
c64a985 Vojta Jina chore: use only polling on Travis/SL
vojtajina authored
141 }
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
142
143
144 // Terrible hack to workaround inflexibility of log4js:
145 // - ignore web-server's 404 warnings,
146 // - ignore DEBUG logs (on Travis), we log them into a file instead.
147 var IGNORED_404 = [
148 '/favicon.ico',
149 '/%7B%7BtestUrl%7D%7D',
150 '/someSanitizedUrl',
151 '/{{testUrl}}'
152 ];
153 var log4js = require('./node_modules/karma/node_modules/log4js');
154 var layouts = require('./node_modules/karma/node_modules/log4js/lib/layouts');
155 var originalConfigure = log4js.configure;
156 log4js.configure = function(log4jsConfig) {
157 var consoleAppender = log4jsConfig.appenders.shift();
158 var originalResult = originalConfigure.call(log4js, log4jsConfig);
159 var layout = layouts.layout(consoleAppender.layout.type, consoleAppender.layout);
160
161
162
163 log4js.addAppender(function(log) {
5d6482b Vojta Jina chore(karma): correct the 404 ignoring
vojtajina authored
164 var msg = log.data[0];
165
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
166 // ignore web-server's 404s
167 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
168 IGNORED_404.some(function(ignoredLog) {return msg.indexOf(ignoredLog) !== -1;})) {
09271a8 Vojta Jina chore(travis): ignore 404 warnings, debug log into file
vojtajina authored
169 return;
170 }
171
172 // on Travis, ignore DEBUG statements
173 if (process.env.TRAVIS && log.level.levelStr === config.LOG_DEBUG) {
174 return;
175 }
176
177 console.log(layout(log));
178 });
179
180 return originalResult;
181 };
29f96c8 Vojta Jina chore: update karma to 0.9.4
vojtajina authored
182 };
Something went wrong with that request. Please try again.