小编Ara*_*yan的帖子

如何在 Cypress 中使用逻辑 OR 断言

我有这个代码

cy.get(element).should('contain.text', search_word || search_word.toLowerCase())
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

expected <div.games__element__title.card-title.h5> to contain text Hot, but the text was Ultimate hot
Run Code Online (Sandbox Code Playgroud)

如何使用 OR 运算符,以便我可以断言元素的文本包含以大写或小写字母书写的搜索词?

javascript assert mocha.js cypress

15
推荐指数
1
解决办法
1万
查看次数

标签 统计

assert ×1

cypress ×1

javascript ×1

mocha.js ×1