2 years ago

Has any got Dusk to work with Bitbucket Pipelines?

Posted 2 years ago by greatwitenorth

I've been trying to get Laravel Dusk working correctly with Bitbucket pipelines. Here's what my current configuration files looks like:

image: mightycode/docker-laravel-dusk

    - step:
          - composer
          - /usr/bin/chromium --version
          - cp .env.dusk.local .env
          - composer install --no-interaction
          - npm install
          - npm run production
          - Xvfb :0 -screen 0 1280x960x24 &
          - export DISPLAY=:0
          - touch database/testing.sqlite
          - php artisan serve &
          - php artisan dusk
          - vendor/bin/phpunit

Once it reaches the /usr/bin/chromium command I see the following error and the system hangs:

[419:435:0922/] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Xlib:  extension "RANDR" missing on display ":0".
[419:448:0922/] Failed to adjust OOM score of renderer with pid 472: Permission denied
(chromium:419): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory)
[419:448:0922/] Failed to adjust OOM score of renderer with pid 478: Permission denied
[419:448:0922/] Failed to adjust OOM score of renderer with pid 502: Permission denied
[419:448:0922/] Failed to adjust OOM score of renderer with pid 520: Permission denied

I think the above error is causing the next error I see since Dusk cannot connect to chromium (since it failed to start):

1) Tests\Browser\PickupFormTest::testExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"\/usr\/bin\/chromium","args":["--window-size=1280x960","--disable-gpu"]}}}
Failed to connect to localhost port 9515: Connection refused

When I run the config file locally using Convey everything works fine. It's just once I push it up to bitbucket it fails.

Also heres the slightly modified contents of my DuskTestCase.php file:


namespace Tests;

use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Symfony\Component\Process\ProcessBuilder;

abstract class DuskTestCase extends BaseTestCase
    use CreatesApplication;

     * Prepare for Dusk test execution.
     * @beforeClass
     * @return void
    public static function prepare()

     * Create the RemoteWebDriver instance.
     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
    protected function driver()
        $desiredCapabilities = DesiredCapabilities::chrome();

        $options = new ChromeOptions();



        $desiredCapabilities->setCapability(ChromeOptions::CAPABILITY, $options);

        return RemoteWebDriver::create(
            'http://localhost:9515', $desiredCapabilities

Anyone have any ideas on how to get Dusk working with Bitbucket Pipelines?

Please sign in or create an account to participate in this conversation.