When running from local, its getting passed. Below error is thrown when run from docker locally. I am in the process of setting up my code for my puppeteer test.
I also included here below package.json, jest-puppeteer.config, jest.config files. Here I haven't included my tests files.
shall you please someone help ? Thanks.
Error: Jest: Got error running globalSetup - /home/pptruser/app/node_modules/jest-environment-puppeteer/setup.js, reason: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (1022525).
at ChromeLauncher.launch (/home/pptruser/app/node_modules/puppeteer/lib/cjs/puppeteer/node/ChromeLauncher.js:70:23)
at async Promise.all (index 0)
at async setup (/home/pptruser/app/node_modules/jest-environment-puppeteer/lib/global.js:37:16)
at async /home/pptruser/app/node_modules/@jest/core/build/runGlobalHook.js:125:13
at async waitForPromiseWithCleanup (/home/pptruser/app/node_modules/@jest/transform/build/ScriptTransformer.js:209:5)
at async runGlobalHook (/home/pptruser/app/node_modules/@jest/core/build/runGlobalHook.js:116:9)
at async runJest (/home/pptruser/app/node_modules/@jest/core/build/runJest.js:369:5)
at async _run10000 (/home/pptruser/app/node_modules/@jest/core/build/cli/index.js:320:7)
at async runCLI (/home/pptruser/app/node_modules/@jest/core/build/cli/index.js:173:3)
at async Object.run (/home/pptruser/app/node_modules/jest-cli/build/cli/index.js:155:37)
jest.config.js:
module.exports = {
preset: "jest-puppeteer"
notifyMode: "always",
maxWorkers: "50%",
maxConcurrency: 150,
maxWorkers: 1,
bail: 1,
collectCoverage: true,
testRunner: "jest-jasmine2",
timers: "fake",
testTimeout: 9000000,
watchman: false,
};
package.json:
"devDependencies": {
"@babel/preset-env": "^7.18.2",
"babel-jest": "^27.0.6",
"dotenv": "^16.0.1",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"jest-jasmine2": "^27.2.3",
"jest-puppeteer": "^6.1.0",
"prettier": "2.5.1",
"puppeteer": "^14.1.2"
}
jest-puppeteer.config:
module.exports = {
launch: {
headless: true,
slowMo: 0,
defaultViewport: null,
args: ["--window-size=1920,1080",
"--incognito",
"--start-maximized",
"--disable-extensions",
"--no-sandbox",
"--disable-setuid-sandbox",
"--no-first-run",
"--no-zygote"],
setDefaultNavigationTimeout: 8000000,
setDefaultTimeout: 8000000,
},
browserContext: "default",
};
My docker file:
FROM docker-remote.artifactory.oci.oraclecorp.com/oraclelinux:7-slim
COPY --from=odo-docker-signed-local.artifactory.oci.oraclecorp.com/odo/base-image-support:ol7x-1.6 / /
RUN yum-config-manager --add-repo https://artifactory.oci.oraclecorp.com/io-ol7-nodejs16-yum-local/ \
--add-repo https://artifactory.oci.oraclecorp.com/io-ol7-oracle-instant-client-yum-local/ \
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
ORACLE_NPM=https://artifactory.oci.oraclecorp.com/api/npm/npm-remote/
RUN yum -y update \
&& yum -y install nodejs-16.14.2-1.0.1.el7.x86_64 chromium-102.0.5005.115-1.el7.x86_64
RUN groupadd -r pptruser \
&& useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& mkdir -p /home/pptruser/app \
&& chown -R pptruser:pptruser /home/pptruser
WORKDIR /home/pptruser/app
COPY --chown=pptruser:pptruser . .
CMD ["npm","run-script smoke"]