-1

I am trying to assert one element value by using the following code:

async  user_verify_loan_term() {
    await chaiExpect(element.getAttribute("value")==="3")
}

The assertion is not working. The expected value should be 30; but the test passes. How to fix it?

Azhar Khan
  • 3,829
  • 11
  • 26
  • 32
Devesh Joshi
  • 9
  • 1
  • 5

1 Answers1

0

Chai doesn't know how to compare values ​​in this way. This equality (===) is used in JS itself, but not in Chai. Your code should look something like this:

const expectChai = require('chai').expect;

describe('title', async () => { 
    it('title', async () => {
        const element = await $('form')
        const attr = await (await element).getAttribute('method')
        await expectChai(await attr).to.equal("3");
    });
});

If atr: string = "3" then it will be true.