-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #270 - Add helper function to test that an element is not present.
- Loading branch information
Mike Taylor
committed
Dec 18, 2014
1 parent
91808a9
commit cefb8e7
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; | ||
|
||
}); | ||
|
||
|