protractor icon indicating copy to clipboard operation
protractor copied to clipboard

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

Open jan-molak opened this issue 10 years ago • 6 comments

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

jan-molak avatar Jul 13 '16 15:07 jan-molak

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

Droogans avatar Jul 13 '16 21:07 Droogans

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

nizhu avatar Jul 14 '16 00:07 nizhu

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

alecxe avatar Jul 15 '16 14:07 alecxe

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 avatar Jul 15 '16 14:07 Droogans

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

alecxe avatar Jul 15 '16 14:07 alecxe

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.

cnishina avatar Jul 26 '16 20:07 cnishina