【问题标题】:How to select a (Vue) v-select option with Cypress?如何使用赛普拉斯选择 (Vue) v-select 选项?
【发布时间】:2020-06-16 20:15:44
【问题描述】:

似乎它应该工作,但它没有。 有人知道在 v-select 上选择的技巧吗?

我的.vue

      <v-select 
        data-cy="exp_month"
        name="exp_month" 
        v-model="card.expiration.month" 
        :items="months" 
        label="exp month">
      </v-select>

myTest.js

  it('should select the first month', () => {
    cy.get("[data-cy=exp_month]").select("01")
  })

结果

CypressError: cy.select() can only be called on a <select>. Your subject is a: <input aria-label="exp month" data-cy="exp_month" name="exp_month" readonly="readonly" type="text" placeholder=" " autocomplete="on" aria-readonly="false">

【问题讨论】:

    标签: vue.js cypress e2e-testing


    【解决方案1】:

    试试这个:

    cy.get('[data-cy=exp_month]').type('01{enter}',{force:true});
    

    【讨论】:

      【解决方案2】:

      我猜 v-select 不是选择。

      我不知道这是否是正确的方法,但这是我最终做的。

      cy.get('[data-cy=exp_month]').click({force: true})
      cy.contains('div', '01').parent().parent('a').click()
      

      【讨论】:

        猜你喜欢
        • 2019-02-12
        • 2018-11-15
        • 1970-01-01
        • 1970-01-01
        • 2021-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多