Skip to content

Commit 09e1be5

Browse files
committed
Fix create template page test
1 parent c4f4a6f commit 09e1be5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

site/jest.setup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ global.TextDecoder = TextDecoder as any;
4949
global.Blob = Blob as any;
5050
global.scrollTo = jest.fn();
5151

52+
window.HTMLElement.prototype.scrollIntoView = function () {};
53+
5254
// Polyfill the getRandomValues that is used on utils/random.ts
5355
Object.defineProperty(global.self, "crypto", {
5456
value: {

site/src/pages/CreateTemplatePage/CreateTemplatePage.test.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const renderPage = async (searchParams: URLSearchParams) => {
1919
route: `/templates/new?${searchParams.toString()}`,
2020
path: "/templates/new",
2121
// We need this because after creation, the user will be redirected to here
22-
extraRoutes: [{ path: "templates/:template", element: <></> }],
22+
extraRoutes: [{ path: "templates/:template/files", element: <></> }],
2323
});
2424
// It is lazy loaded, so we have to wait for it to be rendered to not get an
2525
// act error
@@ -62,6 +62,12 @@ test("Create template from starter template", async () => {
6262
within(form).getByRole("button", { name: /create template/i }),
6363
);
6464

65+
// Wait for the drawer error to be rendered
66+
await screen.findByRole("heading", { name: /missing variables/i });
67+
await userEvent.click(
68+
screen.getByRole("button", { name: /fill variables/i }),
69+
);
70+
6571
// Wait for the variables form to be rendered and fill it
6672
await screen.findByText(/Variables/, undefined, { timeout: 5_000 });
6773

0 commit comments

Comments
 (0)