Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to start without initial environment #424

Closed
creage opened this issue Oct 22, 2020 · 4 comments
Closed

Ability to start without initial environment #424

creage opened this issue Oct 22, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@creage
Copy link

creage commented Oct 22, 2020

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.

@mmarkelov
Copy link
Member

@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 mmarkelov added the enhancement New feature or request label Oct 23, 2020
@creage
Copy link
Author

creage commented Oct 23, 2020

@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:

  1. We start the runner, it creates new browser, with new context and new page
  2. We reach the command saying we have to use particular user/pwd
  3. Since setting credentials to current context is deprecated - we close existing browser instance, and start a new one, with proper user/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.

@mmarkelov
Copy link
Member

@creage just published jest-playwright-preset@next that will support skipInitialization option and also made jestPlaywright.configSeparateEnv public method

@creage
Copy link
Author

creage commented Oct 26, 2020

@mmarkelov it works super well, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants