A php command line interface for Laravel Dusk using the chrome driver.
Note - This is a work in progress and is not ready for production use.
- Install Chrome:
- Install CLI:
composer global require surgiie/dusk-cli
- Install Driver:
dusk install:chrome-driver
Note: If using wsl2 on windows, you need to install chrome in the linux subsystem.
dusk visit https://google.com
All methods in the Laravel Dusk API are performed by passing the method name as a kebab case command option.
For example, to call the assertSee
method, you would use the --assert-see
option:
dusk visit https://laravel.com --assert-see="Laravel"
Note - Please note that all actions have NOT been tested thoroughly so please report any issues you find.
When passing options to call methods that accept more than one argument, you can pass arguments to the methods by separating them with a comma.
For example, when using the --assert-query-string-has
option:
dusk visit https://example.com --assert-query-string-has="q,pizza"
This will call the assertQueryStringHas
method with the arguments q
and pizza
as follows:
$browser->assertQueryStringHas('q', 'pizza');
If you dont want to the cli to mistake a literal comma delimited string as function arguments, use the \
character on each comma in the string to escape it:
# will be interpreted as single argument of "foo,bar,baz"
dusk visit https://example.com --assert-see="foo\,bar\,baz"
To take a screenshot, use the --screenshot
option:
dusk visit https://example.com --screenshot="/home/your-user/example.png"