I need help writting test with Laravel Dusk. I'm using Vue with ElementUI. I really like this framework, however, I can't use Dusk's build-in select()
method in my tests.
It's because the select component of ElementUI does not generate a real <select>
tag, instead, it creates a normal <input>
(that is readonly) and, at bottom of the page, the popper with select's options, so, there is not a <select>
tag in my page, only a <div>
and a readonly <input>
.
How can I write a test with Dusk that lets me click on a 'div'??
If I try to type on that input with something like this:
// $browser->select('my_select_id'); not working,
$browser->type('my_select_id', 1);
It throws me an Exception:
Facebook\WebDriver\Exception\InvalidElementStateException: invalid element state: Element must be user-editable in order to clear it.
So I don't know how to test ElementUI's selects :(
Please help,
Thx!
Edit
Posting html generated by ElementUI:
<div class="el-select w-100 el-select--mini" value="0" title="Cliente" dusk="v-select-component">
<div class="el-input el-input--mini el-input--suffix">
<input autocomplete="off" placeholder="Cliente" size="mini" name="client_id" id="client_id" readonly="readonly" type="text" rows="2" class="el-input__inner">
<span class="el-input__suffix">
<span class="el-input__suffix-inner">
<i class="el-select__caret el-input__icon el-icon-arrow-up"></i>
</span>
</span>
</div>
<div class="el-select-dropdown el-popper" style="display: none; min-width: 512.344px;">
<div class="el-scrollbar" style="">
<div class="el-select-dropdown__wrap el-scrollbar__wrap" style="margin-bottom: -17px; margin-right: -17px;">
<ul class="el-scrollbar__view el-select-dropdown__list" style="position: relative;">
<li class="el-select-dropdown__item selected"><span>Item 1</span></li>
<li class="el-select-dropdown__item"><span>Item 2</span></li>
</ul>
</div>
<div class="el-scrollbar__bar is-horizontal">
<div class="el-scrollbar__thumb" style="transform: translateX(0%);"></div>
</div>
<div class="el-scrollbar__bar is-vertical">
<div class="el-scrollbar__thumb" style="transform: translateY(0%);"></div>
</div>
</div>
</div>
</div>
Edit 2:
I added a simple JSFiddle with ElementUI's select example. I simply want to test that select with Laravel Dusk