0

Tests are written with python behave and executed with Docker. Locally on Mac/Windows/Linux all 110 test steps complete under 4 minutes using the same sites whereas on CI agent (AWS) it takes 120-160 mins. Video showed that browser is spinning for about 4 minutes between steps. Is there a way to debug selenium to find out what resource is loading slow?

Selenium DEBUG logging is not helpful. After submit it took 4 minutes for a POST request to complete:

04-Apr-2018 20:13:01    DEBUG:selenium.webdriver.remote.remote_connection:POST http://127.0.0.1:4444/wd/hub/session/a6975e2107e574693fb48f21420c1850/element {"using": "id", "value": "submit", "sessionId": "a6975e2107e574693fb48f21420c1850"}
04-Apr-2018 20:13:01    DEBUG:selenium.webdriver.remote.remote_connection:Finished Request
04-Apr-2018 20:13:01    DEBUG:selenium.webdriver.remote.remote_connection:POST http://127.0.0.1:4444/wd/hub/session/a6975e2107e574693fb48f21420c1850/element/0.7198908368495902-4/click {"id": "0.7198908368495902-4", "sessionId": "a6975e2107e574693fb48f21420c1850"}
04-Apr-2018 20:17:00    DEBUG:selenium.webdriver.remote.remote_connection:Finished Request

docker-compose.yml:

version: '3.4'

services:
  test:
    build:
      context: .
    image: qa-automation
    network_mode: host
    environment:
      LOCAL: "false"
      BROWSER: "${TEST_BROWSER:-chrome}"
      SERVER: "${TEST_URL:-https://example.com}"

  selenium:
    image: elgalu/selenium:3.11.0-p5
    shm_size: 2g 
    ports:
      - 4444:24444
      - 6000:25900
    environment:
      SCREEN_WIDTH: 1920
      SCREEN_HEIGHT: 1080
      TZ: "US/Central"
      VIDEO_FILE_NAME: "${TEST_BROWSER:-chrome}"
    volumes:
      - ./target/videos:/videos

Dockerfile:

FROM python:3.6.4-alpine3.7

# Install utilities
RUN apk --update --no-cache add bash curl git && rm -rf /var/cache/apk/*

ENV PYTHONUNBUFFERED 1
WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

# see .dockerignore
COPY . .

ENTRYPOINT ["bin/docker-entrypoint.sh"]
CMD ["behave"]

requirements.txt:

appdirs==1.4.3
behave==1.2.6
packaging==16.8
pyparsing==2.2.0
requests==2.13.0
selenium==3.11.0
six==1.11.0

test.sh:

#!/usr/bin/env bash
docker-compose up -d selenium
docker-compose exec selenium wait_all_done 30s
docker-compose exec selenium start-video
# run tests
docker-compose build test
docker-compose run test bash -c "behave"
ret_code=$?
echo "===== Auto Tests COMPLETED ====="
# clean up containers
docker-compose exec selenium stop-video
docker-compose exec selenium stop
docker-compose down
exit $ret_code
  • `Is there a way to debug selenium to find out what resource is loading slow?` well the official [selenium docker images](https://github.com/seleniumhq/docker-selenium) have debug images where you are able to VNC into the image while running. perhaps leo has his own mechanism – ddavison Apr 04 '18 at 19:33
  • Thanks for the hint - VNC debugging helped - There were some links to external services which were behind a firewall and not accessible to CI agent. That's why every call to them was timing out and decreasing page load time. – Edel WeizzX Apr 13 '18 at 16:47

0 Answers0