Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ptor undefined in 2nd teststep

I am currently trying to get into protractor (because our automation framework is not really that awesome when it comes to angular ;)), and have now run into an interesting issue: I get the message "TypeError: Cannot call method 'waitForAngular' of undefined" in my 2nd describe block for no really apparent reason to me.

The (stripped down) code I am running can be found here, along with a stacktrace: https://gist.github.com/FrankyBoy/8675399e2236e8235e79

Any help appreciated because I am thoroughly confused.

like image 556
FrankyBoy Avatar asked Mar 15 '26 17:03

FrankyBoy


1 Answers

The beforeEach functions only run before it functions, and not before describe functions. So the call to ptor = protractor.getInstance() just hasn't happened by the time you're trying to use the ptor object.

I suspect to fix this, you'll need to move the waitForAngular call into an it function, as follows:

describe('Bonus landing page', function () {
  it('should wait', function() {
    ptor.waitForAngular(); // dies with "Cannot call method 'waitForAngular' of undefined"
    // more checks were here, but it also works like this
  });
});
like image 111
Michal Charemza Avatar answered Mar 18 '26 05:03

Michal Charemza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!