Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,742
Community Members
 
Community Events
176
Community Groups

Running Laravel Dusk in BitBucket Pipelines

I am trying to setup a Laravel 5.4 project in BitBucket Pipelines, with Laravel Dusk test scripts. However, I can't seem to get a successful build. After fixing several issues and finally getting my build to run my test scripts, I am not stuck at :

Screen Shot 2017-08-09 at 5.00.04 PM.png

 

How do I get the Chrome Wed Driver to launch and run the test?

3 answers

1 accepted

0 votes
Answer accepted

There are a couple of issue to address. I faced the same but finally got it working.

The main issue are the chrome drivers and the options to use to fire chrome.

The linux driver is a binary, so it may not be compatible with all the distros. And chrome has to be run in headless mode without gpu.

 

Have a look at the documentation of this docker image:

https://hub.docker.com/r/angelomaragna/networld-dusk/

I built it from Alpine, and with it (395MB unfortunately) I can finally run dusk tests in pipelines.

 

Angelo

Hi @Angelo Maragna, I tried to create a new container for testing using the container link you gave but it was returning me the following error:

Unable to find image 'networld-dusk:latest' locally
docker: Error response from daemon: repository networld-dusk not found: does not exist or no pull access.

So instead, I tried by using the steps described in the link with my existing container that is set up with php7-fpm and is still unable to get my test to run successfully.

Error in my documentation. "networld-dusk" is available on my local becasue I compiled it.

Please use "angelomaragna/networld-dusk" like in

docker run --privileged --name dusk -ti angelomaragna/networld-dusk /bin/sh

This is my bitbucket-pipelines.yml file (you can check that file also inside the docker container)

image: angelomaragna/networld-dusk

pipelines:
  default:
    - step:
        script:
          - rm vendor/laravel/dusk/bin/chromedriver-linux
          # Laravel Dusk driver is not compatible so we replace it with the Alpine one
          - ln -s /usr/lib/chromium/chromedriver vendor/laravel/dusk/bin/chromedriver-linux
          - vendor/laravel/dusk/bin/chromedriver-linux &
          - cp .env.example .env
          - php artisan dusk 

Hi @Angelo Maragna

I finally had the time to give this another try and after many rounds of trial and error, I finally got my first successful build!

Using your image and bitbucket-pipelines.yml as a guide, I had to install a few additional packages in order for things to fully work. Here's the final version of my bitbucket-pipelines.yml file:

image: angelomaragna/networld-dusk

pipelines:
  branches:
    develop:
    - step:
        caches:
            - composer
        script:
          - apk update && apk add php7-xmlwriter php7-pdo_mysql php7-session php7-ctype
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - cp .env.example .env
          - composer install
          - rm vendor/laravel/dusk/bin/chromedriver-linux
          # Replace Laravel Dusk driver Alpine's
          - ln -s /usr/lib/chromium/chromedriver vendor/laravel/dusk/bin/chromedriver-linux
          - vendor/laravel/dusk/bin/chromedriver-linux &
          - export DB_CONNECTION=mysql
          - php artisan key:generate
          - php artisan migrate
          - php artisan dusk
          - vendor/bin/phpunit
services:
          - mysq

Thanks for the help!

Thanks for posting this. I tried to get it going but ran into some issues. For anyone else who's following along you'll need to change the apk repository from edge to v3.7

FROM angelomaragna/networld-dusk:latest
RUN echo http://dl-cdn.alpinelinux.org/alpine/v3.7/main > /etc/apk/repositories &&\
echo http://dl-cdn.alpinelinux.org/alpine/v3.7/community >> /etc/apk/repositories &&\
apk update &&\
apk add php7-xmlwriter php7-pdo_mysql php7-session php7-ctype php7-fileinfo &&\
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

Also looking for a pipeline for dusk, may have to move to other CI applications.

Anyone have a solution?

Do we still have to try with this solution or is there a better version now?

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events