小编Jak*_*Sip的帖子

如何在regex .match()断言中插入变量?

我想在正则表达式断言中添加一个变量“ example”。

const example = Selector('xyz');

await t.expect(getLocation()).match(/^https:\/\/int-.*.example.com\/en\/example\/-\/  ** HERE SHOULD BE INSERTED A VARIABLE, 'example' ** \/$/)
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

regex automated-tests web-testing e2e-testing testcafe

5
推荐指数
1
解决办法
106
查看次数

如何检查 Testcafe 中是否存在文本

我想检查我创建的页面上是否存在“64”。

const x = Selector('.FilterCockpit--header--count').withText('64');
Run Code Online (Sandbox Code Playgroud)

以下测试失败。

test('x', async t => {
    await t
    .expect((x).exists).ok()
    });
Run Code Online (Sandbox Code Playgroud)

HTML 代码:

<div class="FilterCockpit--header--results">
          <span class="FilterCockpit--header--count">
              64
         </span>
         Results
 </div>
Run Code Online (Sandbox Code Playgroud)

我做错了什么?预先感谢您的帮助。

testing automated-tests web-testing e2e-testing testcafe

3
推荐指数
1
解决办法
4460
查看次数