Skip to content

Commit d4597de

Browse files
authored
test: Add test case for issue 498 (#500)
* test: Add failing test case for issue 498 * test: Enable 498 on non-WHS builds (will always fail) * test: Also ignore 14.1.0 (latest) for this test
1 parent 3605e14 commit d4597de

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

packages/e2e/cypress.config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export default defineConfig({
2424
env: {
2525
basePath,
2626
windowHistorySupport,
27-
supportsShallowRouting: supportsShallowRouting(nextJsVersion)
27+
supportsShallowRouting: supportsShallowRouting(nextJsVersion),
28+
nextJsVersion
2829
}
2930
}
3031
})

packages/e2e/cypress/e2e/repro-359.cy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="cypress" />
22

3-
it.only('repro-359', () => {
3+
it('repro-359', () => {
44
cy.visit('/app/repro-359')
55
cy.contains('#hydration-marker', 'hydrated').should('be.hidden')
66

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference types="cypress" />
2+
3+
if (
4+
Cypress.env('windowHistorySupport') !== 'true' &&
5+
Cypress.env('nextJsVersion') !== '14.1.0' // See issue #498
6+
) {
7+
it('Reproduction for issue #498', () => {
8+
cy.config('retries', 0)
9+
cy.visit('/app/repro-498')
10+
cy.contains('#hydration-marker', 'hydrated').should('be.hidden')
11+
cy.get('#start').click()
12+
cy.location('hash').should('eq', '#section')
13+
cy.get('button').click()
14+
cy.location('search').should('eq', '?q=test')
15+
cy.location('hash').should('eq', '#section')
16+
})
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use client'
2+
3+
import { useQueryState } from 'nuqs'
4+
import { Suspense } from 'react'
5+
6+
export default function Page() {
7+
return (
8+
<main>
9+
<a id="start" href="#section">
10+
Apply fragment
11+
</a>
12+
<Suspense>
13+
<Client />
14+
</Suspense>
15+
</main>
16+
)
17+
}
18+
19+
function Client() {
20+
const [, set] = useQueryState('q')
21+
return <button onClick={() => set('test')}>Set query</button>
22+
}

0 commit comments

Comments
 (0)