nmfzone/laravel-behat-dusk

Seamlessly integrate Behat with Laravel Dusk

v1.4 2019-11-23 12:27 UTC

This package is auto-updated.

Last update: 2024-04-29 04:27:00 UTC


README

Laravel Behat Dusk

Build Status Total Downloads Latest Stable Version License

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).

  1. Run this command php artisan behat-dusk:install
  2. Duplicate your .env to .env.behat (optional). This will be the environment used by behat.
  3. Adjust behat.yml as you wish
  4. To run the test, run this command php artisan behat (it's just wrapper of the original behat command. It's automatically run php artisan serve for you, and stop it when test is done 🔥)
  5. Enjoy!

Troubleshooting

  1. 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.