Reputation: 751
I have a very simple assertion:
const mappingInput = 'input[data-test="appMS_mappingSite_inputField"]';
const mappingInputValue = "*";
.expect(mappingInput.value).contains(mappingInputValue, 'input contains *', { timeout: 500 })
but when I run test it fails (even though that I know for a fact that input.value contains "*".
Error message is as follows:
AssertionError: input contains *: object tested must be an array, a
map, an object, a set, a string, or a weakset, but undefined given
Is there something wrong with my script or what?
Upvotes: 0
Views: 2735
Reputation: 1669
The problem is that the mappingInput
constant is a string. The string type has no value
property, so the expression mappingInput.value
will always return undefined
.
If you are using TestCafe you can access an input value on a test page through the Selector API. The following example might suit your needs: https://devexpress.github.io/testcafe/documentation/test-api/selecting-page-elements/selectors/using-selectors.html#define-assertion-actual-value
Upvotes: 3