-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into support-bun-pm
- Loading branch information
Showing
6 changed files
with
192 additions
and
45 deletions.
There are no files selected for viewing
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
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
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,70 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
import { PlaywrightFixture } from "./helpers/playwright-fixture.js"; | ||
import type { Fixture, AppFixture } from "./helpers/create-fixture.js"; | ||
import { | ||
createAppFixture, | ||
createFixture, | ||
js, | ||
} from "./helpers/create-fixture.js"; | ||
|
||
let fixture: Fixture; | ||
let appFixture: AppFixture; | ||
|
||
test.beforeEach(async ({ context }) => { | ||
await context.route(/_data/, async (route) => { | ||
await new Promise((resolve) => setTimeout(resolve, 50)); | ||
route.continue(); | ||
}); | ||
}); | ||
|
||
test.beforeAll(async () => { | ||
fixture = await createFixture({ | ||
useRemixServe: true, | ||
files: { | ||
"app/routes/_index.tsx": 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 ( | ||
<div> | ||
{data} | ||
<Link to="/burgers">Other Route</Link> | ||
</div> | ||
) | ||
} | ||
`, | ||
|
||
"app/routes/burgers.tsx": js` | ||
export default function Index() { | ||
return <div>cheeseburger</div>; | ||
} | ||
`, | ||
}, | ||
}); | ||
|
||
// This creates an interactive app using playwright. | ||
appFixture = await createAppFixture(fixture); | ||
}); | ||
|
||
test.afterAll(() => { | ||
appFixture.close(); | ||
}); | ||
|
||
test("should start and perform client side navigation", 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 page.waitForSelector("text=cheeseburger"); | ||
}); |
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
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
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