Я считаю, что проблема в Chrome и установке драйвера Chrome в файле докера.
Я пробовал много вещей, но отметка сработала, и ошибок не возникает.
Код: Выделить всё
FROM openjdk:21-ea-21-jdk-slim AS BUILD
# Set the working directory in the container
WORKDIR /app
# Copy the Maven configuration file (pom.xml) to the container
COPY pom.xml .
# Copy the source code into the container
COPY . .
# Build your application with Maven
#RUN apk add --no-cache maven && mvn clean package
RUN apt-get update && \
apt-get install -y maven && \
apt-get clean;
RUN apt-get update -y && apt-get install -y wget xvfb unzip jq
RUN apt-get update && apt-get install -y curl
RUN apt-get update && apt-get install -y chromium
# Install Google Chrome dependencies
RUN apt-get install -y libxss1 libappindicator1 libgconf-2-4 \
fonts-liberation libasound2 libnspr4 libnss3 libx11-xcb1 libxtst6 lsb-release xdg-utils \
libgbm1 libnss3 libatk-bridge2.0-0 libgtk-3-0 libx11-xcb1 libxcb-dri3-0
# Fetch the latest version numbers and URLs for Chrome and ChromeDriver
RUN curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json > /tmp/versions.json
RUN CHROME_URL=$(jq -r '.channels.Stable.downloads.chrome[] | select(.platform=="linux64") | .url' /tmp/versions.json) && \
wget -q --continue -O /tmp/chrome-linux64.zip $CHROME_URL && \
unzip /tmp/chrome-linux64.zip -d /opt/chrome
RUN chmod +x /opt/chrome/chrome-linux64/chrome
RUN CHROMEDRIVER_URL=$(jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform=="linux64") | .url' /tmp/versions.json) && \
wget -q --continue -O /tmp/chromedriver-linux64.zip $CHROMEDRIVER_URL && \
unzip /tmp/chromedriver-linux64.zip -d /opt/chromedriver && \
chmod +x /opt/chromedriver/chromedriver-linux64/chromedriver
# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_DIR /opt/chromedriver
ENV PATH $CHROMEDRIVER_DIR:$PATH
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
# Run the application when the container starts
CMD ["mvn", "test"]
Код: Выделить всё
INFO]
2024-03-17T19:56:38.573205002Z [INFO] -------------------------------------------------------
2024-03-17T19:56:38.573276927Z [INFO] T E S T S
2024-03-17T19:56:38.573561943Z [INFO] -------------------------------------------------------
2024-03-17T19:56:39.635558976Z [INFO] Running TestSuite
2024-03-17T19:56:59.738518367Z [TestNG-tests-1] INFO framework.cleanup.CleanupThread - Thread started
2024-03-17T19:57:02.483653897Z [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.82 s -- in TestSuite
2024-03-17T19:57:02.820011928Z [INFO]
2024-03-17T19:57:02.820063444Z [INFO] Results:
2024-03-17T19:57:02.820072141Z [INFO]
2024-03-17T19:57:02.821374723Z [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
2024-03-17T19:57:02.821432691Z [INFO]
2024-03-17T19:57:02.825335558Z [INFO] ------------------------------------------------------------------------
2024-03-17T19:57:02.825405780Z [INFO] BUILD SUCCESS
2024-03-17T19:57:02.826307320Z [INFO] ------------------------------------------------------------------------
2024-03-17T19:57:02.827949419Z [INFO] Total time: 02:25 min
2024-03-17T19:57:02.828526872Z [INFO] Finished at: 2024-03-17T19:57:02Z
2024-03-17T19:57:02.829058800Z [INFO] ------------------------------------------------------------------------
Выполняются только тесты API, но не тесты e2e.
Подробнее здесь: https://stackoverflow.com/questions/781 ... are-not-ru