Merge "Warn when a test runs longer than a second"
diff --git a/polygerrit-ui/app/test/common-test-setup.ts b/polygerrit-ui/app/test/common-test-setup.ts
index 0f394be..4e1662c 100644
--- a/polygerrit-ui/app/test/common-test-setup.ts
+++ b/polygerrit-ui/app/test/common-test-setup.ts
@@ -90,8 +90,10 @@
}
window.fixture = fixtureImpl;
+let testSetupTimestampMs = 0;
setup(() => {
+ testSetupTimestampMs = new Date().getTime();
window.Gerrit = {};
initGlobalVariables();
addIronOverlayBackdropStyleEl();
@@ -201,4 +203,9 @@
// `this.debounce()`. For those please be careful and cancel them using
// `this.cancelDebouncer()` in the `detached()` lifecycle hook.
flushDebouncers();
+ const testTeardownTimestampMs = new Date().getTime();
+ const elapsedMs = testTeardownTimestampMs - testSetupTimestampMs;
+ if (elapsedMs > 1000) {
+ console.warn(`ATTENTION! Test took longer than 1 second: ${elapsedMs} ms`);
+ }
});