I am learning protractor but I am facing a problem with a "Promise" error. I read Mocha testing with promises: Error: Timeout of 2000ms exceeded and https://github.com/angular/protractor/blob/master/docs/control-flow.md#disabling-the-control-flow but I am still stuck in this simple code.
Basically if I add the line element(by.css(gotograb_css)).click();
There will be an error Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Do I add a .then () after this ? I tried it and the error is still there even with done() at the end of the script.
My test framework in config.js for protractor is mochai
Background 1.The element css is correct as I can run it in Selenium / Java.
- I try this
it("testing site", (done)=> {
.......
done();
})
It does not work out too. Same error
var title_css = "h1[ng-bind='::$ctrl.primaryText']";
var gotograb_css = "a[ng-bind='::$ctrl.linkoutText']";
it("testing site", ()=> {
browser.get('https://www.eat24.com/');
let EC = protractor.ExpectedConditions; //
let title_element = element(by.css(title_css));
let condition = EC.presenceOf(title_element);
browser.wait(condition, 30000)
element(by.css(gotograb_css)).click(); //ERROR
})