CaptainCodeman / svelte-headlessui

HeadlessUI components for Svelte
https://captaincodeman.github.io/svelte-headlessui/
MIT License
529 stars 25 forks source link

Update tests #60

Closed thenbe closed 9 months ago

thenbe commented 1 year ago

Originally, I had updated the tests while using vitest. But not being able to debug the tests in --headed made for a frustrating experience. So I used playwright instead. Tests can be run with pnpm run test (or pnpm run test --ui for watch mode).

Anyways, there are a couple of failing tests which (I think) are failing legitimately (as opposed to a bad test implementation). To view the trace/video, you can either:

CaptainCodeman commented 11 months ago

Hey, sorry for not getting back to you sooner.

I did have a play around with this and I just couldn't figure it out - even the simple example of the play / pause button just didn't seem to recognize the markup in the tests. i.e. the test was broken, but the markup was correct.

I need to revisit it and see what I wasn't understanding.

thenbe commented 11 months ago

Please feel free to take your time. If there's anything, just let me know how I can help.

CaptainCodeman commented 9 months ago

Thanks again for this, I had another look at both Playwright and vitest + testing-library and I think Playwright is definitely the one to go with. But I don't think the component testing is worth the effort, esp. while it's still experimental, and the doc refactor means the example pages are now easier to use for testing as well so I'm going with that approach.

I'll have a look at the tests included with this though and try to pull those in.

So, sorry it wasn't merged as it was, but this was really useful to point me in the right direction.

thenbe commented 9 months ago

I do recall it being it rough around the edges. And given that it's still experimental, I have to agree that the effort might not be worth it. Testing the doc pages directly using Playwright (as opposed to "Playwright component testing") does look like a better choice, especially at the moment.

Either way, thanks for continuing to maintain this library.