diff --git a/integration/bug-report-test.ts b/integration/bug-report-test.ts index f2c29c73165..67d6afd0586 100644 --- a/integration/bug-report-test.ts +++ b/integration/bug-report-test.ts @@ -48,27 +48,24 @@ test.beforeAll(async () => { //////////////////////////////////////////////////////////////////////////// files: { "app/routes/index.jsx": js` - import { json } from "@remix-run/node"; - import { useLoaderData, Link } from "@remix-run/react"; - - export function loader() { - return json("pizza"); - } + import { Link } from "@remix-run/react"; export default function Index() { - let data = useLoaderData(); return (
- {data} - Other Route +
pizza
+ burger link
) } `, "app/routes/burgers.jsx": js` + export default function Index() { - return
cheeseburger
; + return ( +
cheeseburger
+ ); } `, }, @@ -88,14 +85,158 @@ test.afterAll(() => appFixture.close()); test("[description of what you expect it to do]", async ({ page }) => { let app = new PlaywrightFixture(appFixture, page); // You can test any request your app might get using `fixture`. - let response = await fixture.requestDocument("/"); - expect(await response.text()).toMatch("pizza"); + // let response = await fixture.requestDocument("/"); + // expect(await response.text()).toMatch("pizza"); // If you need to test interactivity use the `app` await app.goto("/"); await app.clickLink("/burgers"); expect(await app.getHtml()).toMatch("cheeseburger"); + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + + await page.goBack({ waitUntil: "commit" }); + await page.goBack({ waitUntil: "networkidle" }); + await page.goForward({ waitUntil: "commit" }); + await page.goForward({ waitUntil: "commit" }); + expect(await app.getHtml()).not.toContain( + `Cannot destructure property 'default'` + ); + // If you're not sure what's going on, you can "poke" the app, it'll // automatically open up in your browser for 20 seconds, so be quick! // await app.poke(20);