laravel / dusk

Laravel Dusk provides simple end-to-end testing and browser automation.
https://laravel.com/docs/dusk
MIT License
1.88k stars 323 forks source link

Vue.js form inputs blank after being typed #372

Closed gilbitron closed 6 years ago

gilbitron commented 7 years ago

I'm using Laravel Spark and writing a Dusk test for the register form. The billing address is being filled by the test in the following standard way (using class selectors):

$browser->select('.form-country', 'US')
        ->type('.form-address', '44 Shirley Ave.')
        ->type('.form-city', 'Chicago')
        ->type('.form-state', 'IL')
        ->type('.form-zip', '60185');

However, some inputs (e.g. city/state) were being blanked after being filled by the Dusk test resulting in a failed test. The inputs in question have the Vue.js "lazy" modifier applied:

<input type="text" class="form-control form-city" v-model.lazy="registerForm.city">

For some reason, it looks like this is borking in Dusk.

dmitryuk commented 6 years ago

First you should waitForElement (VueJS ready)

gilbitron commented 6 years ago

@xakzona I tried that. I also tried a regular wait. The only thing that worked was removing the "lazy" modifier.

ghost commented 6 years ago

i put

->waitUntil('app.__vue__._isMounted')

i find this on google, but don't work

what is your solution for waitForElement with vue.js ?

ghost commented 6 years ago

i solved the problem by adding # to my id

->value('#titre','blablabla')
ghost commented 6 years ago

i solved my problem but the next expression :

->press('My button')

with vue.js code in blade, ignore my

->value('#titre','blablabla')

(no warning or error)

driesvints commented 6 years ago

Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.