Protractor: Typings for 'protractor' namespace missing from globals.ts in Protractor 4.0.0

Created on 13 Jul 2016  路  6Comments  路  Source: angular/protractor

Although the protractor/lib/ptor.ts defines a protractor namespace, some of its contents don't seem to be exported in any of the typings?

The globals.ts file defines:

  Browser
  ElementArrayFinder
  ElementFinder
  ElementHelper
  ProtractorBy
  ProtractorExpectedConditions

but misses:

 wrapDriver
 promise
 ActionSequence
 Key
 Command
 CommandName

It would be also great to have other public interfaces available, such as:

Locator

Thanks!
Jan

bug

Most helpful comment

Attempting an upgrade to 4.0.0 and failing on Failed: protractor.promise.all is not a function. Is there an alternative?

All 6 comments

I was taking a look at the protractor.promise namespace and didn't see protractor.promise.all.

Attempting an upgrade to 4.0.0 and failing on Failed: protractor.promise.all is not a function. Is there an alternative?

@nizhu you can/should use the webdriver promise directly now, see http://stackoverflow.com/questions/38381292/failed-cannot-read-property-all-of-undefined.

If that is the case then why does protractor.promise namespace still get set up and exported? Shouldn't _all_ promise functions be cut? Seems strange to keep protractor.promise.when but not protractor.promise.all.

This seems like a good workaround though! That is, until they either axe the entire promise namespace, or put all back.

@Droogans definitely is a workaround, I would prefer all() back to the protractor.promise namespace as well. Thanks.

Alright, changes have been made.. In reference to the missing items from global.ts: The protractor variable tied to the global namespace is now part of globals.ts. This should address the following list

 wrapDriver
 promise
 ActionSequence
 Key
 Command
 CommandName

with importing {protractor}:

import {protractor} from 'protractor/globals';

This should then work with protractor.wrapDriver(, protractor.promise, and the rest of the list above.

For JavaScript: The protractor.promise and protractor.promise.all was missing from the main specified in package.json when using require('protractor'). This has been addressed.

Was this page helpful?
0 / 5 - 0 ratings