【发布时间】:2020-09-18 22:25:31
【问题描述】:
我正在学习 TestCafe,我是新手。
我正在尝试关注这里提到的:https://devexpress.github.io/testcafe/documentation/recipes/access-environment-variables-in-tests.html
我有一个可以在我的 Windows 机器上运行的代码!!
fixture`Getting Started`.page`http://devexpress.github.io/testcafe/example`;
test("My First Test", async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button')
.takeScreenshot();
const articleHeader = await Selector('.result-content').find('h1');
// Obtain the text of the article header
let headerText = await articleHeader.innerText;
console.log(process.env.DEV_MODE);
});
我的脚本部分是这样的
"scripts": {
"setnode": "set DEV_MODE=staging",
"test:chrome": "npm run setnode & npx testcafe \"chrome --start-fullscreen\" e2e/tests"
}
当我运行这个命令时npm run test:chrome
我得到这样的输出
ui-testcafe-poc@1.0.0 setnode C:\TestCafeProjects\ui-testcafe-poc set DEV_MODE=staging
Running tests in:
- Chrome 79.0.3945.130 / Windows 10
Getting Started
undefined
√ My First Test
为什么 console.log 写为未定义而不是暂存?
【问题讨论】:
标签: node.js typescript npm testcafe ui-testing