Home > PHP Framework > Laravel > body text

Detailed explanation of installing Laravel Dusk in laradock

藏色散人
Release: 2020-03-31 08:54:55
forward
2975 people have browsed it

Detailed explanation of installing Laravel Dusk in laradock

Introduction

Installing Laravel Dusk locally has always failed. After checking the documentation, I found that laradock is not the only Just need composer require, there are other configurations. Record it below.

Configuring laradock

1. Switch to the laradock directory and pause the workspace container first docker-compose sotp workspace

2. Modify the .env file WORKSPACE_INSTALL_LARAVEL_INSTALLER and WORKSPACE_INSTALL_DUSK_DEPS, change the configuration value to true

3. Rebuild the workspace container docker-compose build workspace

4. After success, start docker-compose up -d workspace

Install Laravel Dusk

1. Enter docker-compose exec workspace bash in the workspace container, and switch to the project directory

2. Use composer require - -dev laravel/dusk Install Laravel Dusk

3. Execute php artisan dusk:install

4. In the tests/DuskTestCase.php file, modify the driver method and add the --no-sandbox parameter , as follows

protected function driver()
{
    $options = (new ChromeOptions)->addArguments([
        '—disable-gpu',
        '—headless',
        '—window-size=1920,1080',
        '—no-sandbox',// 添加这行
    ]);
    return RemoteWebDriver::create(
        'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
            ChromeOptions::CAPABILITY, $options
        )
    );
}
Copy after login

1. Add a configuration file, cp .env .env.dusk.local, change APP_URL to http://localhost:8000

2. Execute php artisan serve — -quiet &

3. Finally, you can use Laravel Dusk to test php artisan dusk

Conclusion

In fact, there are many aliases in the workspace, but using , for ease of understanding, the original commands are used.

Recommended: laravel tutorial

The above is the detailed content of Detailed explanation of installing Laravel Dusk in laradock. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template