In Pipelines I can install a Drupal site successfully and from within its container I can access it at http://localhost:80. I am executing Behat tests and non-@javascript scenarios are working (via goutte) but @javascript scenarios are failing (via selenium2). I get the following error when running a @javascript scenario:
unknown error: net::ERR_CONNECTION_REFUSED
(Session info: chrome=89.0.4389.82)
(Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}),platform=Linux 5.4.92-flatcar x86_64) (WebDriver\Exception\UnknownError)
I'm wondering if it's possible to connect to the Selenium service from within the container?
In a build step, I run:
docker exec -i app bash -c "echo \"$BITBUCKET_DOCKER_HOST_INTERNAL host.docker.internal\" >> /etc/hosts"
This allows me to access the mysql service at host.docker.internal:3306 from within the container.
I assume the same should work for the Selenium service, making it accessible at host.docker.internal:4444 from within the container but the error above is output.
Here is part of my bitbucket-pipelines.yml file to help provide some more context:
pipelines:
default:
- step:
script:
- docker build -t my-ci .
- docker run -dit --name app -p 8080:80 my-ci
- sleep 5
- docker ps
- docker exec -i app bash -c "echo \"$BITBUCKET_DOCKER_HOST_INTERNAL host.docker.internal\" >> /etc/hosts && /var/www/vendor/drush/drush/drush si --db-url=mysql://drupal:drupal@host.docker.internal:3306/drupal -vvv"
- docker exec -i app bash -c "curl http://localhost:80/user/login"
- docker exec -i app bash -c "cd /var/www/tests/behat && composer install && bin/behat"
services:
- docker
- mysql
- google-chrome
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'drupal'
MYSQL_USER: 'drupal'
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_PASSWORD: 'drupal'
google-chrome:
image: selenium/standalone-chrome
After a lot of trial and error I realized the mapping of 8080:80 was causing issues. Instead I mapped 80:80 and I can now successfully run my Behat @javascript tests.
Hey, thanks for posting here i am sharing the most popular trending online certification course that will advance your career. Learn oracle Certifiaction Training
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, thanks for posting here i am sharing the most popular trending online certification course that will advance your career. Learn oracle Certifiaction Training and enroll now to get!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.