How to properly setup selenium web tests (python) running in docker on bitbucket pipeline?

elena_skorodilo December 20, 2023

I am trying to setup selenium web tests (python, headless mode) running in docker on bitbucket pipeline and get errors that I can't fix. 

One of them is

docker: Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories. None of the solutions or workarounds found worked and I am not sure should I try to solve it or maybe my approach is wrong in general.

I wonder is there any detailed working up-to-date guide that could help me figure out how to properly set it up. What should my yml file and dockerfile look like, should I download and unzip chromedriver file? or should I stick to 

selenium/standalone-chrome? There's lots of guides how to do it locally, but not many how to perform this on a bitbucket pipline :( would be greatful for any help

ymlfile.png

 

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 21, 2023

Hello @elena_skorodilo and welcome to the Community!

The error you reported was because in the example you shared you are trying to mount the directory /dev/shm inside the container you starting with docker run. In pipelines, you can only mount directories from the build container to another container if the directory is under the $BITBUCKET_CLONE_DIR path.

So if the dev/shm is a folder in your repository, the mounting would be as follows: 

docker run -d -p 4444:4444 -v $BITBUCKET_CLONE_DIR/dev/shm:/dev/shm selenium/standalone-chrome

This would mount the files contained in $BITBUCKET_CLONE_DIR/dev/shm directory in the build container,  inside the /dev/shm directory of the container you are spinning up.

However, I found the following article with instructions on how to set-up the selenium tests using Bitbucket Services instead, which may be of help : 

Although it's not Python-specific, it provides good information on how to define the service in the pipeline,  the port mapping and the selenium configuration.

Hope that helps!

Thank you, @elena_skorodilo !

Patrik S

elena_skorodilo December 21, 2023

@Patrik S, your answer is EXTREMELY HELPFUL, with help of your explanation and provided article I managed to run my first test on a bitbucket pipeline which is a huge progress. Thanks a lot.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 22, 2023

You're very welcome @elena_skorodilo ! Happy to have been of some assistance :) 

Feel free to reach out to the community if you ever need help!

Thank you,

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events