nmfzone / laravel-behat-dusk
Seamlessly integrate Behat with Laravel Dusk
Installs: 2 241
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 3
Open Issues: 0
Requires
- php: >=7.1.0
- behat/behat: ^3.5
- laravel/dusk: ^5.6
Requires (Dev)
- phpunit/phpunit: ^8.0
README
Laravel Behat Dusk
Introduction
Seamlessly integrate Behat with Laravel Dusk.
Requirements
- PHP >= 7.1
Installation
$ composer require nmfzone/laravel-behat-dusk
If you want to change the default config, you must publish the config file:
$ php artisan vendor:publish --provider="Nmflabs\LaravelBehatDusk\ServiceProvider"
Usage
I assume you're using this package for the first time you setup behat (so there is no behat.yml, etc).
- Run this command
php artisan behat-dusk:install
- Duplicate your
.env
to.env.behat
(optional). This will be the environment used by behat. - Adjust
behat.yml
as you wish - To run the test, run this command
php artisan behat
(it's just wrapper of the original behat command. It's automatically runphp artisan serve
for you, and stop it when test is done 🔥) - Enjoy!
Troubleshooting
-
Element is not clickable at (x, y)
If you're experiencing this issue, there is a high possibility that you're clicking an element that outside the viewport.
What does it means? It means your element isn't appears on your screen (maybe your element located in very bottom of the page), when the browser trying to click that element. So, of course it's impossible to click that element.
In the real usage, you're just scrolling the browser to bottom, until you see your element, right? Then, it's just the same here. You need to tell the browser, to scroll the browser to bottom, until it found the element.
public function selectCheckbox($selector) { $this->browse(function (Browser $browser) use ($selector) { $browser->scrollTo('#foo-element')->check($selector); }); }
Security
If you discover any security related issues, please email to 123.nabil.dev@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.