Skip to content

Commit

Permalink
test: consolidate action flaky test (#65541)
Browse files Browse the repository at this point in the history
This test failed in dev. It has 2 problems:

1. the nanoid only contains named export
2. we should wait for the content changed then check the browser url

```
  ● app-dir action handling › fetch actions › should handle redirects to routes that provide an
invalid RSC response

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

    Expected: "http://localhost:50473/pages-dir"
    Received: "http://localhost:50473/client"

      891 |
      892 |       await retry(async () => {
    > 893 |         expect(await browser.url()).toBe(`${next.url}/pages-dir`)
 ```


Closes NEXT-3369
  • Loading branch information
huozhi authored May 9, 2024
1 parent 9ee7d7f commit 1277ff4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,13 +890,12 @@ describe('app-dir action handling', () => {
await browser.elementByCss('#redirect-pages').click()

await retry(async () => {
expect(await browser.elementByCss('body').text()).toContain(
'Hello from a pages route'
)
expect(await browser.url()).toBe(`${next.url}/pages-dir`)
expect(mpaTriggered).toBe(true)
})

expect(await browser.elementByCss('body').text()).toContain(
'Hello from a pages route'
)
})

// TODO: investigate flakey behavior with revalidate
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/app-dir/actions/app/client/actions-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Any arbitrary library just to ensure it's bundled.
// https://github.com/vercel/next.js/pull/51367
import nanoid from 'nanoid'
import { nanoid } from 'nanoid'

export async function test() {
console.log(nanoid)
Expand Down

0 comments on commit 1277ff4

Please sign in to comment.