【问题标题】:What's this error ERROR Cannot prepare tests due to an error. TypeError: Cannot read property 'Date' of undefined?这是什么错误 ERROR 由于出现错误无法准备测试。 TypeError:无法读取未定义的属性“日期”?
【发布时间】:2019-01-18 15:53:55
【问题描述】:

开始使用 TestCafe 编写基本测试。 目标打开一个网页并获取其标题。如下图:

fixture (`Init Tests`)
.page(${data.baseURL});

test('Check Initial pg', async t =>(){
       await t
        .expect(Selector("title").innerText).eql('XXXXXXX');
    });
}

【问题讨论】:

标签: javascript node.js automated-tests e2e-testing testcafe


【解决方案1】:

错误信息: ERROR Cannot prepare tests due to an error.

在 TestCafe 无法转译您的测试代码时发出。这意味着测试代码中存在语法错误。

您的代码应如下所示:

fixture ('Init Tests')
    .page('http://devexpress.github.io/testcafe/example/');

test('Check Initial pg', async (t) => { 
    await t.expect(Selector('title').innerText).eql('XXXXXXX'); 
});

【讨论】:

  • 该错误现在已替换为 testcafe 'path:/Applications/Google Chrome.app' /tests ERROR 没有要运行的测试。要么是测试文件不包含测试,要么是过滤器功能过于严格。
  • @Biju,TestCafe 命令行应该是testcafe chrome tests 而不是testcafe chrome /tests
  • 现已解决,工作正常。浏览器路径问题
猜你喜欢
  • 2021-11-07
  • 1970-01-01
  • 2021-11-17
  • 1970-01-01
  • 2019-12-24
  • 1970-01-01
  • 2016-05-17
  • 2017-05-05
相关资源
最近更新 更多