2
votes

I am using protractor 1.4 to E2E test our Angular website. I had a suite of tests running and passing perfectly, until a week ago when suddenly most of them started to fail on 11 seconds timeout ("Timed out waiting for Protractor to synchronize with the page after 11001ms")

since i wanted to backtrack and find if there is a piece of code somewhere that resposible for that, i reverted back to a commit that was ok and that i marked as all tests are passing and nada - still the same issue.

At this point i don't know what is the cause and how to continue. It seems that something in the environment has changed (that reverting didnt change back) but i am not sure what it can be. I thought it might to do with the Chrome version so i tried with firefox - same results.

I would highly appreciate any help given.

Example for a test that fails on that:

 it('should succeed for new user and fail for registered one', function () {
    //check create account link
    var createAccountLink = element(by.id('createNewAccountLink'));
    expect(createAccountLink.getText()).toEqual("or Create account");
    createAccountLink.click();

    //check create account title
    expect(element(by.css('#createAccountTitle > span')).getText()).toEqual("Create account");

    //insert new phone
    element(by.model('phone.number')).sendKeys(e2eHelperMethods.testedPhoneNumber);
    element(by.id('sendPinCodeBtn')).click();

    //check the pin code message
    expect(element(by.css('#pincodeSentMsg > span')).getText()).toContain(e2eHelperMethods.testedPhoneNumber);
    element(by.buttonText('OK')).click();

    //check pin code input screen
    element(by.model('model.pinCode')).sendKeys(e2eHelperMethods.defaultPin);
    element(by.id('validatePinCodeBtn')).click();

    //enter new password for the user
    element(by.model('model.password')).sendKeys(e2eHelperMethods.defaultPassword);
    element(by.model('model.repeatPassword')).sendKeys(e2eHelperMethods.defaultPassword);
    element(by.id('updateNewPasswordBtn')).click();

    //verify we got to the home screen
    expect(browser.getCurrentUrl()).toEqual(e2eHelperMethods.defaultWebsiteUri + 'home');

    //now log out and try to create same user again and verify we are failing
    browser.get(""); <-------------Here it hangs and gives me the 

    createAccountLink.click();
    element(by.model('phone.number')).sendKeys(e2eHelperMethods.testedPhoneNumber);
    element(by.id('sendPinCodeBtn')).click();
    expect(element(by.css('#numberAlreadyRegisteredMsg > span')).getText()).toContain("Your number is already registered. Please enter the password to login.");
});

Maybe it worth mentioning that at the point of the failure the website starts a Into.JS tour - maybe that's the issue?

1
do your page contains any http request that could take too long ? or do you use $timeout anywhere ? To help you it would be useful to have a jsfiddle of this page or an extract of the code . - sam
you could also try to modify the timeout of protractor and give it a longer delay, try that and let me know if putting 60s for example solves the problem getPageTimeout: 60000 (cetia gave the link) - sam

1 Answers

0
votes

Turns out, we used $timeout on start of the web application to monitor user inactivity. Disabling this feature for testing environments solved the main issue. Still for the Intro.JS framework it seems that we will have to result to using the browser.driver instance since for some reason, it hangs and eventually throw that 11 seconds exception.