I do have a register process/form which passes email
, password
, confirmPass
and a tc
checkbox which has a boolean value.
When the user submits the form, an open dialogue with a text opens and in the other hand an email is being sent to the user to confirm his registration. Everything works fine.
To run an E2E protractor test for this process I wrote wrote the following code:
it("should register the user", () => {
page.getInputFields().userEmailInput.sendKeys("[email protected]");
page.getInputFields().userPassInput.sendKeys('!Q2w3e4r');
page.getInputFields().userConfirmPass.sendKeys('!Q2w3e4r');
element(by.tagName('mat-checkbox')).click();
expect( page
.getInputFields()
.userEmailInput.getAttribute("value") ).toEqual("[email protected]");
expect( page
.getInputFields()
.userPassInput.getAttribute("value") ).toEqual('!Q2w3e4r');
expect( page
.getInputFields()
.userConfirmPass.getAttribute('value') ).toEqual('!Q2w3e4r');
element( by.tagName('mat-checkbox') ).isSelected().then( (selected) => {
if (selected) {
element( by.name('mat-checkbox') ).click();
}
});
element( by.name('submitForm') ).click();
element( by.name('submitForm') ).click();
});
My issue is that I'am expecting after the test that I get a confirmation email in my inbox, which prove me in the other hand that the test was 100% successful.. to reach that I have to execute the click()
event twice after each other as you can see in my code:
element( by.name('submitForm') ).click();
element( by.name('submitForm') ).click();
So, this workaround works and I get the confirmation email in my inbox, but in the other hand the test on Terminal throws the following error:
- Failed: Error while waiting for Protractor to sync with the page: true
So, how can I avoid and/or prevent the error above as the test seems to run fine and receive the registration email?
The hint executing click
event twice and successively was mentioned here.
One thing I still have to mention is that the button is clickable just if the user enters all data and checks the tc (checkbox), otherwise it's disabled.