Skip to content

Commit 017f8ca

Browse files
committed
test: Add @sentry/browser SauceLabs test suite
1 parent 50918f9 commit 017f8ca

File tree

10 files changed

+190
-66
lines changed

10 files changed

+190
-66
lines changed

.travis.yml

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,52 @@ cache:
1616

1717
matrix:
1818
include:
19-
- name: '@sentry/packages - build + lint + test + codecov + danger [node v8]'
20-
node_js: '8'
21-
script: scripts/danger.sh
22-
- name: '@sentry/packages - pack and zeus upload'
23-
node_js: '8'
24-
script: scripts/pack-and-upload.sh || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]]
25-
- name: '@sentry/packages - build and test [node v6]'
26-
node_js: '6'
27-
script: scripts/test.sh
28-
- name: '@sentry/packages - build and test [node v10]'
29-
node_js: '10'
30-
script: scripts/test.sh
31-
- name: '@sentry/browser - integration tests'
32-
node_js: '8'
33-
addons:
34-
chrome: stable
35-
firefox: latest
36-
sauce_connect: true
37-
script: scripts/integration.sh
38-
- name: 'raven-js - unit and integration tests'
39-
node_js: '8'
40-
addons:
41-
chrome: stable
42-
firefox: latest
43-
script: scripts/raven-js.sh
44-
- name: 'raven-js - saucelabs tests'
45-
node_js: '8'
46-
addons:
47-
sauce_connect: true
48-
script: scripts/raven-js-saucelabs.sh
49-
- name: 'raven-node [node v4]'
50-
node_js: '4'
51-
script: scripts/raven-node.sh
52-
- name: 'raven-node [node v6]'
53-
node_js: '6'
54-
script: scripts/raven-node.sh
55-
- name: 'raven-node [node v8]'
56-
node_js: '8'
57-
script: scripts/raven-node.sh
58-
- name: 'raven-node [node v10]'
59-
node_js: '10'
60-
script: scripts/raven-node.sh
19+
- name: '@sentry/packages - build + lint + test + codecov + danger [node v8]'
20+
node_js: '8'
21+
script: scripts/danger.sh
22+
- name: '@sentry/packages - pack and zeus upload'
23+
node_js: '8'
24+
script: scripts/pack-and-upload.sh || [[ ! "$TRAVIS_BRANCH" =~ ^release/ ]]
25+
- name: '@sentry/packages - build and test [node v6]'
26+
node_js: '6'
27+
script: scripts/test.sh
28+
- name: '@sentry/packages - build and test [node v10]'
29+
node_js: '10'
30+
script: scripts/test.sh
31+
- name: '@sentry/browser - integration tests'
32+
node_js: '8'
33+
addons:
34+
chrome: stable
35+
firefox: latest
36+
script: scripts/browser-integration.sh
37+
- name: '@sentry/browser - saucelabs tests'
38+
node_js: '8'
39+
addons:
40+
sauce_connect: true
41+
script: scripts/browser-saucelabs.sh
42+
- name: 'raven-js - unit and integration tests'
43+
node_js: '8'
44+
addons:
45+
chrome: stable
46+
firefox: latest
47+
script: scripts/raven-js.sh
48+
- name: 'raven-js - saucelabs tests'
49+
node_js: '8'
50+
addons:
51+
sauce_connect: true
52+
script: scripts/raven-js-saucelabs.sh
53+
- name: 'raven-node [node v4]'
54+
node_js: '4'
55+
script: scripts/raven-node.sh
56+
- name: 'raven-node [node v6]'
57+
node_js: '6'
58+
script: scripts/raven-node.sh
59+
- name: 'raven-node [node v8]'
60+
node_js: '8'
61+
script: scripts/raven-node.sh
62+
- name: 'raven-node [node v10]'
63+
node_js: '10'
64+
script: scripts/raven-node.sh
6165

6266
notifications:
6367
webhooks:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
- [core] feat: getRequestheaders should handle legacy DSNs
1515
- [core] fix: correct sampleRate behaviour
1616
- [core] feat: RewriteFrames pluggable integration
17+
- [hub] fix: Scope level overwrites level on the event
18+
- [core] ref: Check for node-env first and return more accurate global object
19+
- [core] ref: Remove Repo interface and repos attribute from Event
20+
- [browser] ref: Include md5 lib and transcript it to TypeScript
21+
- [browser] test: Run integration tests on SauceLabs
1722

1823
## 4.0.6
1924

packages/browser/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"karma-mocha": "^1.3.0",
3131
"karma-mocha-reporter": "^2.2.5",
3232
"karma-rollup-preprocessor": "^6.0.0",
33+
"karma-sauce-launcher": "^1.2.0",
3334
"karma-typescript": "^3.0.12",
3435
"karma-typescript-es6-transform": "^1.0.4",
3536
"npm-run-all": "^4.1.2",
@@ -62,6 +63,7 @@
6263
"test:watch": "karma start test/karma/karma.unit.config.js --auto-watch --no-single-run",
6364
"test:integration": "karma start test/karma/karma.integration.config.js",
6465
"test:integration:watch": "karma start test/karma/karma.integration.config.js --auto-watch --no-single-run",
66+
"test:saucelabs": "karma start test/karma/karma.saucelabs.config.js",
6567
"size:check": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print $1,\"kB\";}'",
6668
"version": "node ../../scripts/versionbump.js src/version.ts"
6769
},

packages/browser/test/integration/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function iframeExecute(iframe, done, execute, assertCallback) {
1414
function createIframe(done, file) {
1515
var iframe = document.createElement('iframe');
1616
iframe.style.display = 'none';
17-
iframe.src = `./base/test/integration/${file}.html`;
17+
iframe.src = './base/test/integration/' + file + '.html';
1818
iframe.onload = function() {
1919
done();
2020
};
@@ -55,7 +55,7 @@ function debounceAssertEventCount(sentryData, count, done) {
5555
}
5656
clearTimeout(assertTimeout);
5757
assertTimeout = setTimeout(function() {
58-
done(new Error(`Did not receive ${count} events`));
58+
done(new Error('Did not receive ' + count + ' events'));
5959
}, 1000);
6060
if (sentryData.length != count) {
6161
return false;
@@ -74,7 +74,7 @@ for (const idx in frames) {
7474
filename = frames[idx];
7575
IS_LOADER = IS_ASYNC_LOADER = !!filename.match(/^loader/);
7676

77-
describe(`integration ${filename}.html`, function() {
77+
describe('integration ' + filename + '.html', function() {
7878
this.timeout(30000);
7979

8080
beforeEach(function(done) {
@@ -184,7 +184,7 @@ for (const idx in frames) {
184184
function() {
185185
for (var i = 0; i < 2; i++) {
186186
// Different exceptions, don't dedupe
187-
Sentry.captureException(new Error(`Exception no ${Date.now() + Math.random()}`));
187+
Sentry.captureException(new Error('Exception no ' + (Date.now() + Math.random())));
188188
}
189189

190190
for (var i = 0; i < 2; i++) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = [
2+
{ pattern: 'test/integration/polyfills/es6-promise-4.2.4.js', included: false },
3+
{ pattern: 'test/integration/polyfills/whatwg-fetch-2.0.4.js', included: false },
4+
{ pattern: 'test/integration/123', included: false },
5+
{ pattern: 'test/integration/throw-string.js', included: false },
6+
{ pattern: 'test/integration/throw-error.js', included: false },
7+
{ pattern: 'test/integration/throw-object.js', included: false },
8+
{ pattern: 'test/integration/example.json', included: false },
9+
{ pattern: 'test/integration/frame.html', included: false },
10+
{ pattern: 'test/integration/loader.html', included: false },
11+
{ pattern: 'test/integration/loader-lazy-no.html', included: false },
12+
{ pattern: 'test/integration/common.js', included: false },
13+
{ pattern: 'src/loader.js', included: false },
14+
{ pattern: 'test/integration/init.js', included: false },
15+
{ pattern: 'build/bundle.js', included: false },
16+
{ pattern: 'build/bundle.js.map', included: false },
17+
'test/integration/test.js',
18+
];

packages/browser/test/karma/karma.integration.config.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,7 @@ module.exports = config => {
44
singleRun: true,
55
autoWatch: false,
66
basePath: process.cwd(),
7-
files: [
8-
{ pattern: 'test/integration/polyfills/es6-promise-4.2.4.js', included: false },
9-
{ pattern: 'test/integration/polyfills/whatwg-fetch-2.0.4.js', included: false },
10-
{ pattern: 'test/integration/123', included: false },
11-
{ pattern: 'test/integration/throw-string.js', included: false },
12-
{ pattern: 'test/integration/throw-error.js', included: false },
13-
{ pattern: 'test/integration/throw-object.js', included: false },
14-
{ pattern: 'test/integration/example.json', included: false },
15-
{ pattern: 'test/integration/frame.html', included: false },
16-
{ pattern: 'test/integration/loader.html', included: false },
17-
{ pattern: 'test/integration/loader-lazy-no.html', included: false },
18-
{ pattern: 'test/integration/common.js', included: false },
19-
{ pattern: 'src/loader.js', included: false },
20-
{ pattern: 'test/integration/init.js', included: false },
21-
{ pattern: 'build/bundle.js', included: false },
22-
{ pattern: 'build/bundle.js.map', included: false },
23-
'test/integration/test.js',
24-
],
7+
files: require('./integration-files'),
258
frameworks: ['mocha', 'chai', 'sinon'],
269
plugins: [
2710
'karma-mocha',
@@ -30,7 +13,6 @@ module.exports = config => {
3013
'karma-sinon',
3114
'karma-chrome-launcher',
3215
'karma-firefox-launcher',
33-
'karma-failed-reporter',
3416
],
3517
reporters: ['mocha'],
3618
browsers: ['ChromeHeadlessNoSandbox', 'FirefoxHeadless'],
@@ -44,7 +26,6 @@ module.exports = config => {
4426
flags: ['-headless'],
4527
},
4628
},
47-
// https://docs.travis-ci.com/user/gui-and-headless-browsers/#Karma-and-Firefox-inactivity-timeouts
4829
browserNoActivityTimeout: 30000,
4930
concurrency: 2,
5031
client: {
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
var customLaunchers = {
2+
sl_chrome: {
3+
base: 'SauceLabs',
4+
browserName: 'chrome',
5+
platform: 'Windows 10',
6+
version: 'latest',
7+
},
8+
sl_firefox: {
9+
base: 'SauceLabs',
10+
browserName: 'firefox',
11+
platform: 'Windows 10',
12+
version: 'latest',
13+
},
14+
sl_edge: {
15+
base: 'SauceLabs',
16+
browserName: 'microsoftedge',
17+
version: 'latest',
18+
platform: 'Windows 10',
19+
},
20+
sl_ie_11: {
21+
base: 'SauceLabs',
22+
browserName: 'internet explorer',
23+
platform: 'Windows 7',
24+
version: '11',
25+
},
26+
sl_ie_10: {
27+
base: 'SauceLabs',
28+
browserName: 'internet explorer',
29+
platform: 'Windows 7',
30+
version: '10',
31+
},
32+
sl_safari: {
33+
base: 'SauceLabs',
34+
browserName: 'safari',
35+
platform: 'OS X 10.12',
36+
version: '11.0',
37+
},
38+
sl_ios: {
39+
base: 'SauceLabs',
40+
browserName: 'iphone',
41+
platform: 'OS X 10.12',
42+
version: '11.0',
43+
},
44+
sl_android_7: {
45+
base: 'SauceLabs',
46+
browserName: 'Chrome',
47+
platform: 'Android',
48+
version: '7.1',
49+
device: 'Android GoogleAPI Emulator',
50+
},
51+
sl_android_6: {
52+
base: 'SauceLabs',
53+
browserName: 'Chrome',
54+
platform: 'Android',
55+
version: '6.0',
56+
device: 'Android Emulator',
57+
},
58+
sl_android_5: {
59+
base: 'SauceLabs',
60+
browserName: 'android',
61+
platform: 'Linux',
62+
version: '5.1',
63+
},
64+
sl_android_4: {
65+
base: 'SauceLabs',
66+
browserName: 'android',
67+
platform: 'Linux',
68+
version: '4.4',
69+
},
70+
};
71+
72+
module.exports = function(config) {
73+
config.set({
74+
logLevel: config.LOG_INFO,
75+
basePath: process.cwd(),
76+
files: require('./integration-files'),
77+
frameworks: ['mocha', 'chai', 'sinon'],
78+
plugins: ['karma-mocha', 'karma-chai', 'karma-sinon', 'karma-failed-reporter', 'karma-sauce-launcher'],
79+
concurrency: 2,
80+
client: {
81+
mocha: {
82+
reporter: 'html',
83+
ui: 'bdd',
84+
},
85+
},
86+
customLaunchers: customLaunchers,
87+
browsers: Object.keys(customLaunchers),
88+
reporters: ['failed', 'saucelabs'],
89+
singleRun: true,
90+
build: process.env.TRAVIS_BUILD_NUMBER,
91+
// SauceLabs allows for 2 tunnels only, therefore some browsers will have to wait
92+
// rather long time. Plus mobile emulators tend to require a lot of time to start up.
93+
// 10 minutes should be more than enough to run all of them.
94+
browserNoActivityTimeout: 600000,
95+
captureTimeout: 600000,
96+
sauceLabs: {
97+
startConnect: false,
98+
// Just something "random" so we don't have to provide additional ENV var when running locally
99+
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || Math.ceil(Math.random() * 1337),
100+
recordScreenshots: false,
101+
recordVideo: false,
102+
testName: '@sentry/browser' + (process.env.TRAVIS_JOB_NUMBER ? ' #' + process.env.TRAVIS_JOB_NUMBER : ''),
103+
public: 'public',
104+
},
105+
});
106+
};
File renamed without changes.

scripts/browser-saucelabs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
yarn
5+
# We have to build other packages first, as we use absolute packages import in TypeScript
6+
yarn build
7+
cd packages/browser
8+
yarn test:saucelabs

scripts/browser-upload-cdn.js

100644100755
File mode changed.

0 commit comments

Comments
 (0)