Files
pleno-vue/tests/e2e/userProfileNotifications.spec.ts
T
Jeppe Bundgaard 983585ede7 Refactor and cleanup:
- Migrate postinstall script to `postinstall-sync-playwright-root-links.mjs` for streamlined path resolution.
- Replace `axios` v1.15.0 with v1.13.5 and downgrade `vite` from v8.0.5 to v7.1.11.
- Update testing code for consistent formatting and enhanced readability (e.g., `poll` and `catch` calls).
- Remove unused or redundant dependency flags and align `package-lock.json` with new configuration.
2026-04-14 14:17:28 +02:00

42 lines
1.8 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { loginAsUser } from "./fixtures";
async function openUserNotifications(page) {
await loginAsUser(page);
await page.goto("/user/profile");
const notificationsCard = page.getByTestId("user-profile-notifications-card");
await expect(notificationsCard).toBeVisible();
await notificationsCard.locator(".card-header").click();
await expect(page.getByTestId("user-profile-notifications-edit-booking-email")).toBeVisible();
}
test("[PROFILE][User][Notifications] renders the current notification controls", async ({ page }) => {
await openUserNotifications(page);
await expect(page.getByTestId("user-profile-notifications-edit-booking-email")).toBeVisible();
await expect(page.getByTestId("user-profile-notifications-edit-sms-phone")).toBeVisible();
await expect(
page.getByTestId("user-profile-notifications-email-switch").locator('input[type="checkbox"]')
).toBeVisible();
await expect(
page.getByTestId("user-profile-notifications-sms-switch").locator('input[type="checkbox"]')
).toBeVisible();
});
test("[PROFILE][User][Notifications] opens the booking-email dialog", async ({ page }) => {
await openUserNotifications(page);
await page.getByTestId("user-profile-notifications-edit-booking-email").click();
await expect(page.locator(".swal2-popup")).toBeVisible();
await expect(page.locator(".swal2-input")).toBeVisible();
});
test("[PROFILE][User][Notifications] validates booking-email input", async ({ page }) => {
await openUserNotifications(page);
await page.getByTestId("user-profile-notifications-edit-booking-email").click();
await page.fill(".swal2-input", "invalid-email");
await page.click(".swal2-confirm");
await expect(page.locator(".swal2-validation-message")).toBeVisible();
});