generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add React Router Fog of War test
See #884.
- Loading branch information
Showing
13 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/e2e/react-router/v6/cypress/e2e/shared/fog-of-war.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { testFogOfWar } from 'e2e-shared/specs/react-router/fog-of-war.cy' | ||
|
||
testFogOfWar({ | ||
path: '/fog-of-war' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/e2e/react-router/v6/src/routes/fog-of-war._index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { FogOfWarStartPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default function FogOfWarStart() { | ||
return <FogOfWarStartPage resultHref="/fog-of-war/result" /> | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/e2e/react-router/v6/src/routes/fog-of-war.result.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { FogOfWarResultPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default FogOfWarResultPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/e2e/react-router/v7/app/routes/fog-of-war._index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { FogOfWarStartPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default function FogOfWarStart() { | ||
return <FogOfWarStartPage resultHref="/fog-of-war/result" /> | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/e2e/react-router/v7/app/routes/fog-of-war.result.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { FogOfWarResultPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default FogOfWarResultPage |
5 changes: 5 additions & 0 deletions
5
packages/e2e/react-router/v7/cypress/e2e/shared/fog-of-war.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { testFogOfWar } from 'e2e-shared/specs/react-router/fog-of-war.cy' | ||
|
||
testFogOfWar({ | ||
path: '/fog-of-war' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { FogOfWarStartPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default function FogOfWarStart() { | ||
return <FogOfWarStartPage resultHref="/fog-of-war/result" /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { FogOfWarResultPage } from 'e2e-shared/specs/react-router/fog-of-war' | ||
|
||
export default FogOfWarResultPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { testFogOfWar } from 'e2e-shared/specs/react-router/fog-of-war.cy' | ||
|
||
testFogOfWar({ | ||
path: '/fog-of-war' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { createTest } from '../../create-test' | ||
|
||
export const testFogOfWar = createTest('Fog of War', ({ path }) => { | ||
it('should navigate to the result page', () => { | ||
cy.visit(path) | ||
cy.contains('#hydration-marker', 'hydrated').should('be.hidden') | ||
cy.get('#set').click() | ||
cy.get('#navigate').click() | ||
cy.location('pathname').should('eq', `${path}/result`) | ||
cy.get('#result').should('have.text', 'pass') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useQueryState } from 'nuqs' | ||
import { useLink } from '../../components/link' | ||
|
||
export function FogOfWarStartPage({ resultHref }: { resultHref: string }) { | ||
const [, setState] = useQueryState('test') | ||
// const [, setState] = useState('init') | ||
const Link = useLink() | ||
return ( | ||
<> | ||
<button id="set" onClick={() => setState('pass')}> | ||
Set | ||
</button> | ||
<Link id="navigate" href={resultHref}> | ||
Navigate | ||
</Link> | ||
</> | ||
) | ||
} | ||
|
||
export function FogOfWarResultPage() { | ||
return <div id="result">pass</div> | ||
} |