-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM node:18 | ||
|
||
WORKDIR /app | ||
|
||
# Install Playwright dependencies for Chromium only | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
libglib2.0-0 \ | ||
libnss3 \ | ||
libnspr4 \ | ||
libatk1.0-0 \ | ||
libatk-bridge2.0-0 \ | ||
libcups2 \ | ||
libdrm2 \ | ||
libdbus-1-3 \ | ||
libxcb1 \ | ||
libxkbcommon0 \ | ||
libx11-6 \ | ||
libxcomposite1 \ | ||
libxdamage1 \ | ||
libxext6 \ | ||
libxfixes3 \ | ||
libxrandr2 \ | ||
libgbm1 \ | ||
libpango-1.0-0 \ | ||
libcairo2 \ | ||
libasound2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy package files | ||
COPY package.json package-lock.json ./ | ||
|
||
# Install dependencies and Chromium | ||
RUN npm install --no-fund --ignore-scripts && \ | ||
# Force install platform-specific Rollup | ||
npm install --platform=linux --arch=arm64 @rollup/rollup-linux-arm64-gnu && \ | ||
# Install only Chromium with no sandbox | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install playwright-core && \ | ||
npx playwright install --with-deps chromium | ||
|
||
# Copy source files | ||
COPY . . | ||
|
||
# Build the app with explicit NODE_ENV | ||
RUN NODE_ENV=production npm run build | ||
|
||
# Set environment variable to use no sandbox | ||
ENV PLAYWRIGHT_SKIP_BROWSER_SANDBOX=1 | ||
|
||
# Command to run tests | ||
CMD ["npm", "run", "test:visual:update-snapshots"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# Enable error handling | ||
set -e | ||
|
||
# Function to check Docker connection | ||
check_docker() { | ||
local max_attempts=5 | ||
local attempt=1 | ||
local wait_time=5 | ||
|
||
while [ $attempt -le $max_attempts ]; do | ||
echo "Attempt $attempt of $max_attempts: Checking Docker connection..." | ||
if $CLI info > /dev/null 2>&1; then | ||
echo "Docker connection successful!" | ||
return 0 | ||
fi | ||
echo "Docker connection failed. Waiting $wait_time seconds before retry..." | ||
sleep $wait_time | ||
attempt=$((attempt + 1)) | ||
done | ||
|
||
echo "Failed to connect to Docker after $max_attempts attempts" | ||
return 1 | ||
} | ||
|
||
echo "🚀 Starting container build process..." | ||
|
||
# Use full path to Docker from Rancher Desktop | ||
CLI="${HOME}/.rd/bin/docker" | ||
|
||
# Switch to Rancher Desktop context | ||
echo "Switching to Rancher Desktop context..." | ||
$CLI context use rancher-desktop | ||
|
||
# Check Docker connection | ||
if ! check_docker; then | ||
echo "❌ Error: Could not establish connection to Docker daemon" | ||
exit 1 | ||
fi | ||
|
||
# Clean up any existing containers and images | ||
echo "🧹 Cleaning up any existing containers and images..." | ||
$CLI rm -f react-gravity-test-run 2>/dev/null || true | ||
$CLI rmi -f react-gravity-test 2>/dev/null || true | ||
|
||
# Build the container image with build progress | ||
echo "🏗️ Building container image..." | ||
$CLI build \ | ||
--progress=plain \ | ||
--no-cache \ | ||
--network=host \ | ||
--platform linux/arm64 \ | ||
--build-arg BUILDPLATFORM=linux/arm64 \ | ||
--build-arg TARGETPLATFORM=linux/arm64 \ | ||
-t react-gravity-test \ | ||
-f Dockerfile.test . | ||
|
||
# Run the container and copy the snapshots back | ||
echo "🏃 Running tests in container..." | ||
$CLI run --platform linux/arm64 --name react-gravity-test-run react-gravity-test | ||
|
||
echo "📸 Copying snapshots from container..." | ||
$CLI cp react-gravity-test-run:/app/src/e2e/visual.spec.ts-snapshots ./src/e2e/ | ||
|
||
echo "🧹 Cleaning up container..." | ||
$CLI rm react-gravity-test-run | ||
|
||
echo "✅ Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-58.5 KB
src/e2e/visual.spec.ts-snapshots/main-app-layout-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+80.2 KB
src/e2e/visual.spec.ts-snapshots/main-app-layout-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-73.6 KB
src/e2e/visual.spec.ts-snapshots/main-app-layout-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.11 MB
src/e2e/visual.spec.ts-snapshots/main-app-layout-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-75.7 KB
...2e/visual.spec.ts-snapshots/scenario-binary-pulsar-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+92 KB
...e2e/visual.spec.ts-snapshots/scenario-binary-pulsar-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-86.7 KB
src/e2e/visual.spec.ts-snapshots/scenario-binary-pulsar-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.18 MB
src/e2e/visual.spec.ts-snapshots/scenario-binary-pulsar-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-89.6 KB
...e2e/visual.spec.ts-snapshots/scenario-flower-dance-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+105 KB
src/e2e/visual.spec.ts-snapshots/scenario-flower-dance-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-101 KB
src/e2e/visual.spec.ts-snapshots/scenario-flower-dance-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.22 MB
src/e2e/visual.spec.ts-snapshots/scenario-flower-dance-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-83.6 KB
...visual.spec.ts-snapshots/scenario-galaxy-collision-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+99.1 KB
.../visual.spec.ts-snapshots/scenario-galaxy-collision-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-94.3 KB
...e/visual.spec.ts-snapshots/scenario-galaxy-collision-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.2 MB
...e2e/visual.spec.ts-snapshots/scenario-galaxy-collision-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-87.5 KB
...2e/visual.spec.ts-snapshots/scenario-negative-mass-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+104 KB
...e2e/visual.spec.ts-snapshots/scenario-negative-mass-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-97.3 KB
src/e2e/visual.spec.ts-snapshots/scenario-negative-mass-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.21 MB
src/e2e/visual.spec.ts-snapshots/scenario-negative-mass-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-78.3 KB
src/e2e/visual.spec.ts-snapshots/scenario-orbit-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+94.6 KB
src/e2e/visual.spec.ts-snapshots/scenario-orbit-chromium-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-89.2 KB
src/e2e/visual.spec.ts-snapshots/scenario-orbit-firefox-firefox-darwin.png
Binary file not shown.
Binary file removed
BIN
-1.18 MB
src/e2e/visual.spec.ts-snapshots/scenario-orbit-webkit-webkit-darwin.png
Binary file not shown.
Binary file removed
BIN
-77.6 KB
...2e/visual.spec.ts-snapshots/scenario-orbital-dance-chromium-chromium-darwin.png
Binary file not shown.
Binary file added
BIN
+94.5 KB
...e2e/visual.spec.ts-snapshots/scenario-orbital-dance-chromium-chromium-linux.png
Oops, something went wrong.
Binary file removed
BIN
-89.8 KB
src/e2e/visual.spec.ts-snapshots/scenario-orbital-dance-firefox-firefox-darwin.png
Diff not rendered.
Binary file removed
BIN
-1.18 MB
src/e2e/visual.spec.ts-snapshots/scenario-orbital-dance-webkit-webkit-darwin.png
Diff not rendered.
Binary file removed
BIN
-74.1 KB
src/e2e/visual.spec.ts-snapshots/scenario-path-test-chromium-chromium-darwin.png
Diff not rendered.
Binary file added
BIN
+95.5 KB
src/e2e/visual.spec.ts-snapshots/scenario-path-test-chromium-chromium-linux.png
Oops, something went wrong.
Binary file removed
BIN
-90.8 KB
src/e2e/visual.spec.ts-snapshots/scenario-path-test-firefox-firefox-darwin.png
Diff not rendered.
Binary file removed
BIN
-1.16 MB
src/e2e/visual.spec.ts-snapshots/scenario-path-test-webkit-webkit-darwin.png
Diff not rendered.
Binary file removed
BIN
-76.6 KB
src/e2e/visual.spec.ts-snapshots/scenario-react-chromium-chromium-darwin.png
Diff not rendered.
Binary file added
BIN
+91.9 KB
src/e2e/visual.spec.ts-snapshots/scenario-react-chromium-chromium-linux.png
Oops, something went wrong.
Binary file removed
BIN
-87.4 KB
src/e2e/visual.spec.ts-snapshots/scenario-react-firefox-firefox-darwin.png
Diff not rendered.
Binary file removed
BIN
-1.18 MB
src/e2e/visual.spec.ts-snapshots/scenario-react-webkit-webkit-darwin.png
Diff not rendered.
Binary file removed
BIN
-78.4 KB
src/e2e/visual.spec.ts-snapshots/scenario-three-stars-chromium-chromium-darwin.png
Diff not rendered.
Binary file added
BIN
+95.4 KB
src/e2e/visual.spec.ts-snapshots/scenario-three-stars-chromium-chromium-linux.png
Oops, something went wrong.
Binary file removed
BIN
-90.2 KB
src/e2e/visual.spec.ts-snapshots/scenario-three-stars-firefox-firefox-darwin.png
Diff not rendered.
Binary file removed
BIN
-1.18 MB
src/e2e/visual.spec.ts-snapshots/scenario-three-stars-webkit-webkit-darwin.png
Diff not rendered.