在@vue/cli 4.0.5 应用程序中使用 cypress 我遇到了如何填充 vue-select 组件的问题
在网上搜索我发现这个 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 test 中添加一行:
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",
有没有有效的方法?
谢谢!