Reputation: 21
I am new in TestCafe. I have a problem with the function child(). I want to define a variable (Collection) using Selector, but I am doing something wrong.
My code:
`import { Selector } from 'testcafe';
test('foo', async t => {
await t
const childCount = Selector('.someClassSelector').child().count;
await t
.expect(Selector('.someClassSelector').child().count).eql(childCount);
});
`
Test crashed with AssertionError: expected 10 to deeply equal { Object (_then, _fn, ...) }
I expected that the test will be passed.
Can somebody please explain to me, why the test crashed? Thank you
Upvotes: 2
Views: 1330
Reputation: 4274
You seem to forgot to add the await keyword:
const childCount = await Selector('.someClassSelector').child().count;
I recommend that you refer to the Obtain Element State topic where this inquiry is described.
Upvotes: 3