Skip to content

Commit 8d77041

Browse files
committed
test(guide): query the story headings once so the render test stays fast under load
1 parent e2ffc1f commit 8d77041

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎frontend/tests/widgets-ui/guide-story.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ describe("GuideStory", () => {
133133
);
134134
const story = screen.getByTestId("guide-story");
135135
expect(story.querySelectorAll("[data-story-chapter]")).toHaveLength(content.sections.length);
136-
for (const s of content.sections) expect(screen.getByRole("heading", { name: s.title })).toBeTruthy();
136+
// One accessibility-tree query for all headings: a query per section is slow in jsdom under load.
137+
const headingNames = screen.getAllByRole("heading").map((heading) => heading.textContent);
138+
for (const s of content.sections) expect(headingNames).toContain(s.title);
137139
expect(screen.getByTestId("guide-story-counter").textContent).toBe(`01 / ${String(content.sections.length).padStart(2, "0")}`);
138140
const skip = screen.getByRole("link", { name: content.ui.storySkip });
139141
expect(skip.getAttribute("href")).toBe("#guide-body");

0 commit comments

Comments
 (0)