繁体   English   中英

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

[英]Testcafe Vue Selectors can't grab Vue component

我正在使用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"] : [];
        },

    },
};

只是一个后续行动,我们修复了此主题中描述的问题:

支持通过vue-loader加载的组件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM