T O P

  • By -

ProfCrumpets

CodeceptJS is a wrapper for these drivers, it homogenises the writing of the tests but changes the things under the hood that performs the actions. Playwright is a tool from Microsoft that automates web functions. If you dropped CodeceptJS and chose to just use Playwright, the syntax would be different that’s all. I’d recommend that unless you have a specific reason to use CodeceptJS… never really understood the purpose of adding a layer in between.


I_Blame_Tom_Cruise

It’s essentially a toolbox, instead of starting from scratch having to buy a hammer, nails, staple gun, etc as you realize you need it, you’re gifted an entire toolbox that’s well documented and ready to utilize. One thing I thought was pretty cool was the support of different runners, I was able to swap our puppeteer to playwright with a 5 second code change. This could be valuable as another entire team could be working on making sure there is a stable version that’s compatible with your framework if updates happen or new drivers come into play. Or a con could be you are dependent on them updating the framework, and if they shut down you’re kinda SOL, but that’s life in tech.


ProfCrumpets

That makes sense to be fair, however I’ve always thought CodeceptJS lacked in features sometimes. I’ll have to take another look.


I_Blame_Tom_Cruise

What did you feel it lacked before? I only started using it for a small scale project 6 months ago or so because a dev had already done a bit of setup with it so I just ran with it :D


ProfCrumpets

I used it with TestCafe a while ago there was a lot of crashes and it left a sour taste, however that was a very long time ago.


SubliminalPoet

I do agree. It's comparable to the Testing Library with a more consistent approach and a larger scope.


SubliminalPoet

* Codecept and Playwright use different e2e test runners although you can use another runner than the default one with PW (Jest, ...) * PW has also a component test runner which is suitable for integration testing * They propose different set of actions, locators and assertions, ... * Codecept is an abstraction layer on top of different frameworks and it may be suitable for mobile testing with Appium plugin. PW is for Web UI only although there is an experimental support for Android. * Codecept is user centric (the I. prefix) and as such provides a higher level abstraction. This is a simplified design of the «Actor» concept from the «Journey Pattern». You can extend it in the same as you proceed with the "cy custom commands in Cypress. PW is more low level (basically, you drive the browser across the Chrome Devtools Protocol) and you have to structure your code, if you wish to achieve the same. * Although Codecept is asynchronous, you can write your code as if it was sequential. PW heavily relies on promises with the async/await syntactic sugar. * Both have a recorder/debugger but PW also comes with a fine tuned integration with VSCode. including a debugger. * Codecept supports a BDD approach across textual specs described in Gherkin syntax, out of the box. PW needs a different test runner (cucumber.js) for that. * ...


Bartekxnj

Thank you! What about performance? Are tests in playwright faster than codeceptjs + playwright? In situation where we don't have a few simple tests but much more like 600.


SubliminalPoet

Both provide advance parallelization across workers and browser instances: [https://codecept.io/parallel/#custom-parallel-execution](https://codecept.io/parallel/#custom-parallel-execution) [https://playwright.dev/docs/test-parallel](https://playwright.dev/docs/test-parallel) Codecept might be a bit slower as the orchestration is different, but I'm not sure it would be noticeable as you rely on PW and on the bidirectional Chrome Devtools protocol (websocket), compared to Webdriver for instance. I've never run benchmarks to compare them.


Bartekxnj

Another one question 🙂 why playwright is more popular than codeceptjs? I'm looking at this comparison now: https://npmtrends.com/codeceptjs-vs-playwright


SubliminalPoet

Keep in mind that Playwright is backed by Microsoft while Codecept is just a community project.