How to use as drop-in replacement for Playwright/Puppeteer? #815
-
Would it be much easier to patch existing Playwright/Puppeteer projects to use happyDom? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @tomByrer! The difference between Playwright, Puppeteer and other E2E test suites compared to Happy DOM is that they run in a real browser, while Happy DOM simulates being a browser directly in the NodeJS environment. This is also why Happy DOM is so much faster and more lightweight. Happy DOM will not paint the page and you will therefore not be able to get a screenshot out from Happy DOM or get exact painting positions of elements. However, you will probably be able to replace most of your tests with Happy DOM. I recommend using a unit test framework like Vitest in combination with Testing Library. Vitest supports Happy DOM out of the box and Testing Library will make it easy to simulate user interactions like typing and clicking. When you have it setup, you will be able to migrate test by test. |
Beta Was this translation helpful? Give feedback.
Hi @tomByrer!
The difference between Playwright, Puppeteer and other E2E test suites compared to Happy DOM is that they run in a real browser, while Happy DOM simulates being a browser directly in the NodeJS environment. This is also why Happy DOM is so much faster and more lightweight.
Happy DOM will not paint the page and you will therefore not be able to get a screenshot out from Happy DOM or get exact painting positions of elements. However, you will probably be able to replace most of your tests with Happy DOM.
I recommend using a unit test framework like Vitest in combination with Testing Library. Vitest supports Happy DOM out of the box and Testing Library will make it easy to simu…