orbitkit icon indicating copy to clipboard operation
orbitkit copied to clipboard

Playwright E2E testing integration

Open ixahmedxi opened this issue 1 year ago • 6 comments

ixahmedxi avatar Apr 05 '24 21:04 ixahmedxi

In my attempt to create a similar turborepo starter, I implemented playwright testing by creating a dedicated tests directory which had a project for each app to perform e2e testing on. Do you have any preferred way to implement playwright here? It was honestly my first attempt in doing it in a monorepo, so you may have some experience with this already.

imCorfitz avatar Apr 06 '24 17:04 imCorfitz

There seems to be two approaches to this generally, the one you are highlighting above and the other one is to just set-up playwright inside the application itself as you would normally do in a non-monorepo application, now this comes with a few benefits over the dedicated tests folder method:

  • You get to just open only apps/web if for example that's all you're working on and that way you don't need to have the entire monorepo open just to jump to the tests application to change something up.
  • The other method of having tests folder breaks context awareness, where you will need to shift focus onto a completely different package and do changes there.

Personally, as I have done it as well before in the past, I would choose to have playwright installed in apps/web and apps/marketing individually with a test:e2e scripting in these apps' package.json file.

ixahmedxi avatar Apr 06 '24 20:04 ixahmedxi

playwright configuration tho should be in packages/config/playwright where it sets up the base config that is then used in the different playwright instances around the monorepo.

ixahmedxi avatar Apr 06 '24 20:04 ixahmedxi

I see your point. Guess the only real benefit of the other approach would be the caching of the apps when updating tests. Implementation wise, your preferred way is also the simplest to implement.

imCorfitz avatar Apr 06 '24 20:04 imCorfitz

You can go around this by defining proper inputs in the task caching mechanisms.

ixahmedxi avatar Apr 06 '24 20:04 ixahmedxi

You can go around this by defining proper inputs in the task caching mechanisms.

This sounds exciting.. Looking forward to seeing this in action.

imCorfitz avatar Apr 06 '24 20:04 imCorfitz