Skip to content

Commit

Permalink
Issue #270 - Add helper function to test that an element is not present.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Dec 18, 2014
1 parent 91808a9 commit cefb8e7
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/functional/lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
* Additional tests.
*/

define([
'intern',
'intern/chai!assert'
], function (intern, assert) {
'use strict';

function noElementByCssSelector(context, selector) {
return function () {
return context.get('remote')
.setFindTimeout(0)

.findByCssSelector(selector)
.then(assert.fail, function (err) {
assert.isTrue(/NoSuchElement/.test(String(err)));
})
.end()

.setFindTimeout(intern.config.pageLoadTimeout);
};
}

function noElementById(context, id) {
return noElementByCssSelector(context, '#' + id);
}

return {
noElementByCssSelector: noElementByCssSelector,
noElementById: noElementById
};

});


0 comments on commit cefb8e7

Please sign in to comment.