FIX: Heisentest with topic timings

We trigger `/topics/timings` requests without ever caring about the
promise afterwards, so they can bleed from one test to another.

If you're very unlucky, this might happen and then the next test
is testing a subfolder, which means you end up with a path like
`/forum/topics/timings` which is not caught by pretender and causes the
suite to fail.

It's easier (and faster) to never send these requests in test mode
than to track the ajax requests and abort them between runs.
This commit is contained in:
Robin Ward 2020-08-12 12:24:47 -04:00
parent fc5111508f
commit 9525d3506b
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { bind } from "@ember/runloop"; import { bind } from "@ember/runloop";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { isTesting } from "discourse-common/config/environment";
// We use this class to track how long posts in a topic are on the screen. // We use this class to track how long posts in a topic are on the screen.
const PAUSE_UNLESS_SCROLLED = 1000 * 60 * 3; const PAUSE_UNLESS_SCROLLED = 1000 * 60 * 3;
@ -140,7 +141,7 @@ export default class {
this.topicTrackingState.updateSeen(topicId, highestSeen); this.topicTrackingState.updateSeen(topicId, highestSeen);
if (!$.isEmptyObject(newTimings)) { if (!$.isEmptyObject(newTimings)) {
if (this.currentUser) { if (this.currentUser && !isTesting()) {
this._inProgress = true; this._inProgress = true;
ajax("/topics/timings", { ajax("/topics/timings", {