test-runner icon indicating copy to clipboard operation
test-runner copied to clipboard

[Q] Any plans to move to @playwright/test?

Open jeremyzilar opened this issue 3 years ago • 11 comments

I noticed that jest-playwright package recommends using @playwright/test over playwright. Any plans to move this this in the future, since it has typescript support out of the box?

  • jest-playwright https://github.com/playwright-community/jest-playwright#configuration
  • @playwright/test https://playwright.dev/docs/intro#installation

jeremyzilar avatar Mar 11 '22 18:03 jeremyzilar

Hey @jeremyzila, we use jest-playwright as the playwright runner does not support file transformations and we need that in order to turn stories into tests. If they ever support that we could totally support it as a runner too.

I wonder what's your use case, specifically the typescript part. Our runner also has support for typescript!

yannbf avatar Mar 12 '22 14:03 yannbf

what I'm trying to do is to use Vitest instead of Jest to run the test-runner. this will minimize the amount of setup, configs and time to run tests I assume by a substantial amount.

can storybook rely on Vite to transform the stories instead? that would be neat!

horacioh avatar May 13 '22 22:05 horacioh

Hey @patak-dev do you think we can already experiment with vite? Will it be able to accept transformations like jest?

yannbf avatar May 14 '22 09:05 yannbf

Yes, from the code you shown me last time, I dont see any blockers

patak-dev avatar May 14 '22 09:05 patak-dev

Alright, I'll do some experimentations with it! Thanks!

yannbf avatar May 14 '22 09:05 yannbf

I think we might be able to use @playwright/test as playwright just appears to be a wrapper to playwright-core. Which is used in @playwright/test aswell.

andykenward avatar Jul 26 '22 11:07 andykenward

It looks like jest-playwright is installing playwright-core too https://github.com/playwright-community/jest-playwright/blob/95b83774be71e3859875ccdcc27e0e5aef28c3ff/package.json#L49.

andykenward avatar Jul 26 '22 11:07 andykenward

It looks like jest-playwright is installing playwright-core too https://github.com/playwright-community/jest-playwright/blob/95b83774be71e3859875ccdcc27e0e5aef28c3ff/package.json#L49.

Ah nope. Still need to install playwright to use jest-playwright-preset. Would've thought that playwright would be a peerDependencies for jest-playwright-preset.

andykenward avatar Jul 26 '22 12:07 andykenward

Any progress on this? @yannbf Did running with vitest instead of jest worked?

bryanjtc avatar Oct 06 '22 22:10 bryanjtc

Oooo, I'd love to know this as well, @yannbf. Thanks for all your work on Storybook!

resource11 avatar Dec 29 '22 00:12 resource11

+1, @yannbf. Thank you so much for all your work on storybook!

Just to offer another datapoint, here's (IMO) one compelling reason to support @playwright/test. It has access to the experimental ssim-cie94 image comparator (cross-link https://github.com/microsoft/playwright/issues/13873#issuecomment-1344821266).

Context: a common problem is developers might generate screenshots locally on an arm mac, and execute CI tests against x86 linux.

This yields non-determinism. From https://gitnet.fr/deblan/playwright/commit/6d82460a02dec3393490bcab7b619f668f03e6c6

As of Nov 30, 2022, we identified the following sources of non-determenistic rendering for Chromium:

  • Anti-aliasing for certain shapes might be different due to the way skia rasterizes certain shapes.
  • Color blending might be different on x86 and aarch64 architectures.

As it stands, non SaaS (chromatic/percy) solutions like Amex's https://github.com/americanexpress/jest-image-snapshot/issues/326 does not have access to this experimental comparator even when setting package.json resolutions

rc-glean avatar Mar 24 '23 00:03 rc-glean