Skip to content

Commit

Permalink
chore: fix flaky middleware matcher test (#49555)
Browse files Browse the repository at this point in the history
```
    ✕ should match query path (2857 ms)

  ● Middleware custom matchers basePath › should match query path

    expect(received).toBe(expected) // Object.is equality

    Expected: "random"
    Received: ""
```

https://github.com/vercel/next.js/actions/runs/4929337370/jobs/8809028722?pr=49529#step:6:201
  • Loading branch information
styfle committed May 9, 2023
1 parent 71d8064 commit 064e0c2
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { join } from 'path'
import webdriver from 'next-webdriver'
import { fetchViaHTTP } from 'next-test-utils'
import { check, fetchViaHTTP } from 'next-test-utils'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'

Expand Down Expand Up @@ -46,10 +46,8 @@ describe('Middleware custom matchers basePath', () => {
// See https://linear.app/vercel/issue/EC-160/header-value-set-on-middleware-is-not-propagated-on-client-request-of
itif(!isModeDeploy)('should match query path', async () => {
const browser = await webdriver(next.url, '/base/random')
const currentPath = await browser.elementById('router-path').text()
expect(currentPath).toBe('random')
await check(() => browser.elementById('router-path').text(), 'random')
await browser.elementById('linkelement').click()
const anotherPagePath = await browser.elementById('router-path').text()
expect(anotherPagePath).toBe('another-page')
await check(() => browser.elementById('router-path').text(), 'another-page')
})
})

0 comments on commit 064e0c2

Please sign in to comment.