Skip to content

Commit

Permalink
e2e tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Oct 3, 2024
1 parent ee44ca7 commit bf2b204
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 200 deletions.
40 changes: 9 additions & 31 deletions test/test-e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
FROM node:20
FROM ghcr.io/puppeteer/puppeteer:23

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
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 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
# uncomment the following lines to have `dumb-init` as PID 1
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
# RUN chmod +x /usr/local/bin/dumb-init
# ENTRYPOINT ["dumb-init", "--"]

# Uncomment to skip the chromium download when installing puppeteer. If you do,
# you'll need to launch puppeteer with:
# browser.launch({executablePath: 'google-chrome-stable'})
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
USER root
RUN mkdir -p /home/test
RUN groupadd -r test && useradd -r -g test -G audio,video test \
&& chown -R test:test /home/test
RUN chown -R pptruser /home/test
WORKDIR /home/test
USER test
# Install Chrome for the root user: Codefresh runs the container as root
RUN npx puppeteer browsers install chrome

USER pptruser
COPY package.json .
COPY yarn.lock .
RUN yarn install --timeout 99999999

COPY --chown=pptruser . .
ENV APP_URL=https://github.com

# Run everything after as non-privileged user.


COPY --chown=test . .
USER test
CMD ["yarn", "test"]
10 changes: 10 additions & 0 deletions test/test-e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3"
services:
tests:
image: test-e2e
environment:
- APP_URL=https://samples.test-ch.dev.metacell.us
- [email protected]
- PASSWORD=test
volumes:
- ../../applications/samples/test/e2e:/home/test/__tests__/samples'
2 changes: 1 addition & 1 deletion test/test-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Filippo Ledda <[email protected]>",
"dependencies": {
"jest": "^28.1.0",
"puppeteer": "22.14.0",
"puppeteer": "^23.0.0",
"ts-jest": "^28.0.2",
"typescript": "^4.6.4"
},
Expand Down
Loading

0 comments on commit bf2b204

Please sign in to comment.