Protractor restartBrowserBetweenTests make the browser to restart between the it blocks. In protractor, It blocks are nothing but tests. SO if we have a requirement to start the browser between each test then we can make use of the code.
For example, we can't inject the test name into the browser at start time because it's starting up while the previous test is active. I have performed my testing using below code, give a try if you have time.
import { browser} from "protractor";
describe("restart browser between tests in Protractor", function(){
browser.manage().timeouts().implicitlyWait(30000)
it('test 1', function() {
browser.ignoreSynchronization = true
browser.get("https://chercher.tech/")
});
it('test 2', function() {
browser.ignoreSynchronization = true
browser.get("https://google.com/")
});
})
Conf file
exports.config = {
chromeDriver: 'PATH/chromedriver.exe',
seleniumServerJar: 'PATH/jars/selenium-server-standalone-3.11.0.jar',
specs: ['PATH\JSFilesLocation\Spec\abc.js'],
restartBrowserBetweenTests: true,
capabilities: {
browserName: 'chrome'
},
}
I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.