Skip to content

Commit

Permalink
Merge pull request #78 from paypal/3.x
Browse files Browse the repository at this point in the history
3.x
  • Loading branch information
grawk authored Jul 5, 2018
2 parents 90decda + 27cd8ad commit ed3724a
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- "4"
- "8"

before_script:
- npm install -g grunt-cli
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# nemo-view changelog

## v3.1.0

* namespace view-specific methods under element name
* should be useful in destructuring situations

## v3.0.0

* publish major version (tag=se3)

## v3.0.0-alpha

* upgrade to selenium-drivex 2

## v2.2.2

* add back package-lock.json after reading docs https://docs.npmjs.com/files/package-lock.json (reading docs is good)
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,56 +406,56 @@ You will get a list of items, each with two properties `text` and `button` which
});
```

#### [locatorName]By
#### [locatorName]By or [locatorName].by

* arguments: none
* returns: JSON locator object. You can use this, for example, to pass to selenium-webdriver until statements

#### [locatorName]Present
#### [locatorName]Present or [locatorName].present

* arguments: none
* returns: Promise which resolves to true or false

#### [locatorName]Wait
#### [locatorName]Wait or [locatorName].wait

* arguments
* timeout {Number} time to wait in milliseconds
* msg {String} optional. Message to accompany error in failure case
* returns: Promise which resolves to WebElement when element is present, or reject

#### [locatorName]WaitVisible
#### [locatorName]WaitVisible or [locatorName].waitVisible

* arguments
* timeout {Number} time to wait in milliseconds
* msg {String} optional. Message to accompany error in failure case
* returns: A promise which resolves to WebElement when element is both found and visible, or reject

#### [locatorName]Visible
#### [locatorName]Visible or [locatorName].visible

* arguments: none
* returns: Promise which resolves to true or false when element is present, or rejected if element is not present

#### [locatorName]OptionText
#### [locatorName]OptionText or [locatorName].optionText

* arguments
* text: the text in the option you wish to select
* returns: Promise which resolves to true when option is selected

#### [locatorName]OptionValue
#### [locatorName]OptionValue or [locatorName].optionValue

* arguments
* value: the value attribute of the option you wish to select
* returns: Promise which resolves to true when option is selected
Any method in the view object's prototype will also be available for use
Other than that, the nemo-view uses nemo-locatex internally, so if you change your locator files and set LOCALE, nemo-view will handle the rest!

#### [locatorName]TextEquals
#### [locatorName]TextEquals or [locatorName].textEquals

* arguments
* value: the expected value for the element
* returns: Promise which resolves to true when the expected text matches, or rejects when it doesn't

#### [locatorName]AttrEquals
#### [locatorName]AttrEquals or [locatorName].attrEquals

* arguments
* attribute: attribute value to check
Expand Down
18 changes: 9 additions & 9 deletions lib/locreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@ class Locreator {

locatorObject[locatorId] = () => drivex.find(locator(), parentWebElement);

locatorObject[locatorId + 'By'] = () => locator();
locatorObject[locatorId + 'By'] = locatorObject[locatorId].by = () => locator();

locatorObject[locatorId + 'Present'] = () => drivex.present(locator(), parentWebElement);
locatorObject[locatorId + 'Present'] = locatorObject[locatorId].present = () => drivex.present(locator(), parentWebElement);

locatorObject[locatorId + 'Wait'] = (timeout, msg) => drivex.waitForElementPromise(locator(), timeout || 5000, msg || 'Wait failed for locator [' + locatorId + ']');
locatorObject[locatorId + 'Wait'] = locatorObject[locatorId].wait = (timeout, msg) => drivex.waitForElementPromise(locator(), timeout || 5000, msg || 'Wait failed for locator [' + locatorId + ']');

locatorObject[locatorId + 'WaitVisible'] = (timeout, msg) => drivex.waitForElementVisiblePromise(locator(), timeout || 5000, msg || 'WaitVisible failed for locator [' + locatorId + ']');
locatorObject[locatorId + 'WaitVisible'] = locatorObject[locatorId].waitVisible = (timeout, msg) => drivex.waitForElementVisiblePromise(locator(), timeout || 5000, msg || 'WaitVisible failed for locator [' + locatorId + ']');

locatorObject[locatorId + 'Visible'] = () => drivex.visible(locator(), parentWebElement);
locatorObject[locatorId + 'Visible'] = locatorObject[locatorId].visible = () => drivex.visible(locator(), parentWebElement);

locatorObject[locatorId + 'OptionText'] = (optionText) => drivex.selectByOptionText(locator(), optionText, parentWebElement);
locatorObject[locatorId + 'OptionText'] = locatorObject[locatorId].optionText = (optionText) => drivex.selectByOptionText(locator(), optionText, parentWebElement);

locatorObject[locatorId + 'OptionValue'] = (optionValue) => drivex.selectByOptionValue(locator(), optionValue, parentWebElement);
locatorObject[locatorId + 'OptionValue'] = locatorObject[locatorId].optionValue = (optionValue) => drivex.selectByOptionValue(locator(), optionValue, parentWebElement);

locatorObject[locatorId + 'TextEquals'] = (value) => drivex.validateText(locator(), parentWebElement, value);
locatorObject[locatorId + 'TextEquals'] = locatorObject[locatorId].textEquals = (value) => drivex.validateText(locator(), parentWebElement, value);

locatorObject[locatorId + 'AttrEquals'] = (attribute, value) => drivex.validateAttributeValue(locator(), parentWebElement, attribute, value);
locatorObject[locatorId + 'AttrEquals'] = locatorObject[locatorId].attrEquals = (attribute, value) => drivex.validateAttributeValue(locator(), parentWebElement, attribute, value);

return locatorObject;
}
Expand Down
Loading

0 comments on commit ed3724a

Please sign in to comment.