У меня проблемка, приложение запущено в докере, тесты тоже запускаю в докере.
Тесты и webdriver запускаются в docker-compose.
Сама проблема: [ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running.
Dockerfile:
FROM php:7.1-cli
# Install required system packages
RUN apt-get update && \
apt-get -y install \
git \
zlib1g-dev \
libssl-dev \
wget \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install php extensions
RUN docker-php-ext-install \
bcmath \
zip
# Install pecl extensions
RUN pecl install \
mongodb \
xdebug-2.6.0beta1 && \
docker-php-ext-enable \
mongodb.so \
xdebug
# Configure php
RUN echo "date.timezone = UTC" >> /usr/local/etc/php/php.ini
# Install composer
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -sS https://getcomposer.org/installer | php -- \
--filename=composer \
--install-dir=/usr/local/bin
RUN composer global require --optimize-autoloader \
"hirak/prestissimo"
# Prepare host-volume working directory
RUN mkdir /project
WORKDIR /project
# Install vendor
COPY ./composer.json /project/composer.json
RUN composer install --prefer-dist --optimize-autoloader
docker-compose.yml
version: '2'
services:
codecept:
depends_on:
- chrome
build:
context: ./
volumes:
- ./tests:/project/tests
- ./codeception.yml:/project/codeception.yml
restart: 'no'
networks:
- default
- proxy
environment:
- SCP_GUI_URL=http://scp_gui_nginx
entrypoint:
- ./vendor/bin/codecept
# - run
chrome:
image: selenium/standalone-chrome
ports:
- '4444'
- '5900'
networks:
- default
- proxy
networks:
default:
driver: bridge
proxy:
external:
name: traefik_webgateway
codeception.yml
# suite config
suites:
acceptance:
actor: AcceptanceTester
path: .
modules:
enabled:
- WebDriver:
url: '%SCP_GUI_URL%'
browser: chrome
port: 4444
window_size: maximize
- \Helper\Acceptance
- Asserts
extensions:
enabled:
- Codeception\Extension\RunFailed
- Codeception\Extension\Teststatistics
- Codeception\Extension\Logger
params:
- env
gherkin: []
# additional paths
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
shuffle: false
lint: true