change selected option of v-select using vue-test-util

EFOE picture EFOE · Jun 22, 2018 · Viewed 10.1k times · Source

I'm trying to test a component builded with vuetify. For that I'm using vue-test-utils. My goal is to perform a change in the v-select field, and assert hat a mutation is performed. here is my code:

<div id="app">
  <v-app id="inspire">
    <v-container fluid>
      <v-layout row wrap>
        <v-flex xs6>
          <v-subheader>Standard</v-subheader>
        </v-flex>
        <v-flex xs6>
          <v-select
            :items="items"
            v-model="e1"
            label="Select"
            single-line
          ></v-select>
        </v-flex>
      </v-layout>
    </v-container>
  </v-app>
</div>

The first test is ok when i set the data:

componentWrapper.setData({items: storesList})
expect(componentWrapper.vm.$data.items).toHaveLength(2)

I now want to change the selected value I try:

componentWrapper.findAll('#option').at(1).setSelected()

And also

componentWrapper.find('el-select')

Can someone help me to retrieve the select and then change the selected value? Thanks for your support.