After spending most of the afternoon struggling with this test, I've tried different approaches but none seem to work. The task at hand is searching for users within the company, generating a table, and selecting the user that matches the name. Currently, I use td.text-center which is not an ideal solution as it could break if there are other users with the same name in the system.
The second attempt seems to be the best solution, but it always returns an error saying the element is not found. Has anyone found a reliable way to locate TD elements within a table? The method I usually use works in other tables, just not this one...
this.editUser = function(name) {
// Original Code Block
//browser.actions().mouseMove(element(by.css('td.text-center'))).perform();
//var editUserBtn = element(by.css('.user-action-open'));
//editUserBtn.click().then(function() {
// var editDetails = element(by.cssContainingText('li > a', 'Edit Details'));
// browser.wait(EC.visibilityOf(editDetails), 3000);
// editDetails.click();
//});
// Attempt 2
// browser.actions().mouseMove(element(by.css('td.text-center'))).perform();
//browser.sleep(3000);
//var edit = element.all(by.repeater('user in users')).filter(function(rowElement){
// return rowElement.element.all(by.css('td[ng-bind="user.Firstname"]')).getText().then(function(text){
// return text.trim() == name;
// });
//}).first();
//browser.actions().mouseMove(edit).perform();
// Currently just times out and doesn't find the element.
var editUserButton = $('.user-action-open');
browser.wait(EC.visibilityOf(editUserButton), 20000).then(function() {
editUserButton.click().then(function() {
var editDetails = element(by.cssContainingText('li > a', 'Edit Details'));
browser.wait(EC.visibilityOf(editDetails), 3000);
editDetails.click();
});
});
}