50 lines
1.8 KiB
TypeScript
50 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.goto("/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();
|
|
});
|