相关疑难解决方法(0)

Testcafe - 在测试用例外测试命令行参数

当我熟悉Testcafe时,我正在尝试使用命令行参数为用户提供有关如何运行测试的更多信息.出于这个原因,我正在使用该minimist包.

但是,我不能打印或使用测试用例之外的任何变量.请在下面找到我的代码.

import { Selector } from 'testcafe';
import minimist from 'minimist';

const args = minimist(process.argv.slice(2));
const env = args.env;

console.log('*** A SAMPLE CONSOLE OUTPUT ***'); // does not print

fixture `Getting Started`
  .page `http://devexpress.github.io/testcafe/example`;

test('My first test', async t => {
  console.log('*** ANOTHER SAMPLE CONSOLE OUTPUT ***'); // prints
  await t
    .typeText('#developer-name', 'John Smith')
    .wait(1000)
    .click('#submit-button')

    // Use the assertion to check if the actual header text is equal to the expected one
    .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!'); …
Run Code Online (Sandbox Code Playgroud)

javascript automated-tests e2e-testing testcafe

5
推荐指数
1
解决办法
514
查看次数