forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-routes-test.ts
42 lines (36 loc) · 1.36 KB
/
js-routes-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { test } from "@playwright/test";
import { createAppFixture, createFixture, js } from "./helpers/create-fixture";
import type { AppFixture } from "./helpers/create-fixture";
import { PlaywrightFixture } from "./helpers/playwright-fixture";
test.describe(".js route files", () => {
let appFixture: AppFixture;
test.beforeAll(async () => {
appFixture = await createAppFixture(
await createFixture({
files: {
"app/routes/js.js": js`
export default () => <div data-testid="route-js">Rendered with .js ext</div>;
`,
"app/routes/jsx.jsx": js`
export default () => <div data-testid="route-jsx">Rendered with .jsx ext</div>;
`,
},
})
);
});
test.afterAll(async () => {
await appFixture.close();
});
test("should render all .js routes", async ({ page }) => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/js");
await page.waitForSelector("[data-testid='route-js']");
test.expect(await page.content()).toContain("Rendered with .js ext");
});
test("should render all .jsx routes", async ({ page }) => {
let app = new PlaywrightFixture(appFixture, page);
await app.goto("/jsx");
await page.waitForSelector("[data-testid='route-jsx']");
test.expect(await page.content()).toContain("Rendered with .jsx ext");
});
});