Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example of vue component testing via browser mode with playwright #3154

Closed
4 tasks done
jd-solanki opened this issue Apr 9, 2023 · 9 comments
Closed
4 tasks done
Labels
documentation Improvements or additions to documentation pr welcome

Comments

@jd-solanki
Copy link

Clear and concise description of the problem

Hi 👋🏻
I'm building Vue UI framework - Anu

I really liked browser mode and I'm eagerly waiting for the stability of this feature. I must say we can't completely test our
vue components with jsdom when we build the UI framework and use vitest for testing. Browser mode is a huge encouragement for using vitest but in the early stage I did experience the #3124 and found that adding an example of testing vue component with Playwright's chrome as a browser provider that demonstrates browser API access like window.getComputedStyle will be easy for us to adopt and use, Moreover, it will also allow vitest team to quickly identify if there's any bug.

Suggested solution

n/a

Alternative

Not writing tests at all 😓

Additional context

I'm waiting for browser mode stability to make robust tests for testing vue components. I hope using browser mode will provide the same environment as the real browsers for robustness.

Validations

@jd-solanki jd-solanki changed the title Add an example of testing vue component testing via browser mode with playwright Add an example of vue component testing via browser mode with playwright Apr 9, 2023
@Aslemammad
Copy link
Member

I'm happy you find this feature useful, sure, I think an example would help! Feel free to send a PR if you want. I'm not that experienced in vue.

@jd-solanki
Copy link
Author

Hey, Thanks for the response. I'm still learning tests so I created this issue for creating example for beginners like me.

@Aslemammad
Copy link
Member

Ok then, PRs are welcome!

@Aslemammad Aslemammad added pr welcome feat: browser Issues and PRs related to the browser runner labels Apr 9, 2023
@lmiller1990
Copy link

Not a direct solution, but I've been working on testing Vue at Cypress - we've got a Vite dev server that works great, this might an alternative (it should all just work out of the box - some other projects I work on use it pretty successfully, like Vuetify).

@Aslemammad
Copy link
Member

@lmiller1990 Why not? If it works, then it'd be good to have those examples. Anyone can send a PR if they want, so feel free to do so. Thank you so much.

@kingyue737
Copy link
Contributor

@Aslemammad, I think lmiller mean we can test component with Cypress alone, not with vitest browser mode.

@Aslemammad
Copy link
Member

@kingyue737 Oh, I thought they would look at this as an alternative for their current solution.

@lmiller1990
Copy link

lmiller1990 commented Apr 17, 2023

Yeah, I meant if you want a client side runner, Cypress might work for your use case. It runs in the browser - doing all the execution in the browser makes a lot of sense for components, everything will just work as you'd expect, no need to mess about with jsdom or a Node.js runner shuttling messages back and forth. It also uses Vite as the bundler, so you won't need to change too much of your tooling.

@sheremet-va sheremet-va added documentation Improvements or additions to documentation and removed feat: browser Issues and PRs related to the browser runner labels Feb 16, 2024
@sheremet-va
Copy link
Member

There are now examples in the documentation (https://vitest.dev/guide/browser/#examples).

@sheremet-va sheremet-va closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation pr welcome
Projects
None yet
Development

No branches or pull requests

5 participants