Files
pleno-vue/tests/e2e/userProfileInvoicing.spec.ts
T
Jeppe Bundgaard 60742bf947 Refactor and migrate Playwright E2E tests:
- Remove `playwright.config.js` to clean up configuration.
- Add new E2E test suites (`admin-pos-orders`, `admin-module-goals`, `admin-module-pos-mobile-order-flow`) to structure Admin module tests.
- Introduce reusable authentication and data seeding utilities in `fixtures` for streamlined test flows and maintainability.
2026-03-19 12:46:47 +01:00

53 lines
1.8 KiB
TypeScript

import { test, expect } from '@playwright/test';
import {
userCredentials,
loginAsUser,
} from './fixtures';
// Navigate to profile page helper
async function goToUserProfile(page) {
await page.click('a[href="/user/profile"]');
await expect(page).toHaveURL('/user/profile');
}
// Helper to expand a category section by clicking its header
async function expandCategory(page, categoryText: string) {
const categoryHeader = page.locator('.card-header').filter({ hasText: categoryText }).first();
await categoryHeader.click();
// Wait for expansion animation
await page.waitForTimeout(200);
}
// Customer invoice information display tests
test('[PROFILE][User][Invoicing] should display customer invoice information section', async ({ page }) => {
await loginAsUser(page);
await goToUserProfile(page);
// Should display the invoicing section header
await expect(page.locator('.card-header').filter({ hasText: 'Fakturaoplysninger' })).toBeVisible();
});
test('[PROFILE][User][Invoicing] should display customer name', async ({ page }) => {
await loginAsUser(page);
await goToUserProfile(page);
// Expand the invoicing section
await expandCategory(page, 'Fakturaoplysninger');
// Customer name field should be visible and disabled
const customerNameInput = page.locator('.card-content input[disabled]').first();
await expect(customerNameInput).toBeVisible();
});
test('[PROFILE][User][Invoicing] should display customer number', async ({ page }) => {
await loginAsUser(page);
await goToUserProfile(page);
// Expand the invoicing section
await expandCategory(page, 'Fakturaoplysninger');
// Customer number field should be visible (look for the input containing the customer number)
const customerNumberInput = page.locator('.card-content input[disabled]').nth(1);
await expect(customerNumberInput).toBeVisible();
});