【问题标题】:TestCafe oncePerFixture Error when runningTestCafe oncePerFixture 运行时出错
【发布时间】:2021-09-14 15:10:06
【问题描述】:

我尝试在 TestCafe 中使用 oncePerFixture 功能并收到错误:

“TypeError:无法读取未定义的属性“testRun”。

我不知道是什么问题?

【问题讨论】:

  • 我的代码:从'../../Commons/API/AdminEventPortalApiUtils'导入EventAPI;从“testcafe-once-hook”导入 { oncePerFixture }; const cleanDB = oncePerFixture(async t => { if (!TcUtils.isProduction()) { await EventAPI.deleteQaTestEvents(); } });夹具Clubs - Club Home Page ... .afterEach(async t => { if (!TcUtils.isProduction()) { cleanDB(); } });
  • From Page Model async deleteQaTestEvents() { if (TcUtils.isProduction()) { throw Error('ERROR: ClubApiUtil should not be used in production.'); } 让结果 = 等待 this.findEventByTag('qatestevent'); for(let i = 0 ; i

标签: testing automation automated-tests e2e-testing testcafe


【解决方案1】:

我想问题在于您忘记将t 参数传递给afterEach 挂钩内的cleanDB 函数调用。如果这没有帮助,请分享您的完整示例,因为没有您的完整代码很难确定问题的原因。

【讨论】:

    猜你喜欢
    • 2019-10-03
    • 2019-11-02
    • 2021-05-26
    • 1970-01-01
    • 2022-06-11
    • 2019-08-25
    • 1970-01-01
    • 2020-02-22
    • 2020-06-17
    相关资源
    最近更新 更多