S
SolidJS13mo ago
Nathan

Kobalte popover not opening in testing

I'm using a Kobalte popover component. It works just fine in the browser, but for some reason it isn't opening in testing:
test("Clicking the button opens the popover", async () => {
const openButton = screen.getByRole("button", { name: "open popover" })
await userEvent.click(openButton)
expect(screen.getByRole("dialog"))
})
test("Clicking the button opens the popover", async () => {
const openButton = screen.getByRole("button", { name: "open popover" })
await userEvent.click(openButton)
expect(screen.getByRole("dialog"))
})
The above fails for not finding a dialog element.
4 Replies
Max
Max13mo ago
is userEvent here the export from testing library ? or return from userEvent.setup call some things don't work as exptected if userEvent is not setup before render
Nathan
Nathan13mo ago
Yeah, userEvent is the export. Switching to a return from setup called before rendering didn't change anything. But thanks, I didn't know about that.
Max
Max13mo ago
annoying it didnt fix, just to check, that's not full code right? components is getting rendered somewhere
Nathan
Nathan13mo ago
Yes, that's just the individual test
Want results from more Discord servers?
Add your server