surgiie / dusk-cli
A cli for using Laravel Dusk (Chrome Driver).
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^8.1
- intonate/tinker-zero: ^1.2
- laravel-zero/framework: ^10.0
- nunomaduro/laravel-console-dusk: ^1.11
- pestphp/pest: ^1.21.3
- spatie/invade: ^2.0
- symfony/yaml: ^6.2
Requires (Dev)
- laravel/pint: ^1.2
- mockery/mockery: ^1.4.4
README
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.
Installation
- 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.
Usage
dusk visit https://google.com
Perform Actions
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.
Passing Arguments To Methods.
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');
Escaping Commas
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"
Screenshots
To take a screenshot, use the --screenshot
option:
dusk visit https://example.com --screenshot="/home/your-user/example.png"