Laravel Dusk and Select2

Asked

Viewed 29 times

0

I am working with Laravel 8 and for the screen tests I am using the Dusk (https://laravel.com/docs/8.x/dusk).

On one of the screens I have a Select2 with the property "tags" enabled (https://select2.org/tagging), that is, it allows creating a new record if there is no option in select.

I am unable to perform this type of test: Create new option for Select2 with Dusk.

I tried to use this package (https://github.com/roquie/laravel-dusk-select2) and also use scripts by Dusk (https://laravel.com/docs/8.x/dusk#executing-javascript) to achieve this result, but in none of the cases have I succeeded.

Blade

<select 
    class="select2" 
    name="nome" 
    required
>
    <option value="1">Teste 1</option>
    <option value="2">Teste 2</option>
</select>

Js

$('.select2').select2({ 
    tags: true,
});

I understand it’s something very specific, I hope someone can help me.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.