2017 © Pedro Peláez
 

library dusker

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

image

unglud/dusker

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  • Wednesday, June 20, 2018
  • by unglued
  • Repository
  • 3 Watchers
  • 16 Stars
  • 86 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 19 % Grown

The README.md

dusker

Stand-alone Laravel Dusk test suit, which does not require Laravel framework itself., (*1)

Build Status Total Downloads Latest Stable Version License, (*2)

, (*3)

Laravel Dusk provides an expressive, easy-to-use browser automation and testing API. By default, Dusk does not require you to install JDK or Selenium on your machine. Instead, Dusk uses a standalone Chrome driver. However, you are free to utilize any other Selenium driver you wish., (*4)

Installation

To get started, you should add the unglud/dusker Composer dependency to your project:, (*5)

composer require --dev unglud/dusker

Next, you need to copy all necessary files to your working directory. The command below will do it for you. It creates (or use existing) tests directory and put files there. Also, it copies artisan console utility to your project root directory. If you already have this file, it will be overwritten!, (*6)

The file .env.dusk will be in your project root as well, which you will need rename to .env or copy it content to your existing one., (*7)

composer run-script post-install-cmd -d ./vendor/unglud/dusker

If you would like these files to update automatically each time you update this package, you can add this to your composer.json file:, (*8)

"scripts": {
  "post-install-cmd": [
    "Dusker\\CopyFile::copy"
  ],
  "post-update-cmd": [
    "Dusker\\CopyFile::copy"
  ]
},
"extra": {
  "copy-file": {
    "vendor/unglud/dusker/src/example/": "tests/",
    "vendor/unglud/dusker/artisan": "artisan"
  }
}

As you notice file .env.dusk not included there to simplify things., (*9)

After installing the package, Artisan commands will be available from your root project. Run the dusk:install Artisan command:, (*10)

php artisan dusk:install

Now try to run test to make sure everything works, (*11)

php artisan dusk

How to use

After this part you can use official documentation for Dusk on the Laravel website, `cuz it will work exactly as it was designed by Taylor Otwell., (*12)

Authentication

Often, you will be testing pages that require authentication. You can use Dusk's loginAs method in order to avoid interacting with the login screen during every test. The loginAs method accepts a user login and password:, (*13)

$this->browse(function (Browser $browser) {
    $browser->loginAs('username', 'password')
          ->visit('/home');
});

After using the loginAs method, the user session will be maintained for all tests within the file., (*14)

Authentication Setup

Since we do not have access to native Auth and Router from Laravel, because we use it without Laravel we need to setup login functionality. In .env you should specify LOGIN_ENDPOINT -- path to your public directory where Dusker will copy the file which will be accessible from a browser. By default its http://example.com/_dusker/login.php. Second LOGIN_IMPLEMENTATION -- path to your class, which utilize logic of your project allowing Authentication. You can use /tests/LoginManagerExample.php as an example of how it should look., (*15)

License

Dusker is released under the MIT Licence. See the bundled LICENSE file for details., (*16)

The Versions

20/06 2018

dev-master

9999999-dev

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver

20/06 2018

dev-analysis-zERZ7M

dev-analysis-zERZ7M

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver

08/11 2017

v2.1.1

2.1.1.0

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver

08/11 2017

v2.1

2.1.0.0

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver

04/11 2017

v2.0.1

2.0.1.0

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver

04/11 2017

v2.0

2.0.0.0

Stand alone Laravel Dusk test suit, which do not require Laravel framework itself.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aleksandr Matrosov

laravel testing webdriver