I am implementing Protractor test for a web app. I have done some google searching but I have come up with zip, I want to every spec that I create to close the browser after
Speaking about restarting browser between tests, there is a relevant configuration option:
// If true, protractor will restart the browser between each test.
// CAUTION: This will cause your tests to slow down drastically.
restartBrowserBetweenTests: false,
Set it to true
.
FYI, Here is the initial feature request:
beforeAll
and afterAll
are built into jasmine-2.x
. To make them work, you need to set jasmine2 as a testing framework in the protractor config:
exports.config = {
...
framework: 'jasmine2',
...
}
For jasmine-1.x
, there is a third-party jasmine-beforeAll package that provides the same exact functionality.
In protractor.conf.js:
capabilities:{
'shardTestFiles': true,
'maxInstances': 1
}
This will open and close the browser with each .spec file, but you may lose some of the reporting capabilities from standard plugins. If shardTestFiles is false, it will open the browser, run onPrepare, run all tests serially, then close the browser.