Does anyone know how to test vuetify v-select with laravel dusk?
I've tried $browser->select('size', 'Large');
without success
this is one of the v-selects that i want to test
<v-flex class="form__item">
<v-select
id="estatus"
dusk="estatus"
v-model="form.id_estatus"
label="Estatus"
:items="estatus"
item-text="nombre"
item-value="id"
v-validate="{ required:true }"
data-vv-name="estatus"
data-vv-as="estatus"
:error-messages="(errors.collect('estatus'))"
required
></v-select>
</v-flex>
And this the generated HTML
When v-select is clicked, shows the option list in other part of the HTML
Click on the
.v-select
element and wait for the select to open up:Then you can select an option by index:
Or by text (using XPath):
(1) In the Vue template:
Wrap the
<v-select>
with a<div id="selectStatus"></div>
(2) In the Dusk test, use:
— OR —
The
<v-select>
can be tested without wrapping it in a<div id="foo"></div>
if we use a slightly more complicated strategy.Instead of putting the
id
on adiv
wrapper, we can put theid
directly on thev-select
or even rely on text content contained within thev-select
with the following strategy (involvingxpath
):Using
Vuetify 1.5.14
.Click on the v-select element for it to list the options, then wait for the dropdown-menu class to be present before selecting an element from the list (2 in the example below) by clicking on the third tag in the menu list. Finally, wait until the dropdown-menu class disappears before moving onto the next part of the test.