feat: complete MDX migration, stabilize environment & verify via E2E tests

Former-commit-id: ec3e64156a2e182535cbdcf0d975cd54603a517d
This commit is contained in:
2026-05-03 18:46:41 +02:00
parent e57661a586
commit b13f628b55
131 changed files with 1388 additions and 25288 deletions

View File

@@ -1,11 +1,11 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import puppeteer, { Browser, Page } from 'puppeteer';
describe('E2E Navigation & Content', () => {
describe('E2E Navigation & Content (MDX Architecture)', () => {
let browser: Browser;
let page: Page;
const BASE_URL = 'http://etib.localhost';
const BASE_URL = 'http://localhost:3010';
beforeAll(async () => {
browser = await puppeteer.launch({
@@ -13,7 +13,6 @@ describe('E2E Navigation & Content', () => {
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
page = await browser.newPage();
// Set viewport for a desktop view
await page.setViewport({ width: 1280, height: 800 });
});
@@ -23,44 +22,68 @@ describe('E2E Navigation & Content', () => {
}
});
it('should load the homepage and display core content in German (default)', async () => {
const response = await page.goto(`${BASE_URL}/de`, { waitUntil: 'networkidle0' });
it('should load the homepage in German', async () => {
const response = await page.goto(`${BASE_URL}/de`, { waitUntil: 'networkidle2' });
expect(response?.status()).toBe(200);
// Check if a standard element like h1 is present
const h1Text = await page.evaluate(() => document.querySelector('h1')?.textContent);
expect(h1Text).toBeTruthy();
// Check for specific German text that should be seeded from CMS
const bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('ENERGIE & KOMMUNIKATION VERNETZEN');
expect(bodyText).toContain('Kontakt');
expect(bodyText).toContain('DIE EXPERTEN FÜR KABELTIEFBAU');
});
it('should switch language to English and display translated content', async () => {
await page.goto(`${BASE_URL}/en`, { waitUntil: 'networkidle0' });
// Wait for language to change
const htmlLang = await page.evaluate(() => document.documentElement.lang);
expect(htmlLang).toBe('en');
// Check for specific English text from CMS
it('should load the "Über uns" page and show MDX content', async () => {
await page.goto(`${BASE_URL}/de/ueber-uns`, { waitUntil: 'networkidle2' });
const bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('NETWORKING ENERGY & COMMUNICATION');
expect(bodyText).toContain('COMPANY');
expect(bodyText).toContain('Die E-TIB Gruppe steht für höchste Qualität');
expect(bodyText).toContain('E-TIB Bohrtechnik GmbH');
});
it('should load the contact page and verify the map/form presence', async () => {
const response = await page.goto(`${BASE_URL}/de/contact`, { waitUntil: 'networkidle0' });
expect(response?.status()).toBe(200);
// Verify that the page contains contact-specific elements
it('should load the competencies page in English', async () => {
await page.goto(`${BASE_URL}/en/competencies`, { waitUntil: 'networkidle2' });
const bodyText = await page.evaluate(() => document.body.innerText);
// E-TIB specific contact info
expect(bodyText).toContain('E-TIB');
// Check if form is present
const formExists = await page.evaluate(() => document.querySelector('form') !== null);
expect(formExists).toBe(true);
expect(bodyText).toContain('Drilling Technology (HDD)');
expect(bodyText).toContain('horizontal directional drilling');
});
it('should load the careers page and show job listings', async () => {
await page.goto(`${BASE_URL}/de/karriere`, { waitUntil: 'networkidle2' });
const bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Karriere bei E-TIB');
expect(bodyText).toContain('Tiefbaufacharbeiter');
});
it('should verify the imprint, privacy and terms pages (MDX)', async () => {
// Imprint
await page.goto(`${BASE_URL}/de/impressum`, { waitUntil: 'networkidle2' });
let bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Angaben gemäß § 5 TMG');
expect(bodyText).toContain('Danny Joseph');
// Privacy
await page.goto(`${BASE_URL}/en/privacy-policy`, { waitUntil: 'networkidle2' });
bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Privacy at a Glance');
expect(bodyText).toContain('Umami Analytics');
// Terms (AGB)
await page.goto(`${BASE_URL}/de/agb`, { waitUntil: 'networkidle2' });
bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Allgemeine Geschäftsbedingungen');
expect(bodyText).toContain('Geltungsbereich');
});
it('should verify blog listing and post loading', async () => {
await page.goto(`${BASE_URL}/de/blog`, { waitUntil: 'networkidle2', timeout: 60000 });
let bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Moderne Verfahren im Kabeltiefbau');
// Click on the first article (if found) or navigate directly
await page.goto(`${BASE_URL}/de/blog/moderne-verfahren-kabeltiefbau`, { waitUntil: 'networkidle2', timeout: 60000 });
bodyText = await page.evaluate(() => document.body.innerText);
expect(bodyText).toContain('Horizontalspülbohrung (HDD)');
});
it('should handle non-existent routes with a 404', async () => {
const response = await page.goto(`${BASE_URL}/de/irgendwas-falsches`, { waitUntil: 'networkidle2' });
expect(response?.status()).toBe(404);
});
});