Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 43s
Build & Deploy / 🧪 QA (push) Successful in 1m31s
Build & Deploy / 🏗️ Build (push) Has been cancelled
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Applied globally across MDX content, translations, and UI components including English analog terms (Cable Trenching -> Cable Network Construction).
109 lines
4.8 KiB
TypeScript
109 lines
4.8 KiB
TypeScript
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
import puppeteer, { Browser, Page } from 'puppeteer';
|
|
|
|
describe('E2E Navigation & Content (MDX Architecture)', () => {
|
|
let browser: Browser;
|
|
let page: Page;
|
|
|
|
const BASE_URL = 'http://localhost:3010';
|
|
|
|
beforeAll(async () => {
|
|
browser = await puppeteer.launch({
|
|
headless: true,
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
});
|
|
page = await browser.newPage();
|
|
await page.setViewport({ width: 1280, height: 800 });
|
|
});
|
|
|
|
afterAll(async () => {
|
|
if (browser) {
|
|
await browser.close();
|
|
}
|
|
});
|
|
|
|
it('should load the homepage in German', async () => {
|
|
const response = await page.goto(`${BASE_URL}/de`, { waitUntil: 'networkidle2' });
|
|
expect(response?.status()).toBe(200);
|
|
|
|
const bodyText = await page.evaluate(() => document.body.innerText);
|
|
expect(bodyText).toContain('DIE EXPERTEN FÜR KABELTIEFBAU');
|
|
});
|
|
|
|
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('Die E-TIB Gruppe steht für höchste Qualität');
|
|
expect(bodyText).toContain('E-TIB Bohrtechnik GmbH');
|
|
});
|
|
|
|
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);
|
|
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 Kabelnetzbau');
|
|
|
|
// 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);
|
|
});
|
|
|
|
it('should verify contact form submission', async () => {
|
|
await page.goto(`${BASE_URL}/de/kontakt`, { waitUntil: 'load', timeout: 120000 });
|
|
|
|
// Fill out the form
|
|
await page.type('input[name="name"]', 'Test User');
|
|
await page.type('input[name="email"]', 'testing@mintel.me');
|
|
await page.type('textarea[name="message"]', 'This is a test message from E2E suite.');
|
|
|
|
// Submit the form
|
|
await page.click('button[type="submit"]');
|
|
|
|
// Wait for success indicator (using content as proxy for success state)
|
|
await page.waitForNetworkIdle();
|
|
const bodyText = await page.evaluate(() => document.body.innerText);
|
|
|
|
// The form should show a success message
|
|
expect(bodyText).toContain('Vielen Dank!');
|
|
}, 120000);
|
|
});
|