Symfony(4.4) Panther Test case doesn't work on GitlabCI

386 views Asked by At

I use Panther Tests Case and PHPUnit on my symfony project for functional testing. When I run my tests on my computer (php bin/phpunit), everything works fine. When i'm connected on my server and I run my tests, everything works fine.Chrome-driver is correctly installed on th server and i can run it with command lines. BUT, when i push on gitlab and my CI starts, i always have the same error : That is a screenshot from gitlab interface enter image description here

My script begins with a connection to my server using SSH.So the beahviour should be the same as when i connect to my server using Putty and SSH... The command i use on my .gitlab.ci script is 'php bin/phpunit'. The same that i use locally.

I've found some posts speaking about this problem but all on Selenium and nothing for panther... Please help ! :)

1

There are 1 answers

0
Yannick On

don't know if the problem is still existing, but I've been struggling with the same issue since yesterday and I fixed it by evenutally reading the doc ;-) : https://github.com/symfony/panther#chrome-specific-environment-variables

Due the Chrome's sandboxing, there is the need to specify a specific ENV variable to ensure the correct running in a container.

I update my .gitlacb-ci.yml with this on my test step:

before_script:
  - ... {HERE : ensure your chromedriver is existing in the container}
  - export PANTHER_NO_SANDBOX=1 

So... lesson learned/remembered : 5 min of doc reading is worth 2 days of google searching... ;-)