Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run examples/browser-playwright-reuse-authentication on latest docker image #3455

Open
chandanadesilva opened this issue Jan 17, 2025 · 2 comments

Comments

@chandanadesilva
Copy link

Version info:

Docker image : 
        "Id": "sha256:9082a2c55e6f694b1e6084b5fa1fef7a536b20d8219e279dd2b3becdd8e9ce69",
        "RepoTags": [
            "artilleryio/artillery:latest"
        ],
        "RepoDigests": [
            "artilleryio/artillery@sha256:44cc47f060990a5ac88186887e3a631429b9f2e7447ead34c8ba8dd42c30351f"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2025-01-13T13:34:38.17490144Z",


VERSION
  artillery/2.0.22 linux-x64 node-v22.13.0
  1. Running this command:
docker run --rm -it -v ${PWD}:/scripts artilleryio/artillery:latest run /scripts/scenario.yml

Expected the test to run. Instead I got this:

Test run id: tppgw_hkj9zxbg4t9yw9ygd4a8c5pctn3jt_rf55
⠋ node:internal/modules/cjs/loader:1244
  const err = new Error(message);
              ^

Error: Cannot find module '@playwright/test'
Require stack:
- /scripts/flow.js
- /home/node/artillery/node_modules/@artilleryio/int-core/lib/runner.js
- /home/node/artillery/node_modules/@artilleryio/int-core/index.js
- /home/node/artillery/lib/artillery-global.js
- /home/node/artillery/bin/run
    at Function._resolveFilename (node:internal/modules/cjs/loader:1244:15)
    at Function._load (node:internal/modules/cjs/loader:1070:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/scripts/flow.js:1:20)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/scripts/flow.js',
    '/home/node/artillery/node_modules/@artilleryio/int-core/lib/runner.js',
    '/home/node/artillery/node_modules/@artilleryio/int-core/index.js',
    '/home/node/artillery/lib/artillery-global.js',
    '/home/node/artillery/bin/run'
  ]
}

Node.js v22.13.0

Running this command:

cd examples/browser-playwright-reuse-authentication
docker run --rm -it -v ${PWD}:/scripts --entrypoint /bin/sh artilleryio/artillery:latest 
cd /scripts
npx artillery run scenario.yml

I expected to see this happen:

I expected the test to run

Instead, this happened:

Need to install the following packages:
artillery@2.0.22
Ok to proceed? 

Files being used:
examples/browser-playwright-reuse-authentication

@chandanadesilva
Copy link
Author

I was able to make this work by setting NODE_PATH:

FROM node:22-bookworm
LABEL maintainer="team@artillery.io"

RUN apt-get update && apt-get install bash

WORKDIR /home/node/artillery

COPY package*.json ./
RUN npm --ignore-scripts --production install && npm install @playwright/test
RUN npx playwright install --with-deps chromium

COPY . ./
ENV PATH="/home/node/artillery/bin:${PATH}"
ENV NODE_PATH=/home/node/artillery/node_modules

ENTRYPOINT ["/home/node/artillery/bin/run"]

@Fraggy99s
Copy link

Fraggy99s commented Feb 24, 2025

how come the docu says "The Playwright engine is built into Artillery and does not need to be installed separately." but the docker image is unable to find playwright?

EDIT:
I have looked deeper into artillery docu and now I understand the concept of accessing playwright scripts inside of a container.

For anyone wondering:
So basically all you need to do is have a artillery wrapper (.yaml) file which executes the playwright scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants