Ember.js 辛烷值验收测试

问题描述 投票:0回答:1

我不明白为什么 fillIn 找不到“data-test-code-nav-selector”。

我已暂停测试并使用开发工具复制了此 DOM 摘录。它按预期显示。正如您所看到的,select 标签具有预期的属性。

<select label="codingDropdown" class="h-full bg-gray-50 rounded shadow border py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" data-test-code-nav-selector="">
    <option value="PDF_I10_PCS_APPENDICES">ICD-10 PCS Appendices</option>
    <option value="PDF_I10_PCS_REFERENCE_MANUAL">ICD-10-PCS Reference Manual</option>
</select>

然后,在 test.js 文件中,我使用相同的属性调用 fillIn。

await this.pauseTest();
fillIn('data-test-code-nav-selector', 'PDF_I10_PCS_REFERENCE_MANUAL');

但是测试服务器指出:

global failure: Error: Element not found when calling `fillIn('data-test-code-nav-selector')`.@ 10974 ms
Source:     
Error: Element not found when calling `fillIn('data-test-code-nav-selector')`.

Ember.js 论坛指出:在 stackoverflow 上提问。

javascript testing ember.js acceptance octane
1个回答
0
投票

我想你想要:

await fillIn('[data-test-code-nav-selector]', 'PDF_I10_PCS_REFERENCE_MANUAL');

注意属性周围的方括号——使用与 CSS 选择器相同的语法。

© www.soinside.com 2019 - 2024. All rights reserved.