I have an angular 6 material dialog for deleting entities (employees). I want to set up protractor step to click the dialog's yes button to invoke the delete. Right now I have a page object function that does this:
deleteYesButton = () => element(by.id('deleteYes'));
and in my e2e file, I'm doing this as a step of an async test:
await page.deleteYesButton.click();
The dialog appears, but the click just closes the dialog without doing the delete. If I manually use the app press the yes button everything works ok.
The markup for the dialog is this:
Template:
<h2 mat-dialog-title>{{modalTitle}}</h2>
<mat-dialog-content id="mat-dialog-content">Do you wish to delete this {{entityname}}?</mat-dialog-content>
<mat-dialog-actions>
<button mat-button mat-dialog-close id="deleteNo">No</button>
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
<button mat-button [mat-dialog-close]="true" id="deleteYes">Yes</button>
</mat-dialog-actions>
It feels like a timing issue or maybe something else needs to be invoked? Any help would be appreciated