Skip to content

Commit 0d48e4e

Browse files
committed
failing test for remix-run#13114
1 parent 6390ad2 commit 0d48e4e

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

integration/bug-report-test.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ let appFixture: AppFixture;
4040
// Now try running this test:
4141
//
4242
// ```
43-
// pnpm test:integration bug-report --project chromium
44-
// ```
43+
// pnpm test:integration bug-report --project chromium ```
4544
//
4645
// You can add `--watch` to the end to have it re-run on file changes:
4746
//
@@ -64,27 +63,36 @@ test.beforeAll(async () => {
6463
// `createFixture` will make an app and run your tests against it.
6564
////////////////////////////////////////////////////////////////////////////
6665
files: {
67-
"app/routes/_index.tsx": js`
68-
import { useLoaderData, Link } from "react-router";
69-
70-
export function loader() {
71-
return "pizza";
66+
"api/auth/me": js`
67+
export const loader = async () => {
68+
await new Promise((resolve) => setTimeout(resolve, 500));
69+
return { user: { name: "Michael" } };
7270
}
71+
`,
72+
"app/routes/_index.tsx": js`
73+
import { Link } from "react-router";
7374
7475
export default function Index() {
75-
let data = useLoaderData();
7676
return (
7777
<div>
78-
{data}
7978
<Link to="/burgers">Other Route</Link>
8079
</div>
8180
)
8281
}
8382
`,
8483

8584
"app/routes/burgers.tsx": js`
85+
import * as React from "react";
86+
import { useFetcher } from "react-router";
87+
8688
export default function Index() {
87-
return <div>cheeseburger</div>;
89+
const fetcher = useFetcher();
90+
React.useEffect(() => {
91+
if (fetcher.state === "idle") {
92+
fetcher.load("/api/auth/me");
93+
}
94+
}, []);
95+
return (<h1>{fetcher.data ? fetcher.data.user.name : "loading..."}</h1>);
8896
}
8997
`,
9098
},
@@ -103,16 +111,19 @@ test.afterAll(() => {
103111
// add a good description for what you expect React Router to do 👇🏽
104112
////////////////////////////////////////////////////////////////////////////////
105113

106-
test("[description of what you expect it to do]", async ({ page }) => {
114+
test("I expect this page to not 404", async ({ page }) => {
107115
let app = new PlaywrightFixture(appFixture, page);
108116
// You can test any request your app might get using `fixture`.
109-
let response = await fixture.requestDocument("/");
110-
expect(await response.text()).toMatch("pizza");
117+
// let response = await fixture.requestDocument("/");
111118

112119
// If you need to test interactivity use the `app`
113120
await app.goto("/");
114121
await app.clickLink("/burgers");
115-
await page.waitForSelector("text=cheeseburger");
122+
123+
// expect that the page will not 404
124+
expect(await page.textContent("h1")).not.toBe("404 Not Found");
125+
126+
// await page.waitForSelector("text=Michael");
116127

117128
// If you're not sure what's going on, you can "poke" the app, it'll
118129
// automatically open up in your browser for 20 seconds, so be quick!

0 commit comments

Comments
 (0)