Ability to start without initial environment
creage opened this issue ยท 4 comments
Is your feature request related to a problem? Please describe.
In our tests we need to run browsers with different NTLM credentials, and these credentials are defined in the tests body.
We are running special NTLM proxy for every different user. To run a browser using proxy setup, we are using jestPlaywright._configSeparateEnv()
with launchOptions.proxy.server
. It works fine in general, but, we have a redundant initial browser opening on each test, as defined in jest-playwright
's setup method.
Describe the solution you'd like
We'd like to have an option to skip the initial environment creation, letting us to control this. Also, the method _configSeparateEnv
should be public (without the _
).
Describe alternatives you've considered
We can close this initial context manually, but it still will take time to launch and to close, adding to the total run time, which in our case is significant.
@creage I just try to figure out on your test cases, but it's a bit difficult to understand without some example.
jestPlaywright._configSeparateEnv
was created for some internal purposes. Also I've added some methods to run tests with provided configuration. You can find some information about it here. So maybe it will be better to use some of them instead of jestPlaywright._configSeparateEnv
.
But I'm agree that setup process for this case is redundant. So I'll try to handle this.
@mmarkelov The only issue we have is the requirement to reset the context for every new httpCredentials
, which is defined by PlayWright (setCredentials()
is deprecated).
And the general problem is, that we can learn these credentials, right after the test is started it's execution only!
So, our current scenario looks like this:
- We start the runner, it creates new
browser
, with newcontext
and newpage
- We reach the command saying we have to use particular
user/pwd
- Since setting credentials to current context is deprecated - we close existing
browser
instance, and start a new one, with properuser/pwd
pair.
What we are asking for, is an ability to skip this step #1
- we don't need any default { browser, page, context }
.
We want to start our own environment manually, whenever we need it.
@creage just published jest-playwright-preset@next that will support skipInitialization option and also made jestPlaywright.configSeparateEnv
public method
@mmarkelov it works super well, thank you!