Laravel 5.4 HTTP testing - method seeInElement

2019-07-23 20:59发布

问题:

In Laravel 5.3 there was a seeInElement method which would check the text inside an element based on a CSS selector.

https://laravel.com/api/5.3/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.html#method_seeInElement

In 5.4 this has been moved to Laravel Dusk.

I still use the HTTP Tests with 5.4 ( https://laravel.com/docs/5.4/http-tests ) because they're faster for the testing I want to do, but it's now missing this method.

Is there a way to get this back?

回答1:

You need the laravel/browser-kit-testing package. See the upgrade guide here: https://laravel.com/docs/5.4/upgrade#testing