0

I write my bachelor thesis about E2E-Testing of a specific software for my university. I work with the Gauge-framework which includes Taiko. My tests are fine and working on my local machine.

But now I have to build a docker Container because my tests have to work autonomously regardless of which OS is in use (my mentor uses IoS and there are some problems if he just runs my code from GitLab).

And know the problem: I read a bit about docker and watched some tutorials how to use it. Therefore, I understand what is happening in the following code to some extent. The docker file is generated when I initialize a gauge project. There is antoher dockerfile example on the gauge hompage but that doesn´t work too (it is from 2018 and maybe outdated but not changed on the doc site).

`

# Building the image
#   docker build -t gauge-taiko .
# Running the image
#   docker run  --rm -it -v ${PWD}/reports:/gauge/reports gauge-taiko

# This image uses the official node base image.
FROM node
 
# The Taiko installation downloads and installs the chromium required to run the tests. 
# However, we need the chromium dependencies installed in the environment. These days, most 
# Dockerfiles just install chrome to get the dependencies.
RUN apt-get update \
     && apt-get install -y wget gnupg ca-certificates \
     && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
     && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
     && apt-get update \
     && apt-get install -y google-chrome-stable

 
# Set a custom npm install location so that Gauge, Taiko and dependencies can be 
# installed without root privileges
ENV NPM_CONFIG_PREFIX=/home/gauge/.npm-packages
ENV PATH=$PATH:/home/gauge/.npm-packages/bin

# ENV PATH=$PATH:/home/node/.npm-global/bin

# Add the Taiko browser arguments
ENV TAIKO_BROWSER_ARGS=--no-sandbox,--start-maximized,--disable-dev-shm-usage
ENV headless_chrome=true
ENV TAIKO_SKIP_DOCUMENTATION=true

# Uncomment the lines below to use chrome bundled with this image
#ENV TAIKO_SKIP_CHROMIUM_DOWNLOAD=true
#ENV TAIKO_BROWSER_PATH=/usr/bin/google-chrome
 
# Set working directory
WORKDIR /gauge
 
# Copy the local working folder
COPY . .

# Create an unprivileged user to run Taiko tests
RUN groupadd -r gauge && useradd -r -g gauge -G audio,video gauge && \
   mkdir -p /home/gauge/.npm-packages/lib && \
   chown -R gauge:gauge /home/gauge /gauge
 
USER gauge



# Install dependencies and plugins 
RUN npm install -g @getgauge/cli && \
    gauge install js && \
    gauge install html-report &&  \
    gauge install screenshot && \
    gauge config check_updates false

# Default command on running the image
ENTRYPOINT ["npm", "test"]

` and then the bulding process wont stop (see below):

=> [internal] load build definition from Dockerfile                                                                                                                                                                      0.2s 
 => => transferring dockerfile: 2.03kB                                                                                                                                                                                    0.0s 
 => [internal] load .dockerignore                                                                                                                                                                                         0.2s 
 => => transferring context: 34B                                                                                                                                                                                          0.0s 
 => [internal] load metadata for docker.io/library/node:latest                                                                                                                                                            0.6s 
 => [internal] load build context                                                                                                                                                                                         0.1s 
 => => transferring context: 1.44kB                                                                                                                                                                                       0.0s 
 => [1/6] FROM docker.io/library/node@sha256:d5222e1ebd7dd7e9683f47a8861a4711cb4407a4830cbe04a582ca4986245700                                                                                                             0.0s 
 => CACHED [2/6] RUN apt-get update      && apt-get install -y wget gnupg ca-certificates      && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -      && sh -c 'echo "deb [arch=amd6  0.0s 
 => CACHED [3/6] WORKDIR /gauge                                                                                                                                                                                           0.0s 
 => CACHED [4/6] COPY . .                                                                                                                                                                                                 0.0s 
 => CACHED [5/6] RUN groupadd -r gauge && useradd -r -g gauge -G audio,video gauge &&    mkdir -p /home/gauge/.npm-packages/lib &&    chown -R gauge:gauge /home/gauge /gauge                                             0.0s 
 => CANCELED [6/6] RUN npm install -g @getgauge/cli &&     gauge install js &&     gauge install html-report &&      gauge install screenshot &&     gauge config check_updates false                                    31.3s

It let it run for about 10 minutes but nothing happened and I cnaceled it by myself.

After some tests and research, I think the problem is this line

npm install -g @getgauge/cli &&

I changed the order of how the commands are executed (e.g. if I execute gauge install js first with a particlar RUN command it executes. Then it stops at the command line above again).

Then I ran antoher test and tried to install a specific version of Gauge with the npm install -g @getgauge/cli@Version command (in my test it was 1.1.1 because I have seen that in a GitHub example) and with that it worked. However, the current version is 1.4.4 and I use that version on my local machine and, therefore, want to use it within the Docker Container (plus there were some pretty usefull bugfixes in between these versions ...). Do you have any ideas how I can fix that problem or give me a hint about how to fix it or where to look up some information?

Tahnk you guys and have happy holidays!

Sousa
  • 1
  • 2

0 Answers0