Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Chai) assert.isBoolean is not a function - what i does wrong?

There are little part of code:

driver.wait(function(){ 
    return driver.isElementPresent(webdriver.By.className(errElement));
}, 3000, 'Element' + errElement + ' is not found').then(function(binaryVariable){
    assert.isTrue(binaryVariable, 'is not True');
      /*console.log(binaryVariable);
        console.log(typeof(binaryVariable));*/
}); 

if I enable debug print, in the console appears

true
boolean

It means that driver.wait returns boolean, so I try to check it via assert.isTrue. But I recieve error message assert.isTrue is not a function. What I does wrong?

like image 670
Valentina Avatar asked Dec 18 '22 18:12

Valentina


1 Answers

You should use

var chai = require('chai');
chai.assert.isTrue(binaryVariable, 'is not True');

Simply referring to global assert object makes use of NodeJS' own, which doesn't have isTrue or isBoolean methods.

like image 138
B0dz1o Avatar answered Jan 30 '23 21:01

B0dz1o