Angular 2 (cli) transporter jasmine expect does not resolve promise

I am writing E2E tests with Protractor and Angular 2 using Jasmine.

I am trying to do a simple wait on the getText()

item returned by the protractor.

it('should display correct hero title', () => {
    expect(element(by.css('Hero-title')).getText()).toEqual('Foobar');
});

      

This results in a type error :

Argument of type '"Foobar"' is not assignable to parameter of type 'Expected<Promise<string>>'. [2345]

      

I know what I could use .then

, but I don't want to do that as I will have loads from these expectations.

Using the new Angular CLI project this works as expected. I've gone through all the configs but can't seem to find the difference.

+3


source to share


1 answer


This applies jasmine

since 2.5.46, applying the correct typing, here is a related open issue in the Protractor tracker:



As a workaround, you can bind a version like "jasmine" to 2.5.45 until the problem is fixed:

"@types/jasmine": "2.5.45"

      

+5


source







All Articles