在@vue/cli 4.0.5应用程序中使用cypress时,我遇到了一个如何填充vue-select组件的问题
在net中搜索,我找到了这个How to find element and select by cypress.io with vue.js v-select?分支,但这里提出的方法不起作用。
使用组件查找:
<v-select
v-model="selection_parent_id"
label="label"
:options="categoriesLabels"
id="parent_id"
name="parent_id"
class="form-control admin_control_input editable_field"
placeholder="Select option"
data-cy='select-input'
></v-select>我试着在cypress测试中添加一行:
cy.get('[data-cy=select-input]').select('1')并得到错误:
CypressError: cy.select() can only be called on a <select>. Your subject is a: <div dir="auto" class="v-select form-control admin_control_input editable_field vs--single vs--searchable" id="parent_id" name="parent_id" data-cy="select-input">...</div>
"vue": "^2.6.10",
"vue-select": "^3.2.0",
"@vue/cli-plugin-e2e-cypress": "~4.2.0",
"@vue/cli-plugin-router": "^4.0.0",
"@vue/cli-plugin-vuex": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"bootstrap": "^4.3.1",
"faker": "^4.1.0",
"jquery": "^3.4.1",有没有有效的方法?
谢谢!
发布于 2020-04-06 18:58:57
我发现发送了key down / enter键的决策:
cy.get('#parent_id').click().type('{downarrow}{enter}')这对我很有效!
https://stackoverflow.com/questions/60964774
复制相似问题