【发布时间】:2019-04-10 15:50:17
【问题描述】:
我有一个场景,根据之前的条件,结果可能是“这个”或“那个”。
例如,如果我希望 .contains 断言查找 foo 或 bar,我将如何编写期望?
await t.expect('foo bar').contains('bar')
【问题讨论】:
-
您可以使用
await t.expect('foo bar').contains('bar')代码检查字符串的“包含”条件。如果您想检查其他数据类型(例如 DOM 节点)的“包含”条件,那么最好选择不同的方式。您能否提供有关您的方案的更多详细信息? -
我有一个场景,当用户点击提交按钮时,结果可能是“A”或“B”。
-
你可以在断言中使用正则表达式devexpress.github.io/testcafe/documentation/test-api/assertions/…
await t.expect('foo').match(/foo|bar/);
标签: automated-tests e2e-testing assertion web-testing testcafe