Closed kibertoad closed 7 years ago
I've investigated the issue further, the cause seems to be the promises.js change in the selenium-webdriver that the protractor depends on. Newer versions return fulfilled promises as opposed to actual callbacks. As promises are already fulfilled, there's nothing left to do, so the change introduced in this pull request appears to be correct.
Note that if you'd like to reproduce the problem locally, there are more changes that have to be made so that the current tests would work with cucumber, as protractor since version 3.0.0 has moved cucumber support into a separate plugin.
You can see https://github.com/kibertoad/grunt-protractor-cucumber-example as an updated example, tests for which fail without this fix and pass successfully after the fix.
Considering that callback is not mandatory (even test step in the project itself doesn't provide it), it makes sense to only invoke the callback if it's a function.
For some reason it used to work just fine on the older protractor, but with protractor 3.3.0 this change is necessary for the plugin to work.