-
Notifications
You must be signed in to change notification settings - Fork 18
Home
Nikhil edited this page Feb 4, 2019
·
2 revisions
A Sample PHP-Laravel app to run selenium automation tests on LambdaTest grid.
- Install php and composer on your system. Setup Instructions for the same can be found here
# setup project dependencies
composer install
composer dump-autoload
- Create
.env
from example filecp .env.example .env
- Replace
LT_USERNAME
with your LambdaTest username. It can be obtained from LambdaTest dashbaord - Replace
LT_ACCESS_KEY
with your access key. It can be generated from LambdaTest dashbaord - Update platform configuration in driver method of
tests/DuskTestCase.php
, to specify the target where tests should run. (List of supported OS platfrom, Browser, resolutions can be found at LambdaTest capability generator) Sample configurationreturn RemoteWebDriver::create($url, DesiredCapabilities::chrome() ->setCapability("platform", "win10") ->setCapability("browserName", "chrome") ->setCapability("version", "71.0") ->setCapability("resolution", "1024x768") ->setCapability("build", "LaravelDusk Build") ->setCapability("name", "LaravelDusk Test") ->setCapability("network", true) ->setCapability("video", true) ->setCapability("visual", true) ->setCapability("console", true) ->setCapability("tunnel", false) );
-
Set tunnel value to
true
in test capabilities (found in driver method oftests/DuskTestCase.php
).e.g:
return RemoteWebDriver::create($url, DesiredCapabilities::chrome() ->setCapability("platform", "win10") ->setCapability("browserName", "chrome") ->setCapability("version", "71.0") ->setCapability("resolution", "1024x768") ->setCapability("build", "LaravelDusk Build") ->setCapability("name", "LaravelDusk Test") ->setCapability("network", true) ->setCapability("video", true) ->setCapability("visual", true) ->setCapability("console", true) ->setCapability("tunnel", true) );
OS specific instructions to download and setup tunnel binary can be found at the following links.
php artisan dusk
- Change directory to project root
cd /your/project
- Execute
php artisan dusk:make {test case name}
e.g:php artisan dusk:make TodoTest
Our sample test case can be found in tests/Browser/TodoTest.php
file. It navigates to our sample to-do app.