import { expect, test } from '@playwright/test'; /** * Onboarding wiring: as admin A, add a new family member with email + * "send invitation" checked, verify the invitation banner mounts with a * copy-link, and then clean up so the suite stays idempotent — revoke * the pending invitation, then permanently delete the member from its * detail page (a member with a pending invitation can't be deleted, so * the order matters). * * Email delivery is disabled in the test environment, so this exercises * the row-creation path without actually sending anything. */ test('admin invites a new member; revoke + delete cleans up after', async ({ page }) => { // Both the revoke action and the member-detail "Eliminar" use // window.confirm — accept everything that fires during this spec. page.on('dialog', (dialog) => dialog.accept()); const ts = Date.now(); const memberName = `E2E Invite ${ts}`; const memberEmail = `e2e-invite-${ts}@familynido.test`; // ── A: open /nido and submit the add-member form ─────────────────────── await page.goto('/nido'); // The round "+" button uses aria-label="Añadir miembro". await page.getByRole('button', { name: /^añadir miembro$/i }).click(); // Labels on this form aren't wired with `for=`, so target inputs by // type/required attributes within the visible