为了账号安全,请及时绑定邮箱和手机立即绑定

使用 jest 断言时,匹配器函数应返回以下格式的对象

使用 jest 断言时,匹配器函数应返回以下格式的对象

收到一只叮咚 2022-10-21 14:34:03
当我使用 wdio 和 mocha 作为测试框架对多个浏览器运行测试时,我得到以下错误,如果它只针对一个浏览器运行,相同的断言工作正常describe ('Landing Page test suite',()=> {    before(()=>{        browser.url('/')    })    it ('1. Page should be loaded proeprly',()=>{        p.header.waitForDisplayed()            expect(p.header).toBeVisible()    })})Unexpected return from a matcher function.Matcher functions should return an object in the following format:  {message?: string | function, pass: boolean}'[{"message": [Function message], "pass": false}, {"message": [Function message], "pass": false}]' was returned这是代码示例 https://github.com/Amrkamel1/wdExample.git运行: npm 我 npm 运行测试
查看完整描述

1 回答

?
潇潇雨雨

TA贡献1833条经验 获得超4个赞

"toBeVisible" 是一个 Jest 匹配器,不能与 WebdriverIO 一起使用。请使用正确的匹配器:https ://webdriver.io/docs/api/expect.html#tobedisplayed


查看完整回答
反对 回复 2022-10-21
  • 1 回答
  • 0 关注
  • 65 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信