Error: Invalid Chai property: toBe. Did you mean "to"?

Alf*_*pez 5 javascript chai protractor cucumberjs

I am trying to check that an element is present in an angular website. I am using protractor 5.4.0.

In the header of the my_steps.js file I have this:

global.expect = require('chai').expect
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
Run Code Online (Sandbox Code Playgroud)

The code that I am using to assert that the dropdown is present is:

Then(/^(.*) is present$/, function (dropdown,callback) {
        expect(element(by.id(dropdown)).isPresent()).toBe(true);
        callback();
Run Code Online (Sandbox Code Playgroud)

And the output of the protractor protractor.conf.js command is:

When application opened # ../Features/step_definitions/my_steps.js:62
   ? Then templateSelection is present # ../Features/step_definitions/my_steps.js:70
       Error: Invalid Chai property: toBe. Did you mean "to"?
Run Code Online (Sandbox Code Playgroud)

What am I doing wrong?

Thanks in advance.

Kac*_*per 0

isPresent()返回一个承诺

expect(element(by.id(dropdown)).isPresent()).to.eventually.equals(true);