Skip to content

Commit

Permalink
Resolve flaky double-clicking link test
Browse files Browse the repository at this point in the history
Switch the test from a time-based waiting mechanism (1200 milliseconds)
to an event-based waiting mechanism.

```
2) [firefox] › navigation_tests.ts:341:1 › test double-clicking on a link ========================

  AssertionError: expected '/src/tests/fixtures/navigation.html' to equal '/__turbo/delayed_response'

    344 |
    345 |   await nextBody(page, 1200)
  > 346 |   assert.equal(pathname(page.url()), "/__turbo/delayed_response")
        |          ^
    347 |   assert.equal(await visitAction(page), "advance")
    348 | })
    349 |

      at /home/runner/work/turbo/turbo/src/tests/functional/navigation_tests.ts:346:10
```
  • Loading branch information
seanpdoyle committed Aug 1, 2022
1 parent 4c8b4e4 commit 3da1643
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tests/functional/navigation_tests.ts
Expand Up @@ -339,10 +339,11 @@ test("test correct referrer header", async ({ page }) => {
})

test("test double-clicking on a link", async ({ page }) => {
page.click("#delayed-link")
page.click("#delayed-link")
await page.click("#delayed-link", { clickCount: 2 })

await nextEventNamed(page, "turbo:load")
await nextEventNamed(page, "turbo:load")

await nextBody(page, 1200)
assert.equal(pathname(page.url()), "/__turbo/delayed_response")
assert.equal(await visitAction(page), "advance")
})
Expand Down

0 comments on commit 3da1643

Please sign in to comment.