Patb Patb - 7 days ago 6
PHP Question

PHPUnit Selenium integration for Laravel 5.2+

Before Laravel's 5.2 release, Laracasts' integrated package was providing Selenium integration for Laravel. I couldn't find any similar package for the 5.2 release. Is there any? How can I integrate selenium testing with Laravel?

I've seen these links, they do not provide any solutions:

Selenium and Laravel 5.2

Has anyone tried Laravel Integrated package in Laravel 5.2?

Answer

PHPUnit itself has a selenium extension. It's not quite laravelish, and is not backed by a modern WebDriver interface.

CodeCeption is a very powerful, yet easy-to-use testing tool for PHP. Not only does it provide a unit-testing API, it also provides its own selenium acceptance testing API.

It also has perfect Laravel integration and a great chrome extension for generating acceptance test in browser. Here's an example code from the docs:

<?php
$I->amOnPage('/login');
$I->fillField('username', 'davert');
$I->fillField('password', 'qwerty');
$I->click('LOGIN');
$I->see('Welcome to codeception!');

Here's a step-by-step guide to getting started with acceptance testing using CodeCeption:
http://codeception.com/11-20-2013/webdriver-tests-with-codeception.html

Here are some other options:
https://github.com/lmc-eu/steward
https://github.com/Modelizer/Selenium
https://github.com/jhoopes/laravel-selenium-driver

Comments