Skip to content

Commit e472278

Browse files
feat: restore old CI infrastructure for Next.js e2e tests
Reverted to the main branch pattern where each e2e test manages its own server dependencies: - Updated GitHub workflows to run individual test:e2e commands - Restored project.json test:e2e configurations from main branch - Each app now starts required federated dependencies before testing - Removed centralized server management approach Shop e2e tests are now working properly with automatic dependency management. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0fe177a commit e472278

File tree

5 files changed

+102
-19
lines changed

5 files changed

+102
-19
lines changed

.github/workflows/e2e-next-dev.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,20 @@ jobs:
4545
- name: Run condition check script
4646
id: check-ci
4747
run: node tools/scripts/ci-is-affected.mjs --appName=3000-home
48-
- name: Start Development Servers
48+
- name: E2E Test for Next.js Dev - Home
4949
if: steps.check-ci.outcome == 'success'
5050
run: |
5151
killall node
52-
pnpm nx daemon
53-
NX_TUI=false pnpm nx run-many --target=serve --configuration=development -p 3000-home,3001-shop,3002-checkout & sleep 3 && pnpm wait-on tcp:3001 tcp:3002 tcp:3000
52+
npx nx run 3000-home:test:e2e
5453
55-
- name: E2E Test Home App
54+
- name: E2E Test for Next.js Dev - Shop
5655
if: steps.check-ci.outcome == 'success'
57-
run: NX_TUI=false pnpm nx e2e 3000-home
58-
59-
- name: E2E Test Shop App
60-
if: steps.check-ci.outcome == 'success'
61-
run: NX_TUI=false pnpm nx e2e 3001-shop
56+
run: |
57+
killall node
58+
npx nx run 3001-shop:test:e2e
6259
63-
- name: E2E Test Checkout App
60+
- name: E2E Test for Next.js Dev - Checkout
6461
if: steps.check-ci.outcome == 'success'
65-
run: NX_TUI=false pnpm nx e2e 3002-checkout
66-
67-
- name: Cleanup Development Servers
68-
if: always()
69-
run: pnpm kill-port 3000,3001,3002
62+
run: |
63+
killall node
64+
npx nx run 3002-checkout:test:e2e

apps/3000-home/project.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,37 @@
8888
"parallel": true,
8989
"commands": [
9090
{
91-
"command": "nx run 3000-home:e2e",
91+
"command": "npx kill-port 3000 3001 3002",
92+
"forwardAllArgs": false
93+
},
94+
{
95+
"command": "NX_TUI=false nx run-many --target=serve --projects=3001-shop,3002-checkout --configuration=development & wait-on tcp:3001 tcp:3002",
96+
"forwardAllArgs": false
97+
},
98+
{
99+
"command": "wait-on tcp:3001 tcp:3002 && nx run 3000-home:e2e:development",
92100
"forwardAllArgs": true
93101
}
94102
]
103+
},
104+
"configurations": {
105+
"production": {
106+
"parallel": true,
107+
"commands": [
108+
{
109+
"command": "npx kill-port 3000 3001 3002",
110+
"forwardAllArgs": false
111+
},
112+
{
113+
"command": "nx run-many --target=build --projects=3001-shop,3002-checkout --configuration=production --parallel=9 && nx run-many --target=serve --projects=3001-shop,3002-checkout --configuration=production --parallel=9 & wait-on tcp:3001 tcp:3002",
114+
"forwardAllArgs": false
115+
},
116+
{
117+
"command": "nx build 3000-home --configuration=production && wait-on tcp:3001 tcp:3002 && NX_TUI=false nx run 3000-home:e2e:production",
118+
"forwardAllArgs": true
119+
}
120+
]
121+
}
95122
}
96123
}
97124
}

apps/3001-shop/project.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,41 @@
7373
"parallel": true,
7474
"commands": [
7575
{
76-
"command": "nx run 3001-shop:e2e",
76+
"command": "npx kill-port 3000 3001 3002",
77+
"forwardAllArgs": false
78+
},
79+
{
80+
"command": "NX_TUI=false nx run-many --target=serve --projects=3000-home,3002-checkout --configuration=development & wait-on tcp:3000 tcp:3002 ",
81+
"forwardAllArgs": false
82+
},
83+
{
84+
"command": "wait-on tcp:3000 tcp:3002 && nx run 3001-shop:e2e:development",
7785
"forwardAllArgs": true
7886
}
7987
]
88+
},
89+
"configurations": {
90+
"production": {
91+
"parallel": true,
92+
"commands": [
93+
{
94+
"command": "npx kill-port 3000 3001 3002",
95+
"forwardAllArgs": false
96+
},
97+
{
98+
"command": "nx run-many --target=build --projects=3000-home,3002-checkout --configuration=production --parallel=9",
99+
"forwardAllArgs": false
100+
},
101+
{
102+
"command": "nx run-many --target=serve --projects=3000-home,3002-checkout --configuration=production --parallel=9 & wait-on tcp:3000 tcp:3002",
103+
"forwardAllArgs": false
104+
},
105+
{
106+
"command": "echo 'done'",
107+
"forwardAllArgs": true
108+
}
109+
]
110+
}
80111
}
81112
},
82113
"e2e": {

apps/3002-checkout/project.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,37 @@
7070
"parallel": true,
7171
"commands": [
7272
{
73-
"command": "nx run 3002-checkout:e2e",
73+
"command": "npx kill-port 3000 3001 3002",
74+
"forwardAllArgs": false
75+
},
76+
{
77+
"command": "NX_TUI=false nx run-many --target=serve --projects=3000-home,3001-shop --configuration=development & wait-on tcp:3000 tcp:3001",
78+
"forwardAllArgs": false
79+
},
80+
{
81+
"command": "wait-on tcp:3000 tcp:3001 && nx run 3002-checkout:e2e:development",
7482
"forwardAllArgs": true
7583
}
7684
]
85+
},
86+
"configurations": {
87+
"production": {
88+
"parallel": true,
89+
"commands": [
90+
{
91+
"command": "npx kill-port 3000 3001 3002",
92+
"forwardAllArgs": false
93+
},
94+
{
95+
"command": "nx run-many --target=build --projects=3000-home,3001-shop --configuration=production --parallel=9 && nx run-many --target=serve --projects=3000-home,3001-shop --configuration=production --parallel=9 & wait-on tcp:3000 tcp:3001",
96+
"forwardAllArgs": false
97+
},
98+
{
99+
"command": "nx build 3002-checkout --configuration=production && wait-on tcp:3000 tcp:3001 && nx run 3002-checkout:e2e:production",
100+
"forwardAllArgs": true
101+
}
102+
]
103+
}
77104
}
78105
},
79106
"e2e": {

scripts/e2e-next-all.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ set -e
44

55
echo "🏗️ Building packages..."
66
npx nx run-many --targets=build --projects=tag:type:pkg
7-
pnpm run app:next:dev
7+
88
echo "🧪 Running E2E Test for Next.js Dev - Home"
9+
killall node 2>/dev/null || true
910
npx nx run 3000-home:test:e2e
1011

1112
echo "🧪 Running E2E Test for Next.js Dev - Shop"
13+
killall node 2>/dev/null || true
1214
npx nx run 3001-shop:test:e2e
1315

1416
echo "🧪 Running E2E Test for Next.js Dev - Checkout"
17+
killall node 2>/dev/null || true
1518
npx nx run 3002-checkout:test:e2e
1619

1720
echo "✅ All E2E tests completed successfully!"

0 commit comments

Comments
 (0)