diff --git a/messages/de.json b/messages/de.json index 37d4e5ba..d7761fe6 100644 --- a/messages/de.json +++ b/messages/de.json @@ -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", diff --git a/messages/en.json b/messages/en.json index c92a9459..14ef9f14 100644 --- a/messages/en.json +++ b/messages/en.json @@ -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", diff --git a/tests/contact-form.e2e.test.ts b/tests/contact-form.e2e.test.ts index 4e126536..84d75e2a 100644 --- a/tests/contact-form.e2e.test.ts +++ b/tests/contact-form.e2e.test.ts @@ -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); diff --git a/tests/pages.test.ts b/tests/pages.test.ts index 75cf9b77..25c9004d 100644 --- a/tests/pages.test.ts +++ b/tests/pages.test.ts @@ -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();