Coder Social home page Coder Social logo

Larvel Dusk tests about inertia-laravel HOT 9 CLOSED

inertiajs avatar inertiajs commented on July 19, 2024
Larvel Dusk tests

from inertia-laravel.

Comments (9)

sinnbeck avatar sinnbeck commented on July 19, 2024 4

Haven't tested yet, but you might be able to listen for nprogress to disappear

$browser->waitUntilMissing('#nprogress');

from inertia-laravel.

sinnbeck avatar sinnbeck commented on July 19, 2024 1

Started implementing dusk in my current project and I am also running into issues. I am using a custom .env.dusk.local file with the proper settings. It works for the initial page load, but when geting things from usePage(), it seems that dusk is loading the original .env file instead of the new one. I can simply dump my database.default value to the screen (In react), and check the "failed" screenshot

I am unsure if this is a problem with dusk or inertia

Edit: Silly me. I had forgotten that artisan serve caches my .env files! :/ Changed to homestead and it works πŸ‘

from inertia-laravel.

georgehanson avatar georgehanson commented on July 19, 2024

Laravel Dusk has a feature to wait until an element is visible by passing a query selector. For example:

$browser->waitFor('.button');

You can view the documentation here for more examples - https://laravel.com/docs/5.8/dusk#waiting-for-elements

from inertia-laravel.

stefro avatar stefro commented on July 19, 2024

hi @georgehanson. Thanks for your reply!
Yes I was already aware of that. I can try to find an element for each test case to wait for, but I'm actually curious if there is a generic element to wait for. Like the same element in each test. This would make everything much easier.

Since I'm sure I'm not the only one who uses Dusk, I interested to find out how other Inertia users handle this.

from inertia-laravel.

stefro avatar stefro commented on July 19, 2024

Thanks @sinnbeck !
I've tried it and it works!

from inertia-laravel.

stefro avatar stefro commented on July 19, 2024

Thanks for the edit @sinnbeck .
Good to hear you've figured it out.

from inertia-laravel.

claudiodekker avatar claudiodekker commented on July 19, 2024

Looks like this issue's been solved! πŸ‘

Another solution (I think?) could be to wait for first element inside the inertia-rendered element. Since Vue replaces the whole node tree that it gets mounted on (#app, by default in Inertia), it's presence would indicate that your app is ready.

In either case, I'll close this issue for now, but if you feel like it still wasn't answered properly, feel free to re-open the issue at any point by continuing the conversation.

Thanks!

from inertia-laravel.

xyNNN avatar xyNNN commented on July 19, 2024

I want to recommend some package here which helps a lot testing Inertia.js with Laravel Dusk

https://github.com/protonemedia/inertiajs-events-laravel-dusk

from inertia-laravel.

riabiy-denis avatar riabiy-denis commented on July 19, 2024

I want to recommend some package here which helps a lot testing Inertia.js with Laravel Dusk

https://github.com/protonemedia/inertiajs-events-laravel-dusk

We wrote almost same code, but a bit simpler. Great package. Confirm, that the idea behind that macro works.

from inertia-laravel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.