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 :
How do I get the Chrome Wed Driver to launch and run the test?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also looking for a pipeline for dusk, may have to move to other CI applications.
Anyone have a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do we still have to try with this solution or is there a better version now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.