Reputation: 108
test('Check on the individual devices stuff', async t => {
const devices = monitoredDevicesSection.find('.card');
console.log(devices);
console.log(devices.count);
console.log(await devices.count);
await t.expect(devices.count).eql(10);
});
Alrighty -- using testcafe I'm trying to figure out how to get my hands on the count of something, outside of an expect.
In the above code, the test passes because there are in fact 10 things with class .card there.
BUT, I can't even assign a variable/console.log anything and get '10'
The above console.log (the last one) will always print 0.
I feel like I've tried all manners and orderings of awaits and what not.. and I simply can't get const actualCount = console.log(actualCount) to print 10.
Thoughts? I know I must be right on the edge of getting this right hah.
Upvotes: 2
Views: 2328
Reputation: 21
I faced the same issue time ago (leave here the answer for google search):
function select(selector){
return Selector(selector).with({boundTestRun:testController})
}
const devices= select('.card');
const devices_count = await devices.count
Upvotes: 0