import { test, expect } from '@playwright/test'; import { signUp, logIn, newEmail } 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('#logout')).toBeVisible(); await expect(page.locator('#profile')).toContainText('E2E Tester'); await page.click('#logout'); await expect(page.locator('#login')).toBeVisible(); await logIn(page, email); await expect(page.locator('#logout')).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(page.locator('#signUpSubmit')).toBeDisabled(); }); test('a wrong password does not sign anybody in', async ({ page }) => { const email = newEmail(); await signUp(page, email); await page.click('#logout'); await logIn(page, email, 'not-the-password'); await expect(page.locator('#loginSubmit')).toBeVisible(); await expect(page.locator('#logout')).toHaveCount(0); }); test('the private zones page sends anonymous visitors to the login', async ({ page }) => { await page.goto('/subscriptions'); await expect(page.locator('#loginSubmit')).toBeVisible(); }); });