I am currently working on a Protractor test to check if a bootstrap modal window that confirms the deletion of a record is visible at this time.
The record that needs to be deleted is displayed in an angular ng-repeat, so I have to trigger the delete button from there.
When I use isPresent
for testing, it always returns true because it checks the DOM for the modal window, which will always exist. However, when I use isDisplayed
, it consistently returns false instead of the expected true.
Below is a snippet of the code...
// Use the .all repeater to search the array of presented records
element.all(by.repeater('entries in presentData')).then(function(presentData) {
// get the first record and open the options menu
presentData[0].element(by.css('.dropdown-toggle')).click();
// In that first record click the delete button
presentData[0].element(by.css('.delete-link')).click();
browser.waitForAngular();
// Remove the 'fade' class from the Bootstrap modal, as animations can sometimes interfere with testing
browser.executeScript("$('.modal').removeClass('fade');");
// Expect that the .modal-dialog is true
expect(element(by.className('modal-dialog')).isDisplayed()).toBe(true);
});
I have tried various combinations based on solutions from stackoverflow and github, but nothing has worked for me so far.
Any help or insight you could provide would be greatly appreciated!