Skip to content

Commit 1d2d186

Browse files
Copilotkobenguyent
andcommitted
Changes before error encountered
Co-authored-by: kobenguyent <[email protected]>
1 parent 760df04 commit 1d2d186

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
2727
COPY . /codecept
2828

2929
RUN chown -R pptruser:pptruser /codecept
30-
RUN runuser -l pptruser -c 'npm i --loglevel=warn --prefix /codecept'
30+
# Set environment variables to skip browser downloads during npm install
31+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
32+
ENV PUPPETEER_SKIP_DOWNLOAD=true
33+
# Install as root to ensure proper bin links are created
34+
RUN cd /codecept && npm install --loglevel=warn
35+
# Fix ownership after install
36+
RUN chown -R pptruser:pptruser /codecept
3137

3238
RUN ln -s /codecept/bin/codecept.js /usr/local/bin/codeceptjs
3339
RUN mkdir /tests
3440
WORKDIR /tests
35-
# Install puppeteer so it's available in the container.
36-
RUN npm i puppeteer@$(npm view puppeteer version) && npx puppeteer browsers install chrome
41+
# Skip the redundant Puppeteer installation step since we're using Playwright browsers
42+
# RUN npm i puppeteer@$(npm view puppeteer version) && npx puppeteer browsers install chrome
3743
# RUN chromium-browser --version
3844

39-
# Install playwright browsers
40-
RUN npx playwright install
45+
# Skip the playwright browser installation step since base image already has browsers
46+
# RUN npx playwright install
4147

4248
# Allow to pass argument to codecept run via env variable
4349
ENV CODECEPT_ARGS=""

test/data/rest/db.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "comments": [], "posts": [{ "id": 1, "title": "json-server", "author": "davert" }] }
1+
{ "posts": [{ "id": 1, "title": "json-server", "author": "davert" }], "user": { "name": "davert" } }

test/docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ services:
22
test-rest:
33
<<: &test-service
44
build: ..
5-
entrypoint: /codecept/node_modules/.bin/mocha
5+
entrypoint: ['']
66
working_dir: /codecept
77
env_file: .env
88
volumes:
9-
- ..:/codecept
10-
- node_modules:/codecept/node_modules
11-
command: test/rest
9+
- ./:/codecept/test
10+
command: ['/codecept/node_modules/.bin/mocha', 'test/rest']
1211
depends_on:
1312
- json_server
1413

0 commit comments

Comments
 (0)