Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
175 views
in Technique[技术] by (71.8m points)

How to arrange docker-compose files based on the test suite, website, environment and device type

To connect to DB, I had to move to docker setup. Now all my webdriverio tests executes in docker container with Saucelabs.

My tests executes based on some environment variables: portal type, environment, device, browser, etc.

I would like to create different docker-compose files for desktop, tab and mobile which will help me to run as per the req.

File for tablet execution: (Like below, I have 2 more for desktop and mobile)

version: '3.3'
services:
    wdio:
      image: wdio-tab-image
      container_name: wdio-tab
      build: .
      environment:
        - PORTAL=${PORTAL}
        - ENV=${ENV}
        - BATCH_NAME="${PORTAL} - Regression Test Tab"
        - PLATFORM=Tab
        - EYES=${EYES}
        - SUITE=regression::tab
        - DEVICE=${DEVICE}
      volumes:
          - .:/opt/node/portal/
          - /opt/node/portal/node_modules
      ports:
          - '6060:6060'
      #restart: always

Dockerfile:

FROM node:12

RUN apt-get update && apt-get install -y 
  apt-utils 
  ssh 
  ksh 
  zip 
  git 
  unzip 
  unixodbc 
  unixodbc-dev 
  zlib1g-dev 
  libzip-dev 
  curl
# Change the working directory
WORKDIR /opt/code/app

# Install app dependencies
COPY package.json ./
RUN npm install

# Copy code to working directory
COPY . .

# Execute tests
ENTRYPOINT ["sh", "-c", "npm run $SUITE" ]

Command using to execute: docker-compose -f docker-compose.tab.yml up --build When I run tab compose file with different portal env at a time, first one stops execution and second is throwing some test error.

I nee help in how to arrange the compose files as per below requirements:

  • My framework is mono repo which contains automation for 5 portals
  • I would like to setup docker files in a way that it differentiates the files based on platform - desktop, tab and mobile. These files should be capable to run even in parallel in all portals.

Any help would be appreciated.

question from:https://stackoverflow.com/questions/65652007/how-to-arrange-docker-compose-files-based-on-the-test-suite-website-environmen

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...