Vue Selectors testers fail to grab Vue component
I'm using Testcafe Vue Selectors to test e2e in my Vue app, but it looks like I can't grab any of my components:
1) An error occurred in getVue code:
TypeError: Cannot read property '__vue__' of undefined
This is a sample test I created:
import VueSelector from "testcafe-vue-selectors";
import { Selector } from 'testcafe';
fixture `Getting Started`
.page `http://localhost:8081/`;
test('test totalValue format', async t => {
const totalValue = VueSelector("total-value");
await t
.click("#total-value-toggle-format")
.expect(totalValue.getVue(({ props }) => props.formatProperty)).eql(null)
});
The structure of my component tree is as follows:
Root
|___App
|___Hello
|___TotalValue
And I import the component like this:
"total-value": TotalValue,
Why doesn't it work?
EDIT: this is the page where I am testing the component
<template>
<div class="hello">
<div class="component-wrapper">
<total-value
:value="totalValueValue"
:formatProperty="computedFormatNumber">
</total-value>
</div>
</div>
</template>
<script>
import TotalValue from "../../core/TotalValue";
export default {
name: "hello",
components: {
"total-value": TotalValue,
},
data() {
return {
totalValueValue: 1000000,
formatNumber: true,
formatFunction: Assets.formatNumber,
};
},
computed: {
computedFormatNumber() {
return this.formatNumber ? ["nl", "0,0 a"] : [];
},
},
};
+5
source to share