Код: Выделить всё
Error: WebSocket connection closed
at /app/node_modules/chrome-remote-interface/lib/chrome.js:94:35
at Chrome._handleConnectionClose (/app/node_modules/chrome-remote-interface/lib/chrome.js:256:13)
at WebSocket. (/app/node_modules/chrome-remote-interface/lib/chrome.js:243:22)
at WebSocket.emit (node:events:518:28)
at WebSocket.emit (node:domain:489:12)
at WebSocket.emitClose (/app/node_modules/ws/lib/websocket.js:246:10)
at Receiver.receiverOnFinish (/app/node_modules/ws/lib/websocket.js:1060:20)
at Receiver.emit (node:events:518:28)
at Receiver.emit (node:domain:489:12)
at finish (node:internal/streams/writable:955:10)
Код: Выделить всё
FROM --platform=linux/amd64 node:22-bullseye
# Suppress interactive prompts and D-Bus probing
ENV DEBIAN_FRONTEND=noninteractive
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
# 🧩 Install Google Chrome and dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
gnupg \
ca-certificates \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libxss1 \
libxext6 \
libxfixes3 \
libxrender1 \
libxi6 \
libxtst6 \
xdg-utils \
awscli \
--no-install-recommends && \
wget -qO - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && \
apt-get install -y google-chrome-stable --no-install-recommends
# 🔗 Symlinks so TestCafe can find 'chrome'
RUN ln -sf /usr/bin/google-chrome /usr/bin/chrome && \
ln -sf /usr/bin/google-chrome /usr/bin/chromium
# 🔍 Verify Chrome installation
RUN google-chrome --version
# 📦 Project setup
WORKDIR /app
COPY . .
RUN yarn config set strict-ssl false
RUN yarn install
# 🚀 Default command to run your visual tests
CMD ["yarn", "run", "ci:visual"]
< /code>
Выше построено с именем Visual-test-runner < /p>
run-snapshot.sh
#!/bin/bash
# 🔧 Load environment variables from .env file
set -a
source .env
set +a
# 🧠 Default values
SNAPSHOT=${SNAPSHOT:-actual}
TESTS=${TESTS:-tests/visual/*.test.ts}
# 🐳 Run the Docker container with all env vars
docker run -it --rm \
-v "$(pwd)":/app \
-w /app \
-e ENV="$ENV" \
-e TESTS="$TESTS" \
visual-test-runner
Подробнее здесь: https://stackoverflow.com/questions/797 ... d-testcafe
Мобильная версия