How does expect in chai work with a text string?
<p>I am trying to understand expect behaviour in chai.js. I have the code to check if the login fails with invalid credentials. This is my code:</p>

<pre><code>describe('Login', function() {
  before(function(done) {
    driver.get('https://pluma-dev.herokuapp.com/client-sign-in').then(done);
  });
  it('Login with Incorrect credentials', function( done ) {
driver.findElement(webdriver.By.name("username")).sendKeys("kushal.d.joshi+29@gmail.com");
      driver.findElement(webdriver.By.name("password")).sendKeys("123"); 
      driver.findElement(webdriver.By.className("client-onboarding-signin-btn")).click().then(function(){
      driver.findElement(By.css(".has-error")).getText().then(function (text) {
        console.log(text);
        try{
                expect(text).to.be.a("Invalid email or password");
                done();
        } catch (e) {
                done(e);
        }

      });

});

    });

});
</code></pre>

<p>according to my understanding this test case should pass because i am expecting invalid username and password and got the same. However, it throws an Assertion error. That is,
1) Login Login with Incorrect credentials:
     AssertionError: expected 'Invalid email or password' to be an invalid email or password</p>