error out if someone tries to use both fullReset and noReset together
MODIFY
lib/basedriver/commands/session.js
lib/basedriver/commands/session.js
@@ -19,7 +19,14 @@ commands.createSession = async function (caps) {
// merge caps onto opts so we don't need to worry about what's where
Object.assign(this.opts, this.caps);
- // deal with reset
+ // deal with resets
+ // some people like to do weird things by setting noReset and fullReset
+ // both to true, but this is misguided and strange, so error here instead
+ if (this.opts.noReset && this.opts.fullReset) {
+ throw new Error("The 'noReset' and 'fullReset' capabilities are mutually " +
+ "exclusive and should not both be set to true. You " +
+ "probably meant to just use 'fullReset' on its own");
+ }
if (this.opts.noReset === true) this.opts.fullReset = false;
if (this.opts.fullReset === true) this.opts.noReset = false;
this.opts.fastReset = !this.opts.fullReset && !this.opts.noReset;

MODIFY
test/basedriver/driver-tests.js
test/basedriver/driver-tests.js
@@ -212,6 +212,17 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
});
});
+ describe('reset compatibility', () => {
+ it('should not allow both fullReset and noReset to be true', async () => {
+ let newCaps = Object.assign({}, defaultCaps, {
+ fullReset: true,
+ noReset: true
+ });
+ await d.createSession(newCaps).should.eventually.be.rejectedWith(
+ /noReset.+fullReset/);
+ });
+ });
+
describe('proxying', () => {
let sessId;
beforeEach(async () => {

error out if someone tries to use both fullReset and noReset together