I would like to check the value which appears in below selector if it is greater than or equal to 1
<span class="badge badge-pill badge-white"> 0 </span>
(In steps, the value "0" should change into "1" or "2"..)
I defined this selector in common.js
this.pill = Selector('[class*=badge-white]');
and wrote the following assertion:
await t.expect((common.pill).innerText).gte(1);
I received the following error: " AssertionError: expected '1' to be a number or a date'. I do not know how to convert ((common.pill).innerText) to number? I tried sth like this:
await t.expect(Number((common.pill).innerText)).gte(1);
But it does not work. When I check if the value is deep equal eg."3"i write:
await t.expect((common.pill).innerText).eql('3');
And it works. Could anybody help me how to check value greater than or equal? I studied it thoroughly but I can't find a solution https://devexpress.github.io/testcafe/documentation/guides/basic-guides/assert.html :(
I found a solution when created const
const number = await common.pill.innerText;
await t.expect(Number(number)).gte(1);
It works!!!!!!!!!!!!!!!!!!
so my question is why below code did not work
await t.expect(Number((common.pill).innerText)).gte(1);
Aucun commentaire:
Enregistrer un commentaire