Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.Given(/^I have (selected|deselected) (.*)$/, function (selectAction, location) {
- var locations;
- var treeElements;
- var expectedLocationName = null;
- locations=location.split(","); //Reassess FF to pass in table later
- browser.waitForVisible('[ng-if="options.searchShow"]',5000);
- console.log(locations);
- for(var i=0;i<locations.length;i++) {
- expectedLocationName = locations[i].toString();
- browser.clearElement('[ng-if="options.searchShow"]');
- browser.click('[ng-if="options.searchShow"]').keys(expectedLocationName);
- browser.pause(1000); //wait for search to complete
- //grab any leaves of remaining visible tree after search based on class; selected elements have class 'tree-label tree-selected'
- treeElements = browser.elements('.tree-label', 5000);
- console.log(treeElements['value']);
- treeElements['value'].map(function(singleTreeElement) {
- var actualLocationName = browser.elementIdText(singleTreeElement.ELEMENT).value;
- if (actualLocationName === expectedLocationName) {
- console.log("actual location found on page '" + actualLocationName + "' matched expected value '" + expectedLocationName + "'");
- try {
- browser.elementIdClick(singleTreeElement.ELEMENT); //@Wdio - Fails on 'already clicked' element ( class="tree-label tree-selected" )
- }catch(err){
- console.log("Before logging error:");
- console.log(err);
- console.assert(!err,"I definitely died"); //Do this to ensure we kill step
- }
- console.log("Successfully clicked");
- }
- return;
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement