2017 © Pedro Peláez
 

library selenium

Selenium Package for laravel 5.

image

modelizer/selenium

Selenium Package for laravel 5.

  • Thursday, May 10, 2018
  • by modelizer
  • Repository
  • 8 Watchers
  • 75 Stars
  • 20,557 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 26 Forks
  • 2 Open issues
  • 35 Versions
  • 17 % Grown

The README.md

Laravel 5.x Testing for Selenium made easy.

Code Climate StyleCI Latest Stable Version Total Downloads License , (*1)

Key Points:

  1. You don't need to download anything except this package.
  2. This package download the selenium standalone server v3.11.0 by default and chrome driver will be downloaded based on operating system.
  3. Fluit API based on Browser Testing Kit
  4. Has a minimum configuration option and many things are pulled from the Laravel default configuration.
Version Package Version
Laravel 5.6 2.0
Laravel 5.* 1.0
PHP 7.1 2.0

Requirements:

  1. Java should be installed on local machine.
  2. You should have at least basic understanding of PHPUnit.

Installation guide:

Installing with Laravel Package Manager then you can install it by running given command and Manager will take care to register selenium service provider., (*2)

php artisan add modelizer/selenium

Or you can do it by composer., (*3)

composer require modelizer/selenium "~2.0"

Register service provider in app.php, (*4)

Modelizer\Selenium\SeleniumServiceProvider::class

Working with environment variables: You need to create sperate file testing.env in root directory to load testing specific variable. example, (*5)

APP_URL=http://testing.dev:8000

Don't forget to clear laravel configuration cache file., (*6)

php artisan config:clear

We are done! Lets start the selenium server., (*7)

php artisan selenium:start

Create first test:

Via an Artisan command, (*8)

php php artisan selenium:make:test SeleniumExampleTest, (*9)

Manually, (*10)

  1. Create a dummy SeleniumExampleTest.php file in tests directory.
  2. Add this code to SeleniumExampleTest.php file and run phpunit vendor/bin/phpunit tests/SeleniumExampleTest.php
<?php

namespace Tests;

use Modelizer\Selenium\SeleniumTestCase;

class SeleniumExampleTest extends SeleniumTestCase
{
    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        // This is a sample code you can change as per your current scenario
        $this->visit('/')
             ->see('Laravel')
             ->hold(3);
    }

    /**
     * A basic submission test example.
     *
     * @return void
     */
    public function testLoginFormExample()
    {
        $loginInput = [
            'username' => 'dummy-name',
            'password' => 'dummy-password'
        ];

        // Login form test case scenario
        $this->visit('/login')
             ->submitForm('#login-form', $loginInput)
             ->see('Welcome');  // Expected Result
    }
}

Run the test cases

vendor/bin/steward run staging chrome

This package is been build on top of Steward for running test case with specific arguments you can check out Steward's Wiki, (*11)

For full documentation you can checkout our API wiki. Which internally inherit facebook Web Driver so you can liverage full functionality of these dependency packages., (*12)

Notes:

  1. Selenium 3.11.0 and ChromeDriver 2.35 is been used.
  2. Feel free to contribute or create an issue.
  3. The user will not be able to swap between PHPUnit and Selenium who are below Laravel 5.3.
  4. We made changelog as release board and wiki.
  5. If a virtual machine is being used such as VirtualBox (Vagrant, Homestead), a framebuffer is needed:, (*13)

    # install xvfb if needed:
    sudo apt-get install xvfb
    
    # run Xvfb
    sudo nohup Xvfb :10 -ac
    
    # Set DISPLAY environment variable
    export DISPLAY=:10
    

Roadmap:

  1. ~~Firefox support added.~~ (Note: Only work when user has installed firefox locally)
  2. ~~Windows and Linux support needs to be added.~~
  3. ~~Drivers files should get downloaded as per user-specific operating system.~~
  4. Add more support for more API.
  5. Support for multiple browser.
  6. Behat integration if possible (research)
  7. Support for 3rd party services such as saucelab.

Summary:

Many APIs such as see, wait, submitForm etc are been implemented in Laravel 5.3, and the whole goal of this package is to make it easier for the user to swap testing type anytime. Eg: If a user wants to test by selenium then he only need to extend Modelizer\Selenium\SeleniumTestCase in his test case or if he wants to do PHPUnit testing then he will be able to do it by extending TestCase which Laravel 5.3 provide by default. This will help the user to test a case in many different testing types without doing any changes with API., (*14)

, (*15)

Contribution:

  1. If you like this package you can give it a star.
  2. Help to keep readme up to date with some functionality which exist in this package but not visible to other.
  3. Feel free to create PR or Issues or suggestion which can help this package to grow. Just do it. You are welcome :)

, (*16)

Credits

Contributors Twitter Ask for Help Site
Mohammed Mudassir (Creator) @md_mudasir hello@mudasir.me http://mudasir.me

The Versions

10/05 2018

dev-master

9999999-dev

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir
by Mohammed Mudassir

08/04 2018

dev-bug/travis-fix

dev-bug/travis-fix

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudassir

07/04 2018

v2.0.1

2.0.1.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudassir

04/04 2018

v2.0

2.0.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudassir

02/04 2018

v1.2.4

1.2.4.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

02/04 2018

v1.2.3

1.2.3.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

01/01 2017

1.0.x-dev

1.0.9999999.9999999-dev

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

01/01 2017

v1.2.2

1.2.2.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

30/12 2016

v1.2.1

1.2.1.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

02/12 2016

v1.2.0

1.2.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

16/11 2016

v1.1.0

1.1.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

25/10 2016

dev-sauce-lab-integration

dev-sauce-lab-integration

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

15/10 2016

v1.0.1

1.0.1.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

14/10 2016

v1.0

1.0.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by John Hoopes
by Mohammed Mudasir

12/10 2016

0.2.x-dev

0.2.9999999.9999999-dev

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

12/10 2016

v0.2.8

0.2.8.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

23/09 2016

v0.2.7

0.2.7.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

19/09 2016

0.2.6

0.2.6.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

19/09 2016

v0.2.5

0.2.5.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

19/09 2016

v0.2.4

0.2.4.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

18/09 2016

v0.2.3

0.2.3.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

13/09 2016

v0.2.2

0.2.2.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

13/09 2016

v0.2.1

0.2.1.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

13/09 2016

v0.2

0.2.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by John Hoopes
by Mohammed Mudasir

10/09 2016

0.1.x-dev

0.1.9999999.9999999-dev

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

10/09 2016

v0.1.8

0.1.8.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

09/09 2016

v0.1.7

0.1.7.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

08/09 2016

dev-analysis-XNdvAG

dev-analysis-XNdvAG

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

08/09 2016

v0.1.6

0.1.6.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

07/09 2016

v0.1.5

0.1.5.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

07/09 2016

v0.1.4

0.1.4.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

07/09 2016

v0.1.3

0.1.3.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

04/09 2016

v0.1.2

0.1.2.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

04/09 2016

v0.1.1

0.1.1.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir

04/09 2016

v0.1

0.1.0.0

Selenium Package for laravel 5.

  Sources   Download

MIT

The Requires

 

by Mohammed Mudasir