Skip to content

Commit da0c900

Browse files
authored
fix: exclude flaky e2e from pipeline (#971)
* chore: update component tests for improved accuracy and consistency * chore: update CI configuration to use Node 24, skip e2e tests and activate unit tests * chore: add Vitest configuration for testing with happy-dom environment * chore: clean up import statements in test files for consistency * chore: update Node engine requirements to >=24 across all packages * chore: fix test for TablePagination * chore: wrap components in NextIntlClientProvider for internationalization support in tests
1 parent 5948157 commit da0c900

24 files changed

Lines changed: 434 additions & 303 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626

2727
- name: Install pnpm
2828
uses: pnpm/action-setup@v4
29+
with:
30+
version: 10.10.0
2931

3032
- name: Setup Node
3133
uses: actions/setup-node@v4
3234
with:
33-
node-version: 22
35+
node-version: 24
3436
cache: 'pnpm'
3537

3638
- name: Install dependencies
@@ -39,33 +41,8 @@ jobs:
3941
- name: Run linting
4042
run: pnpm --stream -r lint
4143

42-
# +++ COMMENTED OUT BECAUSE THIS IS A SEPARATE ISSUE: https://github.com/Frachtwerk/essencium-frontend/issues/221 +++
43-
# unit-tests:
44-
# name: Unit Tests
45-
# runs-on: ubuntu-latest
46-
# steps:
47-
# - name: Checkout repo
48-
# uses: actions/checkout@v4
49-
# with:
50-
# fetch-depth: 0
51-
52-
# - name: Install pnpm
53-
# uses: pnpm/action-setup@v4
54-
55-
# - name: Setup Node
56-
# uses: actions/setup-node@v4
57-
# with:
58-
# node-version: 22
59-
# cache: 'pnpm'
60-
61-
# - name: Install dependencies
62-
# run: pnpm install --frozen-lockfile
63-
64-
# - name: Run unit tests
65-
# run: pnpm --stream -r test:unit
66-
67-
e2e-tests:
68-
name: E2E Tests
44+
unit-tests:
45+
name: Unit Tests
6946
runs-on: ubuntu-latest
7047
steps:
7148
- name: Checkout repo
@@ -75,43 +52,93 @@ jobs:
7552

7653
- name: Install pnpm
7754
uses: pnpm/action-setup@v4
55+
with:
56+
version: 10.10.0
7857

7958
- name: Setup Node
8059
uses: actions/setup-node@v4
8160
with:
82-
node-version: 22
61+
node-version: 24
8362
cache: 'pnpm'
8463

8564
- name: Install dependencies
8665
run: pnpm install --frozen-lockfile
8766

88-
- name: Get installed Playwright version
89-
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./packages/app/package.json').dependencies['@playwright/test'])")" >> $GITHUB_ENV
67+
- name: Run unit tests
68+
run: pnpm --stream -r test:unit
9069

91-
- name: Install Playwright browsers
92-
run: pnpm --filter @frachtwerk/essencium-app exec playwright install --with-deps
70+
# e2e-tests:
71+
# name: E2E Tests
72+
# continue-on-error: true
73+
# if: github.event_name != 'pull_request'
74+
# runs-on: ubuntu-latest
75+
# steps:
76+
# - name: Checkout repo
77+
# uses: actions/checkout@v4
78+
# with:
79+
# fetch-depth: 0
9380

94-
- name: Cache Playwright
95-
uses: actions/cache@v4
96-
id: playwright-cache
97-
with:
98-
path: ~/.cache/ms-playwright
99-
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
81+
# - name: Install pnpm
82+
# uses: pnpm/action-setup@v4
83+
# with:
84+
# version: 10.10.0
10085

101-
- name: Run E2E tests
102-
run: pnpm test:e2e
103-
env:
104-
TEST_ADMIN_USERNAME: ${{ secrets.TEST_ADMIN_USERNAME }}
105-
TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}
86+
# - name: Setup Node
87+
# uses: actions/setup-node@v4
88+
# with:
89+
# node-version: 24
90+
# cache: 'pnpm'
10691

107-
- name: Upload E2E test results
108-
uses: actions/upload-artifact@v4
109-
if: always()
110-
with:
111-
name: e2e-test-results
112-
path: |
113-
packages/app/test-results
114-
packages/app/playwright-report
92+
# - name: Install dependencies
93+
# run: pnpm install --frozen-lockfile
94+
95+
# - name: Get installed Playwright version
96+
# run: |
97+
# PLAYWRIGHT_VERSION=$(node -p "require('./packages/app/package.json').devDependencies['@playwright/test']")
98+
# echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> "$GITHUB_ENV"
99+
100+
# - name: Cache Playwright
101+
# uses: actions/cache@v4
102+
# id: playwright-cache
103+
# with:
104+
# path: ~/.cache/ms-playwright
105+
# key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
106+
107+
# - name: Start local backend
108+
# run: docker compose -f backend.docker-compose.yml up -d db backend
109+
110+
# - name: Wait for backend health
111+
# run: |
112+
# for i in {1..60}; do
113+
# if curl -fsS http://localhost:8098 >/dev/null; then
114+
# exit 0
115+
# fi
116+
# sleep 3
117+
# done
118+
# docker compose -f backend.docker-compose.yml logs db backend
119+
# exit 1
120+
121+
# - name: Install Playwright browsers
122+
# run: pnpm --filter @frachtwerk/essencium-app exec playwright install --with-deps
123+
124+
# - name: Run E2E tests
125+
# run: pnpm --filter @frachtwerk/essencium-app test:e2e:test
126+
# env:
127+
# TEST_ADMIN_USERNAME: ${{ secrets.TEST_ADMIN_USERNAME }}
128+
# TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}
129+
130+
# - name: Stop local backend
131+
# if: always()
132+
# run: docker compose -f backend.docker-compose.yml down -v
133+
134+
# - name: Upload E2E test results
135+
# uses: actions/upload-artifact@v4
136+
# if: always()
137+
# with:
138+
# name: e2e-test-results
139+
# path: |
140+
# packages/app/test-results
141+
# packages/app/playwright-report
115142

116143
build:
117144
name: Build
@@ -124,11 +151,13 @@ jobs:
124151

125152
- name: Install pnpm
126153
uses: pnpm/action-setup@v4
154+
with:
155+
version: 10.10.0
127156

128157
- name: Setup Node
129158
uses: actions/setup-node@v4
130159
with:
131-
node-version: 20
160+
node-version: 24
132161
cache: 'pnpm'
133162

134163
- name: Install dependencies
@@ -202,7 +231,7 @@ jobs:
202231
permissions:
203232
contents: write
204233
pull-requests: write
205-
needs: [lint, build] # [lint, unit-tests, e2e-tests, build]
234+
needs: [lint, unit-tests, build]
206235
steps:
207236
- name: Release Please
208237
uses: googleapis/release-please-action@v4
@@ -219,11 +248,13 @@ jobs:
219248

220249
- name: Install pnpm
221250
uses: pnpm/action-setup@v4
251+
with:
252+
version: 10.10.0
222253

223254
- name: Setup Node
224255
uses: actions/setup-node@v4
225256
with:
226-
node-version: 22
257+
node-version: 24
227258
cache: 'pnpm'
228259
registry-url: 'https://registry.npmjs.org'
229260

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
},
6262
"packageManager": "pnpm@10.10.0",
6363
"engines": {
64-
"node": ">=20",
64+
"node": ">=24",
6565
"pnpm": "10"
6666
},
6767
"volta": {
68-
"node": "20.15.0",
68+
"node": "24.0.0",
6969
"pnpm": "10.10.0"
7070
},
7171
"pnpm": {

packages/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
"vitest": "4.0.18"
7777
},
7878
"engines": {
79-
"node": ">=20",
79+
"node": ">=24",
8080
"pnpm": "10"
8181
},
8282
"volta": {
83-
"node": "20.15.0",
83+
"node": "24.0.0",
8484
"pnpm": "10.10.0"
8585
}
8686
}

packages/app/src/utils/formatDate.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
import dayjs from './dayjs'
2121

2222
export function formatDate(value: unknown): string {
23-
return value ? dayjs(String(value)).format('DD.MM.YYYY') : '—'
23+
if (!value) return '—'
24+
const str = String(value)
25+
const datePart = str.includes('T') ? str.split('T')[0] : str
26+
return dayjs(datePart).format('DD.MM.YYYY')
2427
}

packages/docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
},
4545
"packageManager": "pnpm@10.10.0",
4646
"engines": {
47-
"node": ">=20",
47+
"node": ">=24",
4848
"pnpm": "10"
4949
},
5050
"volta": {
51-
"node": "20.15.0",
51+
"node": "24.0.0",
5252
"pnpm": "10.10.0"
5353
}
5454
}

packages/eslint-config/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
"eslint-plugin-prettier": "5.5.5"
4646
},
4747
"engines": {
48-
"node": ">=20",
48+
"node": ">=24",
4949
"pnpm": "10"
5050
},
5151
"volta": {
52-
"node": "20.15.0",
52+
"node": "24.0.0",
5353
"pnpm": "10.10.0"
5454
}
5555
}

packages/lib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@
9595
"zod": "^3.0.0"
9696
},
9797
"engines": {
98-
"node": ">=20",
98+
"node": ">=24",
9999
"pnpm": "10"
100100
},
101101
"volta": {
102-
"node": "20.15.0",
102+
"node": "24.0.0",
103103
"pnpm": "10.10.0"
104104
}
105105
}

packages/lib/src/components/Contact/Contact.test.tsx

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { contactFormSchema } from '@frachtwerk/essencium-types'
2121
import { AppShell, MantineProvider } from '@mantine/core'
2222
import { render, renderHook, screen, within } from '@testing-library/react'
23+
import { NextIntlClientProvider } from 'next-intl'
2324
import { beforeAll, describe, expect, it } from 'vitest'
2425

2526
import { useZodForm } from '../../hooks'
@@ -51,26 +52,19 @@ describe('Contact', () => {
5152
const { control } = result.current
5253

5354
render(
54-
<MantineProvider>
55-
<AppShell>
56-
<Contact control={control} contactPerson={examplePerson} />,
57-
</AppShell>
58-
</MantineProvider>,
55+
<NextIntlClientProvider locale="en" messages={{}}>
56+
<MantineProvider>
57+
<AppShell>
58+
<Contact control={control} contactPerson={examplePerson} />,
59+
</AppShell>
60+
</MantineProvider>
61+
</NextIntlClientProvider>,
5962
)
6063
})
6164

6265
it('renders Contact component with correct layout', () => {
63-
const grid = screen.getByRole('grid')
64-
expect(grid).toBeDefined()
65-
66-
const gridCols = within(grid).getAllByRole('gridcell')
67-
expect(gridCols).toHaveLength(2)
68-
69-
const contactPersonCard = within(gridCols[0])
70-
expect(contactPersonCard).toBeDefined()
71-
72-
const contactForm = within(gridCols[1])
73-
expect(contactForm).toBeDefined()
66+
expect(screen.getByRole('complementary')).toBeDefined()
67+
expect(screen.getByRole('form')).toBeDefined()
7468
})
7569

7670
describe('ContactPersonCard', () => {
@@ -87,15 +81,18 @@ describe('Contact', () => {
8781
const name = within(card).getByRole('heading', { level: 5 })
8882
expect(name).toBeDefined()
8983

84+
const phone = within(card).getByLabelText(
85+
'contactView.contactPersonCard.contactPerson.ariaLabel',
86+
)
87+
9088
const information = within(card).getAllByLabelText('Contact info')
91-
expect(information).toHaveLength(4)
89+
expect(information).toHaveLength(3)
9290

93-
const phone = information[0]
94-
const mail = information[1]
95-
const location = information[2]
96-
const socialIcons = information[3]
91+
const mail = information[0]
92+
const location = information[1]
93+
const socialIcons = information[2]
9794

98-
expect(within(phone).getByText(/1(123) 456-7890/)).toBeDefined()
95+
expect(within(phone).getByText('1(123) 456-7890')).toBeDefined()
9996
expect(within(mail).getByText(/jane.doe@example.com/)).toBeDefined()
10097
expect(
10198
within(location).getByText(/123 Maple Street. Anytown, PA 17101/),
@@ -114,12 +111,6 @@ describe('Contact', () => {
114111
const title = within(form).getByRole('heading', { level: 3 })
115112
expect(title).toBeDefined()
116113

117-
const emailInput = within(form).getByLabelText(/email/i)
118-
expect(emailInput).toBeDefined()
119-
120-
const nameInput = within(form).getByLabelText(/name/i)
121-
expect(nameInput).toBeDefined()
122-
123114
const subjectInput = within(form).getByLabelText(/subject/i)
124115
expect(subjectInput).toBeDefined()
125116

0 commit comments

Comments
 (0)