Jak*_*Sip 3 testing automated-tests web-testing e2e-testing 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)
我做错了什么?预先感谢您的帮助。
我已经使用最新版本 1.1.4 的 TestCafe 执行了您的测试用例,并且通过了:
\n\n\n\n这是我的完整测试用例和基于您的代码片段的测试文件:
\n\nimport { Selector} from \'testcafe\';\n\nfixture(\'fixture\')\n .page(\'file:///Temp/56074194.html\');\n\nconst x = Selector(\'.FilterCockpit--header--count\').withText(\'64\');\n\ntest(\'x\', async t => {\n\n await t\n .expect((x).exists).ok()\n});\nRun Code Online (Sandbox Code Playgroud)\n\n56074194.html\xc2\xa0
\n\n<div class="FilterCockpit--header--results">\n <span class="FilterCockpit--header--count">\n 64\n </span>\n Results\n </div>\nRun Code Online (Sandbox Code Playgroud)\n\n也许,有些情况可能会破坏测试执行。如果我需要执行任何其他步骤,请告诉我。
\n\n另请参阅:检查元素是否存在
\n| 归档时间: |
|
| 查看次数: |
4460 次 |
| 最近记录: |