【发布时间】:2020-12-15 19:53:05
【问题描述】:
我正在尝试检查我们在哪个浏览器上运行测试,然后根据结果跳过测试/夹具(如 TestCafe Issue 中所述)。
import { t } from 'testcafe';
fixture `test`
.page('https://testcafe.devexpress.com')
if (t.browser.name.includes('Chrome')) {
test('is Chrome?', async () => {
console.log(t.browser.name);
await t.expect(t.browser.name.includes('Chrome').ok();
});
} else {
test.skip('is Chrome?')
};
结果...
ERROR Cannot prepare tests due to an error.
Cannot implicitly resolve the test run in the context of which the test controller action should be executed. Use test function's 't' argument instead.
有什么方法可以在测试之外调用 testObject (t)?
【问题讨论】:
标签: testing automation automated-tests e2e-testing testcafe