-
Notifications
You must be signed in to change notification settings - Fork 2
Feat: Playwright /docker + vite watcher on html + css #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5ab6a26
13d164f
747a4a6
153cfa9
c15e1f2
d496bd3
03bf550
c4f9461
95382c1
0ce8774
5701088
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Launch Playwright using Docker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker run -d --rm \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --name "e2e-fullstack-challenge" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -v "$PWD":/app \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -w /app \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -p 3000:3000 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -p 3001:3001 \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mcr.microsoft.com/playwright:v1.52.0-noble | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npm run dev & | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Starting services..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npx wait-on --http-get http://localhost:3000 http://localhost:3001 && npm run test:ui | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing process cleanup and error handling. The script starts background processes but doesn't clean them up on exit or failure, which could leave orphaned processes running. Add proper cleanup and error handling: +#!/bin/bash
+
+set -e
+
+# Cleanup function
+cleanup() {
+ echo "Cleaning up..."
+ pkill -f "npm run dev" || true
+ docker stop e2e-fullstack-challenge || true
+ docker rm e2e-fullstack-challenge || true
+}
+
+# Set trap to cleanup on exit
+trap cleanup EXIT INT TERM
+
# Launch Playwright using Docker
docker run -d --rm \
--name "e2e-fullstack-challenge" \
-v "$PWD":/app \
-w /app \
-p 3000:3000 \
-p 3001:3001 \
mcr.microsoft.com/playwright:v1.52.0-noble
npm run dev &
+DEV_PID=$!
echo "Starting services..."
npx wait-on --http-get http://localhost:3000 http://localhost:3001 && npm run test:ui📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider timeout and better error messaging for service readiness. The wait-on command should have a timeout and better error handling to avoid hanging indefinitely. -npx wait-on --http-get http://localhost:3000 http://localhost:3001 && npm run test:ui
+echo "Waiting for services to be ready..."
+npx wait-on --timeout 60000 --http-get http://localhost:3000 http://localhost:3001
+echo "Services are ready, running tests..."
+npm run test:ui📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| FROM mcr.microsoft.com/playwright:v1.52.0-noble | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY package.json package-lock.json ./ | ||
|
|
||
| RUN npm i --frozen-lockfile; | ||
|
|
||
| COPY tests ./ | ||
| COPY playwright.config.ts . | ||
|
|
||
| CMD ["npx", "playwright", "test"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { defineConfig } from 'vite'; | ||
|
|
||
| export default defineConfig({ | ||
| root: 'src/frontend', | ||
| server: { | ||
| port: 3001, | ||
| } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker container setup seems disconnected from test execution.
The script creates a Docker container but then runs
npm run test:uion the host, not inside the container. This appears to contradict the PR objectives of running Playwright tests "inside the container."Consider clarifying the intended workflow. If tests should run inside the container:
Then execute tests inside the container:
🤖 Prompt for AI Agents