At first, thanks for you article about testing with TestCafe.
In this pull request I've updated you tests and removed unnecessary awaits. Let me explain why I did it and how does it work.
Selector('#id') - it's a constructor that creates an instance of Selector.
This instance exposes async methods and property getters to get element state:
If you'd like to get an element snaphot that contains all property values exposed by the selector in a single object you need to call the selector with the await keyword like you would do with regular async functions:
var container = Selector('#base');
var containerSnapshot = await container();
console.log(containerSnapshot.childElementCount); // => <number>
or
var containerSnapshot = await Selector('#base')();
console.log(containerSnapshot.childElementCount); // => <number>
Hi @maoberlehner,
At first, thanks for you article about testing with TestCafe.
In this pull request I've updated you tests and removed unnecessary awaits. Let me explain why I did it and how does it work.
Selector('#id')
- it's a constructor that creates an instance ofSelector
. This instance exposes async methods and property getters to get element state:TestCafe Assertions allows to pass this async methods and props as an
actual
value (withoutawait
):We recommend to use this way because it enables the Smart Assertion Query Mechanism.
If you'd like to get an element snaphot that contains all property values exposed by the selector in a single object you need to call the selector with the await keyword like you would do with regular async functions:
or