Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Whether or not we could run this tool in headless mode #315

Open
jeffjen opened this issue Apr 28, 2023 · 1 comment
Open

Whether or not we could run this tool in headless mode #315

jeffjen opened this issue Apr 28, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@jeffjen
Copy link

jeffjen commented Apr 28, 2023

Describe the problem

Whether or not we could run this tool in headless mode? How would we be able to integrate this application to a CI/CD system.

System:

  • OS: AWS Public AMI Ubuntu LTS
@jeffjen jeffjen added the help wanted Extra attention is needed label Apr 28, 2023
@f-delpoggio
Copy link

We use xvfb to run it in headless mode true on a docker container. You can look at this tutorial from puppeteer:

https://pptr.dev/guides/docker <- The docker file they use doesn't include the virtual frame buffer we need to run dappeteer on CI/CD.

We modify this docker file by adding xvfb and other things we need to run dappeteer in headless mode.

Here is our Dockerfile:

FROM node:16-slim

RUN apt-get update \
  && apt-get install -y wget gnupg \
  && 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 fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 xvfb xauth dbus dbus-x11 tightvncserver xfonts-base procps x11vnc python3 build-essential tini\
      --no-install-recommends \
  && groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
  && mkdir -p /home/pptruser \
  && chown -R pptruser:pptruser /home/pptruser \
  && rm -rf /var/lib/apt/lists/*

# RUN mkdir -p /home/pptruser
# RUN chown pptruser /home/pptruser
WORKDIR /home/pptruser


ADD package.json .
ADD yarn.lock .
RUN yarn install
WORKDIR /home/pptruser/node_modules/puppeteer
USER pptruser
RUN yarn run postinstall
WORKDIR /home/pptruser
ADD . .
USER root
RUN mkdir -p report
RUN chown -R pptruser /home/pptruser
USER pptruser

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/bin/xvfb-run", "yarn", "The name of your test case"]

To run it uses

 # 1)
 docker build -t { name } .
 # 2)
 docker run  --rm -it --init { name }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants