1
votes

Laravel dusk issue

My VM site running on http://172.31.71.71:9090 and when I tried to run PHP artisan dusk

My code

    protected function driver()
{
    $options = (new ChromeOptions)->addArguments([
        '--disable-gpu',
        '--headless',
        '--window-size=1920,1080',
    ]);

    return RemoteWebDriver::create(
        'http://172.31.71.71:9090', DesiredCapabilities::chrome()->setCapability(
            ChromeOptions::CAPABILITY, $options
        )
    );
}

Getting error PHPUnit 7.5.14 by Sebastian Bergmann and contributors.

    E                                                                   1 / 1 (100%)

    Time: 99 ms, Memory: 16.00 MB

    There was 1 error:

    1) Tests\Browser\LoginTest::testLogin
    TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php on line 145

    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/facebook/webdriver/lib/Remote/DesiredCapabilities.php:33
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:145
    /var/www/marketplaceoffers.com/www/marketplaceoffers/tests/DuskTestCase.php:37
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/laravel/framework/src/Illuminate/Support/helpers.php:817
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:193
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
    /var/www/marketplaceoffers.com/www/marketplaceoffers/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
    /var/www/marketplaceoffers.com/www/marketplaceoffers/tests/Browser/LoginTest.php:21

    ERRORS!
    Tests: 1, Assertions: 0, Errors: 1.
    root@71e3381c1bc4:/var/www/marketplaceoffers.com/www/marketplaceoffers#
1
Can anyon please help on this prnt.sc/op2wlpSubrata Mallik

1 Answers

0
votes

change 'http://172.31.71.71:9090' to 'http://localhost:9515',

    return RemoteWebDriver::create(
        'http://localhost:9515',
        DesiredCapabilities::chrome()->setCapability(
            ChromeOptions::CAPABILITY,
            $options
        ),
    );