fix: resolve contact form and page slug translation mismatch causing E2E test failures
Some checks failed
CI - Lint, Typecheck & Test / quality-assurance (pull_request) Failing after 6s
Build & Deploy / 🔍 Prepare (push) Successful in 14s
Build & Deploy / 🧪 QA (push) Failing after 1m31s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s

This commit is contained in:
2026-06-10 11:47:42 +02:00
parent a20ba52f7f
commit 6e2a959972
4 changed files with 37 additions and 7 deletions

View File

@@ -3,11 +3,11 @@
"pages": {
"impressum": "impressum",
"datenschutz": "datenschutz",
"agbs": "terms",
"kontakt": "contact",
"agbs": "agbs",
"kontakt": "kontakt",
"team": "team",
"blog": "blog",
"produkte": "products",
"produkte": "produkte",
"start": "start",
"danke": "thanks",
"niederspannungskabel": "low-voltage-cables",

View File

@@ -3,11 +3,11 @@
"pages": {
"legal-notice": "impressum",
"privacy-policy": "datenschutz",
"terms": "terms",
"contact": "contact",
"terms": "agbs",
"contact": "kontakt",
"team": "team",
"blog": "blog",
"products": "products",
"products": "produkte",
"start": "start",
"thanks": "thanks",
"low-voltage-cables": "low-voltage-cables",

View File

@@ -33,8 +33,14 @@ describe('Contact Form E2E', () => {
it('should submit the contact form and show success message', async ({ skip }) => {
if (!isServerUp) skip();
page.on('console', (msg) => console.log('PAGE LOG:', msg.text()));
page.on('pageerror', (err) => console.error('PAGE ERROR:', err.message));
await page.goto(`${BASE_URL}/de/kontakt`);
// Wait for Next.js hydration to complete
await new Promise((resolve) => setTimeout(resolve, 3000));
// Fill the form
await page.waitForSelector('input[name="name"]');
await page.type('input[name="name"]', 'E2E Tester');
@@ -45,7 +51,7 @@ describe('Contact Form E2E', () => {
await page.click('button[type="submit"]');
// Wait for success message (localized or generic)
await page.waitForSelector('[role="alert"]', { timeout: 10000 });
await page.waitForSelector('[role="alert"]', { timeout: 15000 });
const text = await page.evaluate(() => document.body.innerText);
expect(text).toMatch(/Gesendet|Sent|Erfolgreich|Success/i);

View File

@@ -21,6 +21,30 @@ describe('getPageBySlug translation routing', () => {
expect(page?.frontmatter.title).toBe('Datenschutzerklärung');
});
it('should resolve translated slug "kontakt" for German', async () => {
const page = await getPageBySlug('kontakt', 'de');
expect(page).not.toBeNull();
expect(page?.frontmatter.title).toBe('Kontakt');
});
it('should resolve translated slug "contact" for English', async () => {
const page = await getPageBySlug('contact', 'en');
expect(page).not.toBeNull();
expect(page?.frontmatter.title).toBe('Kontakt');
});
it('should resolve translated slug "produkte" for German', async () => {
const page = await getPageBySlug('produkte', 'de');
expect(page).not.toBeNull();
expect(page?.frontmatter.title).toBe('Produkte');
});
it('should resolve translated slug "products" for English', async () => {
const page = await getPageBySlug('products', 'en');
expect(page).not.toBeNull();
expect(page?.frontmatter.title).toBe('Produkte');
});
it('should return null for non-existent slugs', async () => {
const page = await getPageBySlug('does-not-exist', 'de');
expect(page).toBeNull();