mardi 18 février 2020

TestCafe Triggered "Assertion Error" while Assertion was Correct

I am currently using Testcafe for en-to-end testing, and I needed to assert if a text is correctly displayed. the code is written as shown below:

 await t
    .expect(Selector('div:nth-child(5) > div > table:nth-child(3) > tbody > tr:nth-child(1)  
        td:nth-child(1)').filterVisible().innerText).contains('FOR LEASE')
    .expect(Selector('div:nth-child(5) > div > table:nth-child(5) > tbody > tr:nth-child(1) > 
        td:nth-child(1)').filterVisible().innerText).contains('200 Granville Street')

but to my surprise, I got the error below on the console:

[![console error image][1]][1]
DEBUGGER PAUSE ON FAILED TEST:
AssertionError: expected 'FOR LEASE' to include 'FOR LEASE'

From the console error, the text on the element was the same as my assertion. Hence I am confused as to why this is failing. kindly help with some suggestions.

In addition, I first tried .eql() before reducing the strict equality by using .contains(). however, I got the same error on both.

Aucun commentaire:

Enregistrer un commentaire