Skip to content

Commit 50ea529

Browse files
committed
build: fix small browser test coverage
* No longer just runs the tests against the first browser of a test platform (travis, saucelabs, browserstack) * Stability is more valuable than speed (runs sequentially on CI now) * Update Saucelabs Connect * Remove unused spec reporter * Update from Edge 14 to Edge 17 * Fix pixel deviations in Edge 17
1 parent d64f94d commit 50ea529

File tree

6 files changed

+19
-49
lines changed

6 files changed

+19
-49
lines changed

package-lock.json

Lines changed: 0 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@
107107
"karma-firefox-launcher": "^1.0.1",
108108
"karma-jasmine": "^1.1.0",
109109
"karma-sauce-launcher": "^1.2.0",
110-
"karma-sharding": "^4.4.0",
111110
"karma-sourcemap-loader": "^0.3.7",
112-
"karma-spec-reporter": "^0.0.32",
113111
"madge": "^2.2.0",
114112
"magic-string": "^0.22.4",
115113
"minimatch": "^3.0.4",

scripts/saucelabs/start-tunnel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e -o pipefail
44

5-
TUNNEL_FILE="sc-4.4.10-linux.tar.gz"
5+
TUNNEL_FILE="sc-4.4.12-linux.tar.gz"
66
TUNNEL_URL="https://saucelabs.com/downloads/${TUNNEL_FILE}"
77
TUNNEL_DIR="/tmp/saucelabs-connect"
88

src/cdk/table/table.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,16 @@ describe('CdkTable', () => {
726726
return;
727727
}
728728

729-
expect(element.style[d])
730-
.toBe(directions[d], `Expected direction ${d} to be ${directions[d]}`);
729+
const expectationMessage = `Expected direction ${d} to be ${directions[d]}`;
730+
731+
// If the direction contains `px`, we parse the number to be able to avoid deviations
732+
// caused by individual browsers.
733+
if (directions[d].includes('px')) {
734+
expect(Math.round(parseInt(element.style[d])))
735+
.toBe(Math.round(parseInt(directions[d])), expectationMessage);
736+
} else {
737+
expect(element.style[d]).toBe(directions[d], expectationMessage);
738+
}
731739
});
732740
}
733741

test/karma.conf.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = (config) => {
55

66
config.set({
77
basePath: path.join(__dirname, '..'),
8-
frameworks: ['sharding', 'jasmine'],
8+
frameworks: ['jasmine'],
99
plugins: [
1010
require('karma-jasmine'),
1111
require('karma-browserstack-launcher'),
@@ -14,8 +14,6 @@ module.exports = (config) => {
1414
require('karma-firefox-launcher'),
1515
require('karma-sourcemap-loader'),
1616
require('karma-coverage'),
17-
require('karma-spec-reporter'),
18-
require('karma-sharding'),
1917
],
2018
files: [
2119
{pattern: 'node_modules/core-js/client/core.js', included: true, watched: false},
@@ -60,13 +58,6 @@ module.exports = (config) => {
6058
subdir: '.'
6159
},
6260

63-
// TODO(josephperrott): Determine how to properly disable extra output on ci.
64-
specReporter: {
65-
maxLogLines: Infinity, // Log out the entire stack trace on errors and failures.
66-
suppressSkipped: true,
67-
showSpecTiming: true,
68-
},
69-
7061
sauceLabs: {
7162
testName: 'material2',
7263
startConnect: false,
@@ -90,8 +81,8 @@ module.exports = (config) => {
9081
browserDisconnectTolerance: 3,
9182
browserNoActivityTimeout: 300000,
9283
captureTimeout: 180000,
93-
browsers: ['ChromeHeadlessLocal'],
9484

85+
browsers: ['ChromeHeadlessLocal'],
9586
singleRun: false,
9687

9788
browserConsoleLogOptions: {
@@ -104,7 +95,7 @@ module.exports = (config) => {
10495
// TODO(jelbourn): re-enable random test order once we can de-flake existing issues.
10596
random: false
10697
}
107-
}
98+
},
10899
});
109100

110101
if (process.env['TRAVIS']) {
@@ -115,8 +106,6 @@ module.exports = (config) => {
115106

116107
config.preprocessors['dist/packages/**/!(*+(.|-)spec).js'] = ['coverage'];
117108
config.reporters.push('coverage');
118-
// Hide passed tests from logs while on travis.
119-
config.specReporter.suppressPassed = true;
120109
}
121110

122111
// The MODE variable is the indicator of what row in the test matrix we're running.
@@ -135,7 +124,9 @@ module.exports = (config) => {
135124
throw new Error(`Platform "${platform}" unknown, but Travis specified. Exiting.`);
136125
}
137126

138-
// Set the browser list to be the same browser 3 times, to shard tests into three instances.
139-
config.browsers = (new Array(3)).fill(platformMap[platform][target.toLowerCase()][0]);
127+
// To guarantee a better stability for tests running on external browsers, we disable
128+
// concurrency. Stability is compared to speed more important.
129+
config.concurrency = 1;
130+
config.browsers = platformMap[platform][target.toLowerCase()];
140131
}
141132
};

test/remote_browsers.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"base": "SauceLabs",
113113
"browserName": "microsoftedge",
114114
"platform": "Windows 10",
115-
"version": "14"
115+
"version": "17"
116116
},
117117
"SL_ANDROID4.1": {
118118
"base": "SauceLabs",

0 commit comments

Comments
 (0)