刚刚开始接受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! [email protected] test: `testcafe chrome ./test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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');
});
package.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"
}
}
好吧,我知道我做错了。
包json中'test'的正确语法。我应该已经运行了文件夹名称并删除了'./'
“ test”:“ testcafe chrome TestSpec”
在实际测试中,测试用例中有一个错字。我写的文字错误。它应该是这样的:
等待t.typeText('#developer-name','mary')
运行此代码,效果很好