Question:
How do I click on every link in a ul > li a
from one test?
Problem: this test is passing; however, it isn't clicking on the links. I know this because It isn't redirecting or waiting 2000ms.
Test:
it("should have proper page linking to all footer link", function() {
browser.driver.sleep(2000);
browser.ignoreSynchronization = true;
//creates an array of strings of all the menu items
var titles = element.all(by.css('.leftMenu.first .submenu li a'))
.map(function(elm) {
return elm.getText().then(function(text){
return text;
});
});
//iterates through the links via titles array
for (var i = 0; i < titles.length; i++) {
// creates a link via selection of cssContainText of the titles array
var link = element(by.cssContainingText('.submenu li a', titles[i]));
//click event
link.click().then(function() {
browser.driver.sleep(2000);
//currently arbitrary expectation but will pass
expect(browser.driver.getTitle()).toBe('welcome to: ' + title[i]);
});
}
});
UPDATE: Found the answer: ANSWER