1

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("amin.kasbi@ic-consult.de");
   page.getInputFields().userPassInput.sendKeys('!Q2w3e4r');
   page.getInputFields().userConfirmPass.sendKeys('!Q2w3e4r');
   element(by.tagName('mat-checkbox')).click();

   expect( page
        .getInputFields()
        .userEmailInput.getAttribute("value") ).toEqual("amin.kasbi@ic-consult.de");

   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.

0

The issue is fixed.. here is what I had to change/add in order to run the test without error or failure.

...
browser.wait(protractor.ExpectedConditions.elementToBeClickable( element( by.name('submitForm') ) ), 100000)
       .then ( () => {
            browser.actions().mouseMove( element( by.name('submitForm') ) ).click().perform();
       }).then ( () => {
            browser.sleep(500);
            browser.actions().mouseMove( element( by.name('submitForm') ) ).click().perform();
       });
...

and I did get rid of of the following:

element( by.name('submitForm') ).click();
element( by.name('submitForm') ).click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.