-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
5fe6ce0
commit 7a58ce6
Showing
4 changed files
with
91 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Select an option of a select element | ||
* @param {String} parameter Element selector label | ||
*/ | ||
|
||
export default (parameter) => { | ||
/** | ||
* The method to use for selecting the option | ||
* @type {String} | ||
*/ | ||
|
||
// noinspection JSJQueryEfficiency | ||
$(`#controlButton-${parameter}`).waitForDisplayed(); | ||
$(`#controlButton-${parameter}`).scrollIntoView(); | ||
$(`#controlButton-${parameter}`).click(); | ||
if ($(`#${parameter}-select-clear`).isDisplayed()) { | ||
$(`#${parameter}-select-clear`).waitForClickable(); | ||
$(`#${parameter}-select-clear`).click(); | ||
} | ||
if ($(`#${parameter}-select-all`).isDisplayed()) { | ||
$(`#${parameter}-select-all`).waitForClickable(); | ||
$(`#${parameter}-select-all`).click(); | ||
} | ||
if ($(`#${parameter}-select-done`).isDisplayed()) { | ||
// if it is a multi-select selector, have to click the done button | ||
$(`#${parameter}-select-done`).waitForClickable(); | ||
$(`#${parameter}-select-done`).click(); | ||
} | ||
}; |
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,44 @@ | ||
/** | ||
* Select an option of a text or number spinner element | ||
* @param {String} parameter Element selector label | ||
* @param {String} selectionValue Value to select by | ||
*/ | ||
import pause from "./pause"; | ||
|
||
export default (parameter, selectionValue) => { | ||
/** | ||
* The method to use for selecting the option | ||
* @type {String} | ||
*/ | ||
|
||
// noinspection JSJQueryEfficiency | ||
$(`#controlButton-${parameter}`).waitForDisplayed(); | ||
$(`#controlButton-${parameter}`).scrollIntoView(); | ||
$(`#controlButton-${parameter}`).waitForClickable(); | ||
$(`#controlButton-${parameter}`).click(); | ||
$(`#${parameter}-numberSpinner`).waitForDisplayed(); | ||
$(`#${parameter}-numberSpinner`).setValue(parseInt(selectionValue)); | ||
$(`#controlButton-${parameter}`).waitForClickable(); | ||
$(`#controlButton-${parameter}`).click(); | ||
|
||
let matchValue = selectionValue; | ||
let text = ""; | ||
let count = 0; | ||
// this is essentially giving the parameter 20 seconds to show the new value | ||
// this is mostly for when it is really busy doing parallel instances | ||
while (count < 20 && text !== matchValue) { | ||
text = $(`#controlButton-${parameter}-value`).getText(); | ||
if (text !== matchValue) { | ||
pause(2000); | ||
} | ||
count += 1; | ||
} | ||
if (text !== matchValue) { | ||
console.log(`parameter is ${parameter}, selectionValue is ${selectionValue}`); | ||
// browser.debug(); | ||
} | ||
expect(text).toEqual( | ||
matchValue, | ||
`Expexted ${text} to be ${matchValue} for parameter: ${parameter}` | ||
); | ||
}; |