Isolate specs that are flaky in browsers

* Don't run them in browsers in the regular CI build
* Run them in browsers in a special nightly build
* Run them in Node in the regular CI build
* Run them when developers manually run the suite

This should allow the regular CI build to give us a more useful signal,
while keeping us from losing sight of the flaky specs.
This commit is contained in:
Steve Gravrock
2021-05-15 07:42:22 -07:00
parent 8b38389d56
commit 140225e7c3
4 changed files with 62 additions and 6 deletions

View File

@@ -65,8 +65,10 @@ jobs:
environment:
JASMINE_LONG_PROPERTY_TESTS: y
test_browsers:
test_browsers: &test_browsers
executor: node14
environment:
SKIP_JASMINE_BROWSER_FLAKES: "true"
steps:
- attach_workspace:
at: .
@@ -95,14 +97,16 @@ jobs:
scripts/stop-sauce-connect $(cat sauce-pidfile)
exit $exitcode
test_browser_flakes:
<<: *test_browsers
environment:
SKIP_JASMINE_BROWSER_FLAKES: "false"
workflows:
version: 2
cron:
triggers:
- schedule:
# The choice of hour is somewhat load-bearing. test_browser currently
# tends to fail if there are other Sauce tunnels open. So we only
# run it at a time when that's unlikely.
# Times are UTC.
cron: "0 10 * * *"
filters:
@@ -149,6 +153,7 @@ workflows:
filters:
branches:
ignore: /pull\/.*/ # Don't run on pull requests.
push:
jobs:
- build:
@@ -189,3 +194,23 @@ workflows:
filters:
branches:
ignore: /pull\/.*/ # Don't run on pull requests.
browser-flakes:
triggers:
- schedule:
# Times are UTC.
cron: "0 11 * * *"
filters:
branches:
only:
- main
jobs:
- build:
executor: node14
name: build_node_14
- test_browser_flakes:
requires:
- build_node_14
filters:
branches:
ignore: /pull\/.*/ # Don't run on pull requests.

View File

@@ -459,6 +459,10 @@ describe('Env integration', function() {
});
it('copes with async failures after done has been called', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
var global = {
setTimeout: function(fn, delay) {
setTimeout(fn, delay);
@@ -656,8 +660,8 @@ describe('Env integration', function() {
});
env.execute(null, function() {
// Expect >= 9 rather than >= 10 to compensate for clock imprecision
expect(duration).toBeGreaterThanOrEqual(9);
// Expect > 0 to compensate for clock imprecision
expect(duration).toBeGreaterThan(0);
done();
});
});
@@ -1007,6 +1011,10 @@ describe('Env integration', function() {
});
it('Mock clock can be installed and used in tests', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
var globalSetTimeout = jasmine
.createSpy('globalSetTimeout')
.and.callFake(function(cb, t) {
@@ -1147,6 +1155,10 @@ describe('Env integration', function() {
});
it('should not use the mock clock for asynchronous timeouts', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
createMockedEnv();
var reporter = jasmine.createSpyObj('fakeReporter', ['specDone']),
clock = env.clock;
@@ -1185,6 +1197,10 @@ describe('Env integration', function() {
});
it('should wait a custom interval before reporting async functions that fail to complete', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
createMockedEnv();
var reporter = jasmine.createSpyObj('fakeReport', [
'jasmineDone',
@@ -2819,6 +2835,10 @@ describe('Env integration', function() {
});
it('provides custom equality testers to async matchers', function(done) {
if (jasmine.getEnv().skipBrowserFlake) {
jasmine.getEnv().skipBrowserFlake();
}
jasmine.getEnv().requirePromises();
var specDone = jasmine.createSpy('specDone');

View File

@@ -0,0 +1,7 @@
(function(env) {
env.skipBrowserFlake = function() {
pending(
'Skipping specs that are known to be flaky in browsers in this run'
);
};
})(jasmine.getEnv());

View File

@@ -48,3 +48,7 @@ module.exports = {
}
}
};
if (process.env.SKIP_JASMINE_BROWSER_FLAKES === 'true') {
module.exports.helpers.push('helpers/disableBrowserFlakes.js');
}