magic-test/magic-test-laravel

Does not play nice with Inertia test assertions

daronspence opened this issue · 3 comments

I might have this setup incorrectly (which is a separate issue) but I did find this problem.

When using Inertia, there are some included test helpers, assertInertia being one, that when the magic test middleware is enabled, will cause these tests to fail. I haven't dug into why, but I assume it has to do with the extra stuff that the middleware adds to a response. Removing the middleware fixes it.

As a side note, the documentation could be clearer around where the package should be installed/enabled. If it's a dev dependency, then adding a middleware seems like the wrong approach (since it will break in prod?) (also sorry for double dipping on twitter! I found this issue afterwards)

@daronspence dude, sorry about the delay, but I'm looking into this now haha. I'll give you an update

@daronspence the middleware thing has been corrected on v0.16. Thanks for reporting!

I figured out what's causing the Inertia issue (it is Magic Test's scripts), but I haven't been able to figure out a solution yet. I'll keep you posted...

@daronspence I couldn't figure out a way to automatically disable MT on integration tests, but I added an option to manually disable it. See: https://github.com/magic-test/magic-test-laravel#known-issues

You can add it to your main test case setUp method and then only test cases running Dusk will have Magic Test active.