繁体   English   中英

无法运行我的 testcafe 测试。 代码和包 Json 看起来正确

[英]Can't run my testcafe Test. Code and Package Json Look correct

刚刚开始在 TestCafe 上接受新工作的培训。

出于某种原因,我不断收到以下错误,但我不知道为什么

ERROR The specified glob pattern does not match any file or the default test directories are empty.

Type "testcafe -h" for help.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testcafe_training@1.0.0 test: `testcafe chrome ./test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testcafe_training@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xx.xxx/.npm/_logs/2020-01-17T15_15_38_725Z-debug.log
xxx.xx@LPGxxx TestCafe_Training % 

这是代码和 package.json。

代码:

Fixture`Getting started with Testcafe`
    .page`https://devexpress.github.io/testcafe/example/`;

Test('My first testcafe test', async t => {
    //Enter you testcase here
    await t.typetext('#developer-name', 'mary');
    await t.click('#submit-button');
});

包.json:

{
  "name": "testcafe_training",
  "version": "1.0.0",
  "description": "This is training",
  "main": "TestCafeTrain.js",
  "scripts": {
    "test": "testcafe chrome ./test"
  },
  "keywords": [
    "TestCafe",
    "Automation",
    "Testing"
  ],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "testcafe": "^1.7.1"
  }
}

好的,我知道我做错了什么。

  1. 包 json 中“test”的正确语法。 我应该运行文件夹名称并删除'./'

    "test": "testcafe chrome TestSpec"

  2. 在实际测试中,测试用例中有一个错字。 我写错了字体。 它应该是这样的:

    等待 t.typeText('#developer-name','mary')

运行这段代码,它完美地工作

暂无
暂无

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

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