3
votes

I'm trying to use laravel dusk to test for 404 not found error. Specifically when loading an image. After reading the laravel dusk documentation I've found no asserts that could help me test if a 404 exception occurs.

Is there a good way of getting a browser test to know whether a resource has failed loading or is it simply not possible?

2
have you tried assertNotFound()? - pseudoanime
I don't think assertNotFound is part of laravel dusk - Jamie Woods
Just checked now and it says it's an undefined method - Jamie Woods
Sorry, I meant you can use it's part of the illuminate Foundation testing package, so you can do something like $this->get("url")->assertNotFound(); in your phpunit tests - pseudoanime

2 Answers

-1
votes

You can use browser -> driver -> manage() -> getLog('browser') to get the log and see if there is a 404 Error