Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Typings issue since @types/jasmine update #4176

Open
sinedied opened this issue Mar 22, 2017 · 10 comments
Open

Typings issue since @types/jasmine update #4176

sinedied opened this issue Mar 22, 2017 · 10 comments

Comments

@sinedied
Copy link

Since the release of @types/[email protected] I have this issue while running my protractor tests with typescript:

[18:37:17] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
e2e/app.e2e-spec.ts (19,45): Argument of type '"Hello world !"' is not assignable to parameter of type 'Expected<Promise<string>>'. (2345)

This trace back to this code:

    expect(page.getParagraphText()).toEqual('Hello world !');

In the new jasmine types, the expect typings are now enforced (it wasn't the case before).
It seems that the protractor jasmine overrides that wait for Promises to resolve before performing the match needs to extends the typings for this to work correctly.

Bug report

  • Node Version: 6.x
  • Protractor Version: 5.x
  • Angular Version: 2.x
  • Browser(s): PhantomJS
  • Operating System and Version osx 10.12.11
@NickTomlin
Copy link
Contributor

Thanks for noting this.

Can you pin your types in the meantime to resolve this?

@sinedied
Copy link
Author

Sure, it's already done 😉
Thanks for this great tool anyways!

@ibqn
Copy link

ibqn commented Apr 4, 2017

yep :-(

I also observed this
e2e/app.e2e-spec.ts(23,54): error TS2345: Argument of type 'false' is not assignable to parameter of type 'Expected<Promise<boolean>>'.

for the line
expect(element(by.css('h1')).isPresent()).toBe(false);

Downgraded jasmine typings to
"@types/jasmine": "2.5.45"

@ChristianStornowski
Copy link

ChristianStornowski commented Apr 26, 2017

For Jasmine tests you can use @types/jasminewd2 additionally to @types/jasmine.

devversion added a commit to devversion/material2 that referenced this issue May 21, 2017
* Upgrades outdated development dependencies to the latest versions.
* Skipped upgrading Autoprefixer due to a breaking change with the Browserlist.
* Skipped upgrading UglifyJS due to unresolved issues in UglifyJS3
* Skipped upgrading google-closure-compiler due to alexeagle/closure-compiler-angular-bundling#30
* Skipped upgrading jasmine types because they now enforce types in `expect` calls (which is nice) but for Protractor the `expect` automatically unwraps promises (See angular/protractor#4176)
devversion added a commit to devversion/material2 that referenced this issue May 21, 2017
* Upgrades outdated development dependencies to the latest versions.
* Skipped upgrading Autoprefixer due to a breaking change with the Browserlist.
* Skipped upgrading UglifyJS due to unresolved issues in UglifyJS3
* Skipped upgrading google-closure-compiler due to alexeagle/closure-compiler-angular-bundling#30
* Skipped upgrading jasmine types because they now enforce types in `expect` calls (which is nice) but for Protractor the `expect` automatically unwraps promises (See angular/protractor#4176)
devversion added a commit to devversion/material2 that referenced this issue May 22, 2017
* Upgrades outdated development dependencies to the latest versions.
* Skipped upgrading Autoprefixer due to a breaking change with the Browserlist.
* Skipped upgrading UglifyJS due to unresolved issues in UglifyJS3
* Skipped upgrading google-closure-compiler due to alexeagle/closure-compiler-angular-bundling#30
* Skipped upgrading jasmine types because they now enforce types in `expect` calls (which is nice) but for Protractor the `expect` automatically unwraps promises (See angular/protractor#4176)
tinayuangao pushed a commit to angular/components that referenced this issue May 22, 2017
* build: upgrade dev dependencies

* Upgrades outdated development dependencies to the latest versions.
* Skipped upgrading Autoprefixer due to a breaking change with the Browserlist.
* Skipped upgrading UglifyJS due to unresolved issues in UglifyJS3
* Skipped upgrading google-closure-compiler due to alexeagle/closure-compiler-angular-bundling#30
* Skipped upgrading jasmine types because they now enforce types in `expect` calls (which is nice) but for Protractor the `expect` automatically unwraps promises (See angular/protractor#4176)

* Lock jasmine types
@raghulrajnkl
Copy link

expect(
to
expect(

its worked for me

@sinedied
Copy link
Author

@ChristianStornowski still not working even with @types/jasminewd2

@ChristianStornowski
Copy link

ChristianStornowski commented Jun 23, 2017

Here are my settings for package.json

... "devDependencies": { ... "@types/jasmine": "^2.5.52", "@types/jasminewd2": "^2.0.2", "jasmine-core": "^2.6.4", "typescript": "^2.3.4", ... } ...

for tsconfig.json

{ "compilerOptions": { "target": "es5", "module": "CommonJS", "moduleResolution": "Node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "outDir": "build", "strictNullChecks": true, "lib": [ "DOM", "ES5", "ES6", "ES7", "DOM.Iterable", "ScriptHost" ] } }

This is working with current IntellIJ for me.

@sinedied
Copy link
Author

@ChristianStornowski Thanks, I found why it wasn't working!

I'm using angular-cli and the default e2e package.json config has:

    "types": [
      "jasmine",
      "node"
    ]

changing it to:

    "types": [
      "jasmine",
      "jasminewd2",
      "node"
    ]

make it work!

cexbrayat added a commit to cexbrayat/angular-cli that referenced this issue Jun 24, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
cexbrayat added a commit to cexbrayat/angular-cli that referenced this issue Jun 27, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
filipesilva pushed a commit to angular/angular-cli that referenced this issue Jun 27, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
danielronnkvist pushed a commit to danielronnkvist/angular-cli that referenced this issue Jun 28, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
danielronnkvist pushed a commit to danielronnkvist/angular-cli that referenced this issue Jun 28, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
filipesilva pushed a commit to angular/angular-cli that referenced this issue Jun 29, 2017
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
patrickrobrecht added a commit to HiP-App/HiP-CmsAngularApp that referenced this issue Sep 14, 2017
patrickrobrecht pushed a commit to HiP-App/HiP-CmsAngularApp that referenced this issue Sep 14, 2017
* chore(package): update @types/jasmine to version 2.5.54

* Adding @types/jasminewd2 (cp. angular/protractor#4176)
gmrukwa added a commit to spectre-team/spectre that referenced this issue Mar 11, 2018
gmrukwa added a commit to spectre-team/spectre that referenced this issue Mar 11, 2018
gmrukwa added a commit to spectre-team/spectre that referenced this issue Mar 11, 2018
gmrukwa added a commit to spectre-team/spectre that referenced this issue Mar 11, 2018
@mruzek
Copy link

mruzek commented Apr 20, 2018

Any updates after 13 months guys ?

@devoto13
Copy link
Contributor

devoto13 commented Apr 20, 2018

@mruzek What kind of update do you expect? There is nothing broken here.

You have two options:

  • Install @types/jasminewd2 as pointed out above and keep using Protractor with SELENIUM_PROMISE_MANAGER: true (not recommended solution, because it is deprecated, has pile of drawbacks and will be removed eventually).
  • Set SELENIUM_PROMISE_MANAGER: false and use async/await syntax instead (recommended solution, see docs here).

dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
This bumps jasmine types to 2.5.53.
The version was previously pinned down to 2.5.45, because more recent versions weren't playing nice with Protractor
and lead to errors like angular/protractor#4176

The proper fix appears to be the one mentioned in the Protractor issue: add `@types/jasminewd2` typings,
and add these typings to the tsconfig for e2e tests.

[jasminewd](https://github.com/angular/jasminewd) is the adapter used by Protractor to handle the async part.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants