I'm getting an error returned when trying to assert against the text found within an array of elements
AssertionError: expected [ Array(1) ] to include 'This profile exists already and has two places.'
i declared the webelement reference in a page object file
i created a step that contains some code to verify the text within an array of elements
This is the webelement reference declared in the page object:
get importErrorsList(){
return element.all(by.css('[ng-if="error.error.detailMessage"]'));
}
This is how i try to check the text within the array of web elements
directoriesPageObj.importErrorsList.getText().then(function(text) {
console.log('test console output: ' + text);
expect(text).to.contain(errorText);
callback();
});
actual: i get the assertion error
expected: the test passes.
note that in the code for the steps, i have a console.log
snippet, which outputs a string that does contain the string searching for: test console output: com.reputation.imex.imp.ImportException: This profile exists already and has two places. Using the CSV import is not supported for this profile
This is what worked for me eventually:
expect(directoriesPageObj.importErrorsList.getText()).to.eventually.contain(errorText).and.notify(callback);