How to resolve Common errors in Protractor

When you are trying to setup your testing too, there is a chance that you will be stuck on some error and it will consume some of your valuable time.

While working with protractor, there is aoo% chance that you will stumble upon this error which the most common error with this tool.

There are multiple ways to try that can fix this issue.

Failed: Error while waiting for Protractor to sync with the page: “both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor’s bootstrapping. See http://git.io/v4gXM for details

Method 1- for cucumber
Method 2- for cucumber
Using expected condition
browser.wait(EC.visibilityOf($(‘username’)));
Method 3- for jasmine

Use then to resolve and wait for subsequent step:

this.loginBtn.click().then(function(){      
    expect(element(by.xpath(‘//*[@id=”bAdd”]’)).getText()).toEqual(‘Create’);
})
Another Jasmine Error- Error: Timeout – Async callback was not invoked within timeout specified

In jasmine, async call is triggered and time out happens. To solve it, give enough time in it block for example 12000ms in blow code

it (‘some thing’, function(){
}, 120000)