How to find element and select by cypress.io with vue.js v-select?

Viewed 8609

Sorry,I need help about find element v-select and select option by cypress.io.

<v-select
      label="label"
      v-model="ccRcode"
      ref="ccRcode"
      :items="getData"
      item-text="descWithCode"
      item-value="code"
      value="{ ccRcode }"
      data-test='test'
></v-select>
2 Answers

Assuming the item you want to select has the text "My Option", you can do:

cy.get("[data-test=test]").parent().click()
cy.get(".v-menu__content").contains("My Option").click()

The first line opens the dropdown, and the second selects the item.

Try:

cy.get('[data-test=test]').type('valueNameGoesHere{enter}', {force: true})
Related