I tried to build some testing process for my app, using Bitbucket pipelines.
The core testing tool is Cypress. I want to set up several docker containers and execute Cypress to test my app.
So, my bitbucket-pipelines.yml
looks like this:
image: docker:stable
options: docker: truepipelines:
default:
- step:
name: Install PHP app
caches:
- composer
script:
- cp config/db.sample.php config/db.php
- sed -i "s/[HOSTNAME]/db/" config/db.php
- sed -i "s/[DB_NAME]/dbname/" config/db.php
- sed -i "s/[DB_USER]/usr/" config/db.php
- sed -i "s/[DB_USER_PASSWORD]/pass/" config/db.php
- cp web/index.sample.php web/index.php
- docker run --name db --restart always -e MYSQL_DATABASE=dbname -e MYSQL_USER=usr -e MYSQL_PASSWORD=pass -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d -p 3306:3306 mariadb
- docker run --name web -v="$BITBUCKET_CLONE_DIR:/app" -d -p 8000:80 yiisoftware/yii2-php:5.6-apache
- docker run --name e2e -v="$BITBUCKET_CLONE_DIR:/app" --workdir /app --tty -d cypress/base:10
- docker exec -i web composer install
- docker exec -i db mysql -uroot dbname < ./migrations/data/structure.sql
- docker exec -i e2e yarn install
- docker exec -i e2e yarn run cypress run --config baseUrl=http://web --project ./ services:
- docker
- web
definitions:
services:
db:
image: mariadb
web:
image: yiisoftware/yii2-php:5.6-apache
e2e:
image: cypress/base:10
Overall, it works almost good, but for some reason I can't get access to web
service inside e2e
container. I tried to use container name, like http://web
, but it doesn't work.
What is wrong here?
I'm not sure if I can help you with this one, but I'm curious about something.
How is Cypress resolving the address http://web?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.