@yanminibaev

Laravel Dusk не работает, как решить эту проблему?

Здравствуйте, хотел я использовать тесты от Laravel Dusk.
Использую laravel на windows с программой OpenServer (OS)
Использую домен laravel.loc порт 80

При написании команды: php artisan dusk
Выводит данную ошибку:
Yan@DESKTOP-EJ5PAHD c:\OSPanel\domains\laravel.loc
$ php artisan dusk
Warning: TTY mode is not supported on Windows platform.
PHPUnit 7.2.7 by Sebastian Bergmann and contributors.

RE                                                                  2 / 2 (100%)

Time: 910 ms, Memory: 12.00MB

There was 1 error:

1) Tests\Browser\LoginTest::testExample
TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in C:\OSPanel\domains\laravel.loc\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php on line 127

C:\OSPanel\domains\laravel.loc\vendor\facebook\webdriver\lib\Remote\DesiredCapabilities.php:33
C:\OSPanel\domains\laravel.loc\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:127
C:\OSPanel\domains\laravel.loc\tests\DuskTestCase.php:39
C:\OSPanel\domains\laravel.loc\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:189
C:\OSPanel\domains\laravel.loc\vendor\laravel\framework\src\Illuminate\Support\helpers.php:768
C:\OSPanel\domains\laravel.loc\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:190
C:\OSPanel\domains\laravel.loc\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:92
C:\OSPanel\domains\laravel.loc\vendor\laravel\dusk\src\Concerns\ProvidesBrowser.php:64
C:\OSPanel\domains\laravel.loc\tests\Browser\LoginTest.php:20

--

There was 1 risky test:

1) Tests\Browser\ExampleTest::testBasicExample
This test did not perform any assertions

ERRORS!
Tests: 2, Assertions: 0, Errors: 1, Risky: 1.


Устанавливал таким образом:
composer require --dev laravel/dusk
php artisan dusk:install


LoginTest.php
public function testExample()
{
    $this->browse(function (Browser $browser) {
        $browser->visit('/');
    });
}


.env (не полное)
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:GkMxzBxZNlLvj5Vpt01B+bW6ax9xgHD8ibx0IoiPyKY=
APP_DEBUG=true
APP_URL=http://laravel.loc:80


DuskCaseTest.php
<?php

namespace Tests;

use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;

abstract class DuskTestCase extends BaseTestCase
{
    use CreatesApplication;

    /**
     * Prepare for Dusk test execution.
     *
     * @beforeClass
     * @return void
     */
    public static function prepare()
    {
        static::startChromeDriver();
    }

    /**
     * Create the RemoteWebDriver instance.
     *
     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
     */
    protected function driver()
    {
        $options = (new ChromeOptions)->addArguments([
            '--disable-gpu',
            '--headless'
        ]);

        return RemoteWebDriver::create(
            'http://laravel.loc:80', DesiredCapabilities::chrome()->setCapability(
                ChromeOptions::CAPABILITY, $options
            )
        );
    }
}
  • Вопрос задан
  • 701 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы