Typescript Testcafe:获取错误:无法隐式解析测试运行

Typescript Testcafe:获取错误:无法隐式解析测试运行,typescript,testing,automated-tests,e2e-testing,testcafe,Typescript,Testing,Automated Tests,E2e Testing,Testcafe,我在testcafe中编写脚本来解析响应并验证响应是否包含必需的文本,但得到一个错误:无法隐式解析测试运行,测试控制器操作应该在该上下文中执行。改用测试函数的“t”参数。 test ('Control server info', async () => { await t .click(infoserver.serverinfoButton) .click(infoserver.getInfoButton) await infoserver.re

我在testcafe中编写脚本来解析响应并验证响应是否包含必需的文本,但得到一个错误:无法隐式解析测试运行,测试控制器操作应该在该上下文中执行。改用测试函数的“t”参数。

test ('Control server info', async () => {

    await t
      .click(infoserver.serverinfoButton)
      .click(infoserver.getInfoButton)

    await infoserver.resultText.value.then( async (res) => {
        const infoParse = JSON.parse(res);
        console.log(infoParse);

    await t
    .expect(infoParse.username).contains('Google:cloudtester12345@gmail.com');

    });
});
试一试


在我使用Testcafe的短暂经验中,我发现这个错误经常是由于一些其他错误触发的,无论是在测试代码本身还是正在测试的应用程序中。
test ('Control server info', async t => {

//test code
});