Testcafe Vue选择器无法获取Vue组件

时间:2017-06-16 09:30:04

标签: javascript vue.js testcafe

我使用Testcafe Vue选择器在我的Vue应用程序上执行e2e测试,但看起来我无法抓取任何组件:

1) An error occurred in getVue code:

      TypeError: Cannot read property '__vue__' of undefined

这是我创建的示例测试:

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)
});

我的组件树的结构如下:

Root
|___App
    |___Hello
        |___TotalValue

我导入这样的组件:

  "total-value": TotalValue,

为什么这不起作用?

编辑:这是我测试组件的页面

<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"] : [];
        },

    },
};

1 个答案:

答案 0 :(得分:0)

仅作后续操作,我们已修复此线程中描述的问题:

Support component loaded via vue-loader