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

Need to run many scenarios at one instance without relaunching the browser. How to do it? #4812

Open
FathimaAfshan opened this issue Feb 3, 2025 · 4 comments

Comments

@FathimaAfshan
Copy link

helpers: {
Playwright: {
browser: 'chromium',
url: '***',
show: true,
keepBrowserState: true, // This ensures cookies and session are maintained across scenarios
restart: false, // Prevents browser from restarting after each scenario
keepCookies: true,
}
}

I have given restart as 'false' but still the browser is getting relaunched after every scenario

@tomaszHut42
Copy link

hey @FathimaAfshan, have you found out the answer? I have the same issue

@FathimaAfshan
Copy link
Author

hey @FathimaAfshan, have you found out the answer? I have the same issue

No @tomaszHut42

@FathimaAfshan FathimaAfshan reopened this Feb 25, 2025
@myrepojuly
Copy link

myrepojuly commented Feb 25, 2025

Pls try with restart:‘keep’ @FathimaAfshan @tomaszHut42

@tomaszHut42
Copy link

hey @FathimaAfshan, indeed I fixed it for myself using restart:‘keep’ (and keepBrowserState and keepCookies set to true as well). Additionally, my issue was I used I.amOnPage('/') in the Background section, which caused the browser to reload (not close the window, but reload the page, which also broke my test workflow). The best results gave me config as aforementioned and setting a flag in Before hook:

let pageLoaded = false; 

Before(({ I }) => {
  if (!pageLoaded) {
    I.amOnPage('/'); 
    pageLoaded = true;
  }
});

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

No branches or pull requests

3 participants