K-Sato1995 / svelte-vertical-timeline

Svelte components for creating a vertical timeline⏳⏳
https://svelte-vertical-timeline.vercel.app/
MIT License
81 stars 9 forks source link

Question about Svelte component testing #1

Closed shinokada closed 2 years ago

shinokada commented 2 years ago

Your package.json has all testing library for jest. Do you need them when you run playwright test?

"@babel/core": "^7.17.8",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.20.0",
...
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/svelte": "^3.1.0",
"@types/jest": "^27.4.1",
...
K-Sato1995 commented 2 years ago

@shinokada

Thanks for the question! If you want to just use playwrite, the other testing libraries are unnecessary😄

The reason I installed those is simply because I just wanted to try out different testings methods(playwrite and jest/svelte-testing-library) for svelte components to see which one feels right for me!

shinokada commented 2 years ago

ありがとうございます。 How do you find them? Which one is better? I'd like to add tests to Flowbite-Svelte UI components. (It has timeline components too.)

K-Sato1995 commented 2 years ago

@shinokada

How do you find them?

Good old Googling led me to those two ways(Playwrite and svelte-testing-library)

Which one is better?

The conclusion I came to was that I would use svelte-testing-library for unit-testing groups of components and use playwrite for EtoE testing.

I'd like to add tests to Flowbite-Svelte UI components.

This looks awesome!!(I stared the repo ⭐⭐) I unfortunetly wrote only the bare minimum(not even) tests for this component library....

I think the MUI's tests for their timeline components can be a great example for ur use case. But they use enzyme which tests components in a different way.

https://github.com/mui/material-ui/blob/master/packages/mui-lab/src/Timeline/Timeline.test.tsx