-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
33 additions
and
29 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint no-restricted-properties: 0 */ | ||
|
||
'use strict'; | ||
|
||
const { By } = require('selenium-webdriver'); | ||
|
||
/** | ||
* Return an array of elements by selector. Wraps Selenium's findElements, but with a failing text for empty queries | ||
* | ||
* @param {ExecutionContext} t - Test execution context | ||
* @param {String} selector - CSS selector string | ||
* @param {Element} context - Element to query within, defaulting to t.context.session | ||
* | ||
* @returns {Promise} Resolves to array of elements | ||
*/ | ||
module.exports = async function assertNoElements(t, selector, message) { | ||
|
||
const elements = await t.context.session.findElements(By.css(selector)); | ||
const errorMessage = message || 'Should return no results for CSS selector ' + selector; | ||
|
||
t.is(elements.length, 0, errorMessage); | ||
} |