Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 86 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.10.0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'pnpm'
Comment thread
PhilKsr marked this conversation as resolved.

- name: Install dependencies
Expand All @@ -39,81 +41,106 @@
- name: Run linting
run: pnpm --stream -r lint

# +++ COMMENTED OUT BECAUSE THIS IS A SEPARATE ISSUE: https://github.com/Frachtwerk/essencium-frontend/issues/221 +++
# unit-tests:
# name: Unit Tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Install pnpm
# uses: pnpm/action-setup@v4

# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: 'pnpm'

# - name: Install dependencies
# run: pnpm install --frozen-lockfile

# - name: Run unit tests
# run: pnpm --stream -r test:unit

e2e-tests:
name: E2E Tests
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.10.0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

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

- name: Install Playwright browsers
run: pnpm --filter @frachtwerk/essencium-app exec playwright install --with-deps
# e2e-tests:
# name: E2E Tests
# continue-on-error: true
# if: github.event_name != 'pull_request'
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# with:
# fetch-depth: 0

- name: Cache Playwright
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 10.10.0

- name: Run E2E tests
run: pnpm test:e2e
env:
TEST_ADMIN_USERNAME: ${{ secrets.TEST_ADMIN_USERNAME }}
TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}
# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 24
# cache: 'pnpm'

- name: Upload E2E test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-results
path: |
packages/app/test-results
packages/app/playwright-report
# - name: Install dependencies
# run: pnpm install --frozen-lockfile

# - name: Get installed Playwright version
# run: |
# PLAYWRIGHT_VERSION=$(node -p "require('./packages/app/package.json').devDependencies['@playwright/test']")
# echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> "$GITHUB_ENV"

# - name: Cache Playwright
# uses: actions/cache@v4
# id: playwright-cache
# with:
# path: ~/.cache/ms-playwright
# key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

# - name: Start local backend
# run: docker compose -f backend.docker-compose.yml up -d db backend

# - name: Wait for backend health
# run: |
# for i in {1..60}; do
# if curl -fsS http://localhost:8098 >/dev/null; then
# exit 0
# fi
# sleep 3
# done
# docker compose -f backend.docker-compose.yml logs db backend
# exit 1

# - name: Install Playwright browsers
# run: pnpm --filter @frachtwerk/essencium-app exec playwright install --with-deps

# - name: Run E2E tests
# run: pnpm --filter @frachtwerk/essencium-app test:e2e:test
# env:
# TEST_ADMIN_USERNAME: ${{ secrets.TEST_ADMIN_USERNAME }}
# TEST_ADMIN_PASSWORD: ${{ secrets.TEST_ADMIN_PASSWORD }}

# - name: Stop local backend
# if: always()
# run: docker compose -f backend.docker-compose.yml down -v

# - name: Upload E2E test results
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: e2e-test-results
# path: |
# packages/app/test-results
# packages/app/playwright-report

build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Build
runs-on: ubuntu-latest
steps:
Expand All @@ -124,11 +151,13 @@

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.10.0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
cache: 'pnpm'

- name: Install dependencies
Expand Down Expand Up @@ -202,7 +231,7 @@
permissions:
contents: write
pull-requests: write
needs: [lint, build] # [lint, unit-tests, e2e-tests, build]
needs: [lint, unit-tests, build]
steps:
- name: Release Please
uses: googleapis/release-please-action@v4
Expand All @@ -219,11 +248,13 @@

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.10.0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
node-version: 24
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
},
"packageManager": "pnpm@10.10.0",
"engines": {
"node": ">=20",
"node": ">=24",
"pnpm": "10"
},
"volta": {
"node": "20.15.0",
"node": "24.0.0",
"pnpm": "10.10.0"
},
"pnpm": {
Expand Down
4 changes: 2 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
"vitest": "4.0.18"
},
"engines": {
"node": ">=20",
"node": ">=24",
"pnpm": "10"
},
"volta": {
"node": "20.15.0",
"node": "24.0.0",
"pnpm": "10.10.0"
}
}
5 changes: 4 additions & 1 deletion packages/app/src/utils/formatDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
import dayjs from './dayjs'

export function formatDate(value: unknown): string {
return value ? dayjs(String(value)).format('DD.MM.YYYY') : '—'
if (!value) return '—'
const str = String(value)
const datePart = str.includes('T') ? str.split('T')[0] : str
return dayjs(datePart).format('DD.MM.YYYY')
}
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
},
"packageManager": "pnpm@10.10.0",
"engines": {
"node": ">=20",
"node": ">=24",
"pnpm": "10"
},
"volta": {
"node": "20.15.0",
"node": "24.0.0",
"pnpm": "10.10.0"
}
}
4 changes: 2 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
"eslint-plugin-prettier": "5.5.5"
},
"engines": {
"node": ">=20",
"node": ">=24",
"pnpm": "10"
},
"volta": {
"node": "20.15.0",
"node": "24.0.0",
"pnpm": "10.10.0"
}
}
4 changes: 2 additions & 2 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@
"zod": "^3.0.0"
},
"engines": {
"node": ">=20",
"node": ">=24",
"pnpm": "10"
},
"volta": {
"node": "20.15.0",
"node": "24.0.0",
"pnpm": "10.10.0"
}
}
47 changes: 19 additions & 28 deletions packages/lib/src/components/Contact/Contact.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { contactFormSchema } from '@frachtwerk/essencium-types'
import { AppShell, MantineProvider } from '@mantine/core'
import { render, renderHook, screen, within } from '@testing-library/react'
import { NextIntlClientProvider } from 'next-intl'
import { beforeAll, describe, expect, it } from 'vitest'

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

render(
<MantineProvider>
<AppShell>
<Contact control={control} contactPerson={examplePerson} />,
</AppShell>
</MantineProvider>,
<NextIntlClientProvider locale="en" messages={{}}>
<MantineProvider>
<AppShell>
<Contact control={control} contactPerson={examplePerson} />,
</AppShell>
</MantineProvider>
</NextIntlClientProvider>,
)
})

it('renders Contact component with correct layout', () => {
const grid = screen.getByRole('grid')
expect(grid).toBeDefined()

const gridCols = within(grid).getAllByRole('gridcell')
expect(gridCols).toHaveLength(2)

const contactPersonCard = within(gridCols[0])
expect(contactPersonCard).toBeDefined()

const contactForm = within(gridCols[1])
expect(contactForm).toBeDefined()
expect(screen.getByRole('complementary')).toBeDefined()
expect(screen.getByRole('form')).toBeDefined()
})

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

const phone = within(card).getByLabelText(
'contactView.contactPersonCard.contactPerson.ariaLabel',
)

const information = within(card).getAllByLabelText('Contact info')
expect(information).toHaveLength(4)
expect(information).toHaveLength(3)

const phone = information[0]
const mail = information[1]
const location = information[2]
const socialIcons = information[3]
const mail = information[0]
const location = information[1]
const socialIcons = information[2]

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

const emailInput = within(form).getByLabelText(/email/i)
expect(emailInput).toBeDefined()

const nameInput = within(form).getByLabelText(/name/i)
expect(nameInput).toBeDefined()

const subjectInput = within(form).getByLabelText(/subject/i)
expect(subjectInput).toBeDefined()

Expand Down
Loading
Loading