import { test, expect } from '@playwright/test'; import { signUp, logIn, newEmail, NAV, botonRegistro, botonEntrar } from '../support/app.js'; test.describe('registro y acceso', () => { test('a new account can sign up, log out and log back in', async ({ page }) => { const email = newEmail(); await signUp(page, email); // Signed in: the navbar swaps the login links for the profile and logout ones. await expect(page.locator(NAV.salir)).toBeVisible(); await expect(page.locator(NAV.perfil)).toContainText('E2E Tester'); await page.locator(NAV.salir).click(); await expect(page.locator(NAV.entrar)).toBeVisible(); await logIn(page, email); await expect(page.locator(NAV.salir)).toBeVisible(); }); test('signing up is refused without accepting the terms', async ({ page }) => { await page.goto('/signup'); await page.fill('input[name=firstName]', 'E2E'); await page.fill('input[name=lastName]', 'Tester'); await page.fill('input[name=emailAddress]', newEmail()); await page.fill('input[name=password]', 'password'); await expect(botonRegistro(page)).toBeDisabled(); }); test('a wrong password does not sign anybody in', async ({ page }) => { const email = newEmail(); await signUp(page, email); await page.locator(NAV.salir).click(); await logIn(page, email, 'not-the-password'); await expect(botonEntrar(page)).toBeVisible(); await expect(page.locator(NAV.salir)).toHaveCount(0); }); test('the private zones page sends anonymous visitors to the login', async ({ page }) => { await page.goto('/subscriptions'); await expect(botonEntrar(page)).toBeVisible(); }); });