SR1*_*SR1 2 javascript automated-tests reactjs e2e-testing testcafe
无法在反应组件“要搜索的类型”下拉列表中键入文本。我可以单击该组件,但无法在其中键入任何文本。下面是示例代码。
import { Selector } from 'testcafe';
test('Select option', async t => {
const dropdown = Selector('.section')
.find('.Select.is-clearable.is-searchable.Select--multi')
.find('.Select-control')
.find('.Select-placeholder')
.withText('Select...');
await t.click(dropdown);
await t.typeText(dropdown, 'abc'); // unable to pass text 'abc'
await t.wait(3000);
});
Run Code Online (Sandbox Code Playgroud)
使用类似组件的示例站点http://jedwatson.github.io/react-select/
const dropdown = Selector('.section')
.find('.Select.is-clearable.is-searchable.Select--multi')
.find('.Select-control')
.find('.Select-placeholder')
.withText('Select...');
const inputField = dropdown
.sibling('.Select-input')
.find('input');
await t
// wait until element is visible on the screen
.expect(dropdown.with({visibilityCheck: true}).exists).ok({timeout: 5000})
// access the element via the mouse (will fire the mouse event onMouseEnter)
.hover(dropdown)
.click(dropdown)
.typeText(inputField, 'abc');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
141 次 |
| 最近记录: |