]>
Commit | Line | Data |
---|---|---|
e6af0f60 SR |
1 | // Karma configuration |
2 | ||
3 | module.exports = function(config) { | |
4 | /*var customLaunchers = { | |
5 | sl_chrome_win7: { | |
6 | base: 'SauceLabs', | |
7 | browserName: 'chrome', | |
8 | platform: 'Windows 7' | |
9 | }, | |
10 | ||
11 | sl_firefox30_linux: { | |
12 | base: 'SauceLabs', | |
13 | browserName: 'firefox', | |
14 | version: '30', | |
15 | platform: 'Linux' | |
16 | }, | |
17 | ||
18 | sl_firefox26_linux: { | |
19 | base: 'SauceLabs', | |
20 | browserName: 'firefox', | |
21 | version: 26, | |
22 | platform: 'Linux' | |
23 | }, | |
24 | ||
25 | sl_windows7_ie10: { | |
26 | base: 'SauceLabs', | |
27 | browserName: 'internet explorer', | |
28 | platform: 'Windows 7', | |
29 | version: '10' | |
30 | }, | |
31 | ||
32 | sl_windows81_ie11: { | |
33 | base: 'SauceLabs', | |
34 | browserName: 'internet explorer', | |
35 | platform: 'Windows 8.1', | |
36 | version: '11' | |
37 | }, | |
38 | ||
39 | sl_osxmavericks_safari7: { | |
40 | base: 'SauceLabs', | |
41 | browserName: 'safari', | |
42 | platform: 'OS X 10.9', | |
43 | version: '7' | |
44 | }, | |
45 | ||
46 | sl_osxmtnlion_safari6: { | |
47 | base: 'SauceLabs', | |
48 | browserName: 'safari', | |
49 | platform: 'OS X 10.8', | |
50 | version: '6' | |
51 | } | |
52 | };*/ | |
53 | ||
54 | var customLaunchers = {}; | |
55 | var browsers = []; | |
56 | var useSauce = false; | |
57 | ||
58 | if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) { | |
59 | useSauce = true; | |
60 | } | |
61 | ||
62 | if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') { | |
63 | var names = process.env.TEST_BROWSER_NAME.split(','); | |
64 | var platforms = process.env.TEST_BROWSER_OS.split(','); | |
65 | var versions = []; | |
66 | if (process.env.TEST_BROWSER_VERSION) { | |
67 | versions = process.env.TEST_BROWSER_VERSION.split(','); | |
68 | } else { | |
69 | versions = [null]; | |
70 | } | |
71 | ||
72 | for (var i = 0; i < names.length; i++) { | |
73 | for (var j = 0; j < platforms.length; j++) { | |
74 | for (var k = 0; k < versions.length; k++) { | |
75 | var launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i]; | |
76 | if (versions[k]) { | |
77 | launcher_name += '_' + versions[k]; | |
78 | } | |
79 | ||
80 | customLaunchers[launcher_name] = { | |
81 | base: 'SauceLabs', | |
82 | browserName: names[i], | |
83 | platform: platforms[j], | |
84 | }; | |
85 | ||
86 | if (versions[i]) { | |
87 | customLaunchers[launcher_name].version = versions[k]; | |
88 | } | |
89 | } | |
90 | } | |
91 | } | |
92 | ||
93 | browsers = Object.keys(customLaunchers); | |
94 | } else { | |
95 | useSauce = false; | |
96 | browsers = ['PhantomJS']; | |
97 | } | |
98 | ||
99 | var my_conf = { | |
100 | ||
101 | // base path that will be used to resolve all patterns (eg. files, exclude) | |
102 | basePath: '', | |
103 | ||
104 | // frameworks to use | |
105 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
106 | frameworks: ['mocha', 'sinon', 'chai', 'sinon-chai'], | |
107 | ||
108 | ||
109 | // list of files / patterns to load in the browser (loaded in order) | |
110 | files: [ | |
111 | 'tests/fake.*.js', | |
2c9623b5 | 112 | 'tests/assertions.js', |
e6af0f60 SR |
113 | 'include/util.js', // load first to avoid issues, since methods are called immediately |
114 | //'../include/*.js', | |
115 | 'include/base64.js', | |
116 | 'include/keysym.js', | |
117 | 'include/keysymdef.js', | |
118 | 'include/keyboard.js', | |
119 | 'include/input.js', | |
120 | 'include/websock.js', | |
121 | 'include/rfb.js', | |
122 | 'include/jsunzip.js', | |
123 | 'include/des.js', | |
124 | 'include/display.js', | |
125 | 'tests/test.*.js' | |
126 | ], | |
127 | ||
128 | client: { | |
129 | mocha: { | |
130 | 'ui': 'bdd' | |
131 | } | |
132 | }, | |
133 | ||
134 | // list of files to exclude | |
135 | exclude: [ | |
136 | '../include/playback.js', | |
137 | '../include/ui.js' | |
138 | ], | |
139 | ||
140 | customLaunchers: customLaunchers, | |
141 | ||
142 | // start these browsers | |
143 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | |
144 | browsers: browsers, | |
145 | ||
146 | // preprocess matching files before serving them to the browser | |
147 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | |
148 | preprocessors: { | |
149 | ||
150 | }, | |
151 | ||
152 | ||
153 | // test results reporter to use | |
154 | // possible values: 'dots', 'progress' | |
155 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter | |
156 | reporters: ['mocha', 'saucelabs'], | |
157 | ||
158 | ||
159 | // web server port | |
160 | port: 9876, | |
161 | ||
162 | ||
163 | // enable / disable colors in the output (reporters and logs) | |
164 | colors: true, | |
165 | ||
166 | ||
167 | // level of logging | |
168 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | |
169 | logLevel: config.LOG_INFO, | |
170 | ||
171 | ||
172 | // enable / disable watching file and executing tests whenever any file changes | |
173 | autoWatch: false, | |
174 | ||
175 | // Continuous Integration mode | |
176 | // if true, Karma captures browsers, runs the tests and exits | |
177 | singleRun: true, | |
178 | ||
179 | // Increase timeout in case connection is slow/we run more browsers than possible | |
180 | // (we currently get 3 for free, and we try to run 7, so it can take a while) | |
181 | captureTimeout: 240000 | |
182 | }; | |
183 | ||
184 | if (useSauce) { | |
f0e4548b | 185 | my_conf.captureTimeout = 0; // use SL timeout |
e6af0f60 SR |
186 | my_conf.sauceLabs = { |
187 | testName: 'noVNC Tests (all)', | |
188 | startConnect: true, | |
f0e4548b | 189 | tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER |
e6af0f60 SR |
190 | }; |
191 | } | |
192 | ||
193 | config.set(my_conf); | |
194 | }; |