microsoft / playwright-test

Build a cross-browser end-to-end test suite with Playwright.
https://playwright.dev
Apache License 2.0
777 stars 34 forks source link

Optionally build test files with Webpack #45

Closed JoelEinbinder closed 4 years ago

JoelEinbinder commented 4 years ago

Modern web dev has a lot of code generated at build time. Instead of trying to parse every combination of commonjs/typescript/scss, people should be able to pass us their webpack config which we will use to compile their unit tests.

Overriding the entry points to contain the test files to be run should provide some native web code we can run.

It would be nice to reuse/cache some shared modules. I'm worried about the performance penalty of compiling a new copy of react into every test file. Maybe webpack already will do this for us?

As a follow up, we can do the same for rollup/browserify/whatever people use.

lencioni commented 4 years ago

Metro support, or at least good way to plug in any bundler, would be nice

JoelEinbinder commented 4 years ago

Metro support, or at least good way to plug in any bundler, would be nice

I hadn't heard of metro. Looking into it, it looks like it is for react-native. Do you want to run your react-native tests in a browser? I would expect people would run a separate jest project with their react-native tests alongside their playwright tests.

JoelEinbinder commented 4 years ago

I got a proof-of-concept of this working. The performance story is not good, but I hope that can be fixed with some intelligent caching. Otherwise it works well enough to make this the main behavior. I think I can drop the current hacks around dynamically resolving and redirecting modules.

lencioni commented 4 years ago

At Airbnb, we ran into scaling issues with webpack so we've been switching to metro for bundling on web.

JoelEinbinder commented 4 years ago

Interesting! I’ll look into it.

ifiokjr commented 4 years ago

I got a proof-of-concept of this working. The performance story is not good, but I hope that can be fixed with some intelligent caching. Otherwise it works well enough to make this the main behavior. I think I can drop the current hacks around dynamically resolving and redirecting modules.

I'd be interested in taking a look at the proof of concept.