Fix nav selectors (Erfassen), shared auth via global-setup to avoid login rate limits, and desktop sidebar viewport handling. Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
972 B
JavaScript
24 lines
972 B
JavaScript
const { expect } = require('@playwright/test');
|
|
|
|
const TEST_EMAIL = process.env.TEST_EMAIL || 'lars@stommer.com';
|
|
const TEST_PASSWORD = process.env.TEST_PASSWORD || '5112';
|
|
|
|
/** Nutzt storageState aus global-setup; nur für Tests nötig, die explizit Login prüfen. */
|
|
async function loginViaForm(page) {
|
|
await page.goto('/');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.fill('input[type="email"]', TEST_EMAIL);
|
|
await page.fill('input[type="password"]', TEST_PASSWORD);
|
|
await page.click('button:has-text("Anmelden")');
|
|
await page.waitForLoadState('networkidle');
|
|
await expect(page.locator('button:has-text("Anmelden")')).toHaveCount(0, { timeout: 15000 });
|
|
}
|
|
|
|
async function clickBottomNav(page, label) {
|
|
const link = page.locator('nav.bottom-nav a.nav-item').filter({ hasText: label });
|
|
await expect(link).toBeVisible({ timeout: 10000 });
|
|
await link.click();
|
|
}
|
|
|
|
module.exports = { TEST_EMAIL, TEST_PASSWORD, loginViaForm, clickBottomNav };
|