Doing the way that I've did for this repo, you'll be able to spawn a new playwright for each scenario without impact your current tests.
Why to initialize a Playwright window instead of reusing the older one?
R.: We want to each scenario be completely independent, avoiding possible errors with cookies and caches.
Unfortunately, this approach crop some part of the godog implementation. In the original godog step function, the closure can have several parameters, which one of those can be of a different type. Of course, you can always use reflection and Generic to keep the original features, although, I'm not going to do that.
// [ORIGINAL]
// ctx.Step(`^I have ([\d]+) ([\w]+) at ([0-9.]+)`)
func iDoSomething(ctx context.Context, groupA int, groupB string, groupC float32) error {}
// meanwhile, this package allows to have just a single group
Type make
or make help
to see the available commands.
Installing everything
make install
If you have some problem, take a look in the playwright issues
- check for the regexes to allow passing a variable from the feature file and using the callbackClosure
As you may notice below, one problem of this approach is the unsync stdio, if that output matter, you should sync this using a mutex, which may slow down a little bit.