Skip to content

Commit 9dfca8f

Browse files
authored
Avoid race between visit tests (#310)
TurboDriveTestCase maintains a eventLogChannel that acts as a cursor for the page's window.eventLogs array. Before every test the eventLogChannel is drained by reading all events and its internal index (cursor) is updated accordingly. The race was happening when we changed the page location and not blocking on it: the eventLogChannel was draining the previous page bumping its internal index. After the page was reload that index was out of sync since the new page had an new, empty eventLogs array. Order of events * async location change * draining eventLogChannel on the previous page * actual location change * eventLogChannel is out-of-sync This is was fixed as part of #289
1 parent a84d25d commit 9dfca8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tests/functional/visit_tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declare const Turbo: any
55

66
export class VisitTests extends TurboDriveTestCase {
77
async setup() {
8-
this.goToLocation("/src/tests/fixtures/visit.html")
8+
await this.goToLocation("/src/tests/fixtures/visit.html")
99
}
1010

1111
async "test programmatically visiting a same-origin location"() {

0 commit comments

Comments
 (0)