nunomaduro / laravel-console-dusk
Laravel Console Dusk 允许在 Laravel/Laravel Zero 的 artisan 命令中使用 Laravel Dusk。
v1.13.0
2024-04-18 15:46 UTC
Requires
- php: ^8.2
- illuminate/console: ^11.4
- illuminate/support: ^11.4
- laravel/dusk: ^8.2
- nunomaduro/laravel-console-task: ^1.9
Requires (Dev)
- laravel/pint: ^1.15.1
Suggests
- phpunit/phpunit: Required to perform browser test assertions.
README
关于 Laravel Console Dusk
Laravel Console Dusk 由 Nuno Maduro 创建并维护,允许在 Laravel/Laravel Zero artisan 命令中使用 Laravel Dusk。
安装
需要 PHP 8.2+
使用 Composer 安装 Laravel Console Dusk
composer require nunomaduro/laravel-console-dusk
该包提供了一个配置文件,允许您配置一些选项。
return [ /* |-------------------------------------------------------------------------- | Laravel Console Dusk Paths |-------------------------------------------------------------------------- | | Here you may configure the name of screenshots and logs directory as you wish. */ 'paths' => [ 'screenshots' => storage_path('laravel-console-dusk/screenshots'), 'log' => storage_path('laravel-console-dusk/log'), ], /* | -------------------------------------------------------------------------- | Headless Mode | -------------------------------------------------------------------------- | | When false it will show a Chrome window while running. Within production | it will be forced to run in headless mode. */ 'headless' => true, /* | -------------------------------------------------------------------------- | Driver Configuration | -------------------------------------------------------------------------- | | Here you may pass options to the browser driver being automated. | | A list of available Chromium command line switches is available at | https://peter.sh/experiments/chromium-command-line-switches/ */ 'driver' => [ 'chrome' => [ 'options' => [ '--disable-gpu', ], ], ], ];
您可以使用以下 artisan 命令发布配置文件
php artisan vendor:publish --provider="NunoMaduro\LaravelConsoleDusk\LaravelConsoleDuskServiceProvider" --tag="config"
用法
class VisitLaravelZeroCommand extends Command { /** * Execute the console command. * * @return void */ public function handle() { $this->browse(function ($browser) { $browser->visit('http://laravel-zero.com') ->assertSee('100% Open Source'); }); } }
在此处检查如何使用 Laravel Dusk。
贡献
感谢您考虑为 Laravel Console Dusk 贡献。所有的贡献指南都提及 此处。
您可以通过查看 变更日志 获取持续更新和有关更改的详细信息。您也可以关注推特账号以获取最新公告或只是打个招呼!:@enunomaduro
支持开发
您喜欢这个项目吗?通过捐赠来支持它
许可证
Laravel Console Dusk 是一个开源软件,许可协议为 MIT 许可证。