I have one container docker running browserless and another container running functionnal tests with puppeeter on the same docker compose file. Functionnals test are in a project repository and running with node 15. This docker compose is running on a server, different from my pc, and there is a dns (i don't use ip directly).
When i run the functionnals test from my pc, or from another server the test passes (functionnals tests connect to the container where is browserless running) But when i run the test inside the dedicated container docker with the functionnals tests inside, the tests always fails at the middle.
Test steps are the following:
1 connect to browserless (ok)
2 go to specific page (ok)
3 simulate user click (ok)
4 simulate user typing data (ok)
5 simulate user typing data (ok)
6 simulate user submit (ok)
7 go to smtp4dev , another specific page (fake smtp) (ok)
8 simulate user opening its email (ok)
9 found the link confirmation and click on it (ok on my pc but not from the container)
On the last step, i simulate user click on the last mail, then i look for an iframe where i can find the confirmation link. But here is the problem. If i run the test inside the container, the iframe is never found, but i if do from my pc or another remote server on same network, there is no problem, the iframe is always found.
I don't know what is the difference from running the test inside the container and from my pc. I don't know here i have to look.
Here is the dockerfile for my functionnals tests
FROM node:15
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY tools.js .
COPY subscription_test.js .
COPY password_test.js .
COPY tests.js .
CMD [ "node", "tests.js" ]
And the dockerfile for browserless/chrome
FROM browserless/chrome
USER root
RUN apt update && apt install ca-certificates libnss3-tools ffmpeg -y && rm -rf /var/cache/apk/*
ADD mik3fly.internal-cacert.crt /usr/local/share/ca-certificates/mik3fly.internal-cacert.crt
RUN chmod 644 /usr/local/share/ca-certificates/mik3fly.internal-cacert.crt && update-ca-certificates
RUN certutil -d sql:/root/.pki/nssdb -A -t "P,," -n certnickname -i /usr/local/share/ca-certificates/mik3fly.internal-cacert.crt
RUN certutil -A -n certnickname -t "TCu,Cu,Tu" -i /usr/local/share/ca-certificates/mik3fly.internal-cacert.crt -d sql:/root/.pki/nssdb
here the dockercompose config about the browserless part
integration:
image: 4steri5k/integration:${TAG}
environment:
- DEFAULT_IGNORE_HTTPS_ERRORS=true
- DEFAULT_LAUNCH_ARGS=["--window-size=1920,1080","--ignore-certificate-errors"]
- ENABLE_DEBUGGER=false
- MAX_CONCURRENT_SESSIONS=10
- CONNECTION_TIMEOUT=180000
- "PROXY_HOST=vm3.mik3fly.internal/browserless/"
- "PROXY_PORT=443"
- "PROXY_SSL=true"
ports:
- "3000:3000"
networks:
- browserless-network
- nginx-network
- rtx_ui-network
and here the part inside my functionnals tests to connect to browserless
console.log('https://vm1.mik3fly.internal/browserless/')
const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://vm2.mik3fly.internal/browserless/',
ignoreHTTPSErrors: true,
acceptInsecureCerts: true,
args: ["--ignore-certificate-errors"],
defaultViewport: {
height: 1200,
width: 1600,
isMobile: false,
isLandscape: false,
}
})
then i do connect to the first page..
try {
const page1 = await browser.newPage();
await page1.goto('https://vm0.mik3fly.internal/rtx', {
waitUntil: "domcontentloaded"
})
and after the mentionned steps below are executed