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

[Question]: is playwright test runner suitable for unit tests? #8076

Closed
joaomelo opened this issue Aug 8, 2021 · 4 comments
Closed

[Question]: is playwright test runner suitable for unit tests? #8076

joaomelo opened this issue Aug 8, 2021 · 4 comments
Labels
feature-test-runner Playwright test specific issues

Comments

@joaomelo
Copy link

joaomelo commented Aug 8, 2021

Your question

I love to write and run all my unit and Playwright e2e tests using jest in my projects. Syntax, configuration, assertions, scripts, and so on share an underline platform. Time writing code is maximized.

I recently watched Andrey Lushnikov Applitools speak about Playwright test runner. The tool is awesome and the benefits for e2e testing are obvious.

Now, at the point of starting a new project, I am wondering if I could/should write all project tests, including unit tests, with playwright test runner.

  • Do you guys thought about that use case?
  • Any trade-offs that come to mind?
  • If one would do such a thing, how do you would approach it?
@mxschmitt
Copy link
Member

It depends how much features you need for your unit tests. The Playwright test-runner does currently not yet provide jsx/custom babel support, see #7121. Basic unit tests of Node.js application are working with Playwright and external libraries can be imported.

@mxschmitt mxschmitt added feature-test-runner Playwright test specific issues triaging labels Aug 8, 2021
@joaomelo
Copy link
Author

joaomelo commented Aug 8, 2021

That's a fair answer since I was not objective about my requirements.

To the topic you pointed, I don't use typescript and was able to set up Jest to conform to es6 syntax making all my front-end code and tests follow the same flavor. I understand that is not possible right now with Playwright.

But I think I'm in search of some sort of high-level comparison (maybe a post known by the project's members) in the realm of unit testing with both runners or some general advice from someone smarter than me that contemplated this challenge.

Thank you @mxschmitt
Stay healthy!

@mxschmitt
Copy link
Member

Awesome, talking about unit tests, I'm using it for a private project. So I have e.g. normal end-to-end projects for which I have three projects in the config (chromium, webkit, firefox) and then I have another project, which I use for unit tests. Inside this unit tests project, I'm not using the page or context fixtures and by that the browsers do not get started. (ref)

Stay healthy too!

@joaomelo
Copy link
Author

joaomelo commented Aug 9, 2021

That's very useful. Tks again @mxschmitt :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-test-runner Playwright test specific issues
Projects
None yet
Development

No branches or pull requests

2 participants