Add .prettierrc.json and refactor test files for improved formatting consistency:

- Introduced `.prettierrc.json` to enforce consistent code formatting across the project.
- Updated unit and e2e test files to address formatting issues, improve readability, and ensure alignment with the new Prettier configuration.
This commit is contained in:
Jeppe Bundgaard
2026-04-13 09:13:27 +02:00
parent f040614f46
commit b39b458f4f
149 changed files with 7212 additions and 6178 deletions
+30 -34
View File
@@ -1,80 +1,76 @@
import { test, expect } from '@playwright/test';
import {
loginAsUser,
bookingTestData,
} from './fixtures';
import { test, expect } from "@playwright/test";
import { loginAsUser, bookingTestData } from "./fixtures";
/** User bookings Tests */
test('[PAGES][User][/user/bookings] should load the page', async ({ page }) => {
test("[PAGES][User][/user/bookings] should load the page", async ({ page }) => {
await loginAsUser(page);
await page.goto('/user/bookings');
await page.goto("/user/bookings");
await expect(page).toHaveURL(/user\/bookings/);
});
// User bookings page content tests
test('[PAGES][User][/user/bookings] should display the title', async ({ page }) => {
test("[PAGES][User][/user/bookings] should display the title", async ({ page }) => {
await loginAsUser(page);
await page.goto('/user/bookings');
await page.goto("/user/bookings");
// Check if title contains 'Oversigt over bookinger'
await expect(page.locator('.title')).toContainText('Oversigt over bookinger');
await expect(page.locator(".title")).toContainText("Oversigt over bookinger");
});
// Verify booking appears in list after creation (integrates userBookWash flow)
test('[BOOKINGS][User][List] should show created booking after book wash flow', async ({ page }) => {
test("[BOOKINGS][User][List] should show created booking after book wash flow", async ({ page }) => {
const { departmentId, registrationNumber, reference, poNumber, notes } = bookingTestData;
await loginAsUser(page);
// Book wash button on home/dashboard
await page.click('#book-wash-button');
await expect(page).toHaveURL('/user/bookings/book');
await page.click("#book-wash-button");
await expect(page).toHaveURL("/user/bookings/book");
// Select department
const department_select_id = `#department-option-${departmentId}`;
await page.click(department_select_id);
// Registration number
await page.click('#reg1-button');
await page.fill('#reg1-input', registrationNumber);
await page.press('#reg1-input', 'Enter');
await page.click("#reg1-button");
await page.fill("#reg1-input", registrationNumber);
await page.press("#reg1-input", "Enter");
// Next
await page.click('button:has-text("Næste trin")');
// Select product
await page.waitForSelector('.pos-product-box');
await page.locator('.pos-product-box').first().click();
await page.waitForSelector(".pos-product-box");
await page.locator(".pos-product-box").first().click();
// Reference
await page.click('button:has-text("Tilføj reference")');
await page.fill('#reference', reference);
await page.press('#reference', 'Enter');
await page.fill("#reference", reference);
await page.press("#reference", "Enter");
// PO
await page.click('button:has-text("Tilføj PO nummer")');
await page.fill('#poNumber', poNumber);
await page.press('#poNumber', 'Enter');
await page.fill("#poNumber", poNumber);
await page.press("#poNumber", "Enter");
// Notes
await page.click('button:has-text("Tilføj note")');
await page.fill('#notes', notes);
await page.press('#notes', 'Enter');
await page.fill("#notes", notes);
await page.press("#notes", "Enter");
// Pickup
await page.check('#pickup');
await page.check("#pickup");
// Confirmation
await page.click('#go-to-confirmation-button');
await expect(page.locator('#booking-summary-title')).toBeVisible();
await page.click("#go-to-confirmation-button");
await expect(page.locator("#booking-summary-title")).toBeVisible();
// Confirm
await page.click('#confirm-booking-button', { force: true });
await page.click("#confirm-booking-button", { force: true });
await expect(page).toHaveURL(/\/user/);
// Verify in list
await page.waitForLoadState('networkidle');
await page.goto('/user/bookings');
await expect(page.locator('text=' + registrationNumber).nth(1)).toBeVisible();
await expect(page.locator('text=' + reference).nth(1)).toBeVisible();
});
await page.waitForLoadState("networkidle");
await page.goto("/user/bookings");
await expect(page.locator("text=" + registrationNumber).nth(1)).toBeVisible();
await expect(page.locator("text=" + reference).nth(1)).toBeVisible();
});