Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- alanhoskins
- Alarid
- alex-ketch
- alexbu92
- alextes
- alexuxui
- alireza-bonab
Expand Down
42 changes: 27 additions & 15 deletions integration/bug-report-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,18 @@ let appFixture: AppFixture;

test.beforeAll(async () => {
fixture = await createFixture({
future: { v2_routeConvention: true },
////////////////////////////////////////////////////////////////////////////
// 💿 Next, add files to this object, just like files in a real app,
// `createFixture` will make an app and run your tests against it.
////////////////////////////////////////////////////////////////////////////
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");
}

export default function Index() {
let data = useLoaderData();
return (
Expand All @@ -66,9 +64,31 @@ test.beforeAll(async () => {
)
}
`,
"app/routes/pizza.jsx": js`
import { json } from "@remix-run/node";

export function loader() {
return json("pizza");
}
`,

"app/routes/burgers.jsx": js`
import * as React from "react";
import { useFetcher, useSearchParams} from "@remix-run/react";
export default function Index() {
let [searchParams,setSearchParams] = useSearchParams();
const fetcher = useFetcher();
React.useEffect(() => {

fetcher.load("/pizza");
}, []);

React.useEffect(() => {
if (!searchParams.has("channel")) {
setSearchParams({channel: "whatever"})
}
}, [searchParams]);

return <div>cheeseburger</div>;
}
`,
Expand All @@ -88,22 +108,14 @@ test.afterAll(() => {
// add a good description for what you expect Remix to do 👇🏽
////////////////////////////////////////////////////////////////////////////////

test("[description of what you expect it to do]", async ({ page }) => {
test("[Successfully set searchParams without errors]", 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");

// If you need to test interactivity use the `app`
await app.goto("/");
await app.clickLink("/burgers");
await app.goto("/burgers", true);
expect(await app.getHtml()).toMatch("cheeseburger");
expect(await app.page.url()).toMatch("/burgers?channel=whatever");


// 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);

// Go check out the other tests to see what else you can do.
});

////////////////////////////////////////////////////////////////////////////////
Expand Down