- 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.
80 lines
2.6 KiB
TypeScript
80 lines
2.6 KiB
TypeScript
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 }) => {
|
|
await loginAsUser(page);
|
|
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 }) => {
|
|
await loginAsUser(page);
|
|
await page.goto('/user/bookings');
|
|
// Check if title contains '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 }) => {
|
|
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');
|
|
|
|
// 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');
|
|
|
|
// 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();
|
|
|
|
// Reference
|
|
await page.click('button:has-text("Tilføj reference")');
|
|
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');
|
|
|
|
// Notes
|
|
await page.click('button:has-text("Tilføj note")');
|
|
await page.fill('#notes', notes);
|
|
await page.press('#notes', 'Enter');
|
|
|
|
// Pickup
|
|
await page.check('#pickup');
|
|
|
|
// Confirmation
|
|
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 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();
|
|
}); |