ste
ste

Reputation: 3269

Testcafe Vue Selectors can't grab Vue component

I'm using Testcafe Vue Selectors to perform e2e testing on my Vue application 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 have 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 components tree is the following:

Root
|___App
    |___Hello
        |___TotalValue

And I import the component like this:

  "total-value": TotalValue,

Why is this not working?

EDIT: this is the page where I test 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"] : [];
        },

    },
};

Upvotes: 5

Views: 848

Answers (1)

Alex Skorkin
Alex Skorkin

Reputation: 4274

Just a follow-up, we have fixed the issue described in this thread:

Support component loaded via vue-loader

Upvotes: 1

Related Questions