You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to run many different Scenario() without closing the browser? #37
How to run many different Scenario() without closing the browser? This is my code:
Before((I)=>{I.amOnPage('/');I.fillField('email','someEmail@gmail.com');I.fillField('password','123456');I.click('Sign in');});Scenario('Check to see if it has landing page and welcome msg',(I)=>{I.see('Welcome to Casefriend Version 1.0');I.amOnPage('http://cflocal/#landing');});Scenario('Logining into Casefriend',(I)=>{I.click('Users');I.click('New User');});
This code passes correctly but it opens firefox, test Scenario 1 then closes firefox, opens again, and tests second Scenario. I want it to do everything on one single firefox instance. How can I do?
@DavertMik It would be really awesome if the state is reset to the initiale state of the site after each test, in order to enable a clean testing environment. (This is something CasperJS has issues with 😉)
@DavertMik
This is kinda killer for working with SauceLabs (starting browsers there is slooow)
I've been looking at how to implement this today ... Basic plan of attack is just a custom WebDriverIO Helper that only starts the browser if it hasn't already been created... This could then be easily be expanded to work off a config option, and I'd probably add that after a test fails, it might be worth restarting the browser.
... only problem is there is no beforeAll/afterAll currently implemented (as per #103) so there is no place to hook into really shut down the browser ... any thoughts on doing this?
@smozely I created a PR with this feature for Protractor/Selenium, I can try to look into it for webdriver.io or If you want to have a look feel free. #167
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
Activity
DavertMik commentedon Dec 20, 2015
I think this is a good feature that will be available soon in upcoming releases )
Thanks for the suggestion
fabioel commentedon Jan 5, 2016
@DavertMik It would be really awesome if the state is reset to the initiale state of the site after each test, in order to enable a clean testing environment. (This is something CasperJS has issues with 😉)
smozely commentedon May 31, 2016
@DavertMik
This is kinda killer for working with SauceLabs (starting browsers there is slooow)
I've been looking at how to implement this today ... Basic plan of attack is just a custom WebDriverIO Helper that only starts the browser if it hasn't already been created... This could then be easily be expanded to work off a config option, and I'd probably add that after a test fails, it might be worth restarting the browser.
... only problem is there is no beforeAll/afterAll currently implemented (as per #103) so there is no place to hook into really shut down the browser ... any thoughts on doing this?
Nighthawk14 commentedon Jul 22, 2016
@smozely I created a PR with this feature for Protractor/Selenium, I can try to look into it for webdriver.io or If you want to have a look feel free. #167
HughZurname commentedon Jan 9, 2017
@fabioel Have you tried using Nightmare? There's a setting that effectively does what you're referring to.
Below is an extract from my helpers config:
APshenkin commentedon Jun 1, 2017
Closing this issue, now there is
restartoption that can be used for disabling browser restartFathimaAfshan commentedon Feb 3, 2025
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