Answer the question
In order to leave comments, you need to log in
Laravel Dusk not working, how to solve this problem?
Hello, I wanted to use tests from Laravel Dusk .
I use laravel on windows with OpenServer (OS) program
I use laravel.loc domain port 80
When I write the command: php artisan dusk
It gives this error:
[email protected] 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
public function testExample()
{
$this->browse(function (Browser $browser) {
$browser->visit('/');
});
}
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:GkMxzBxZNlLvj5Vpt01B+bW6ax9xgHD8ibx0IoiPyKY=
APP_DEBUG=true
APP_URL=http://laravel.loc:80
<?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
)
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question