You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
senzapaura_es/e2e/jukebox.e2e.ts

44 lines
1.8 KiB

import { expect, test } from '@playwright/test';
test.describe('Juke-box', () => {
test('está junto al carrito y no dentro del menú editorial', async ({ page }) => {
await page.goto('/juke-box');
await page.locator('html[data-hidratado]').waitFor();
const cabecera = page.getByRole('banner');
const jukebox = cabecera.getByRole('link', { name: 'Juke-box' });
const carrito = cabecera.getByRole('link', { name: /Carrito/ });
await expect(jukebox).toBeVisible();
await expect(carrito).toBeVisible();
await expect(page.locator('header .cuenta > .jukebox + .carrito')).toHaveCount(1);
await expect(
cabecera.getByRole('navigation', { name: 'Principal' }).getByText('Juke-box')
).toHaveCount(0);
});
test('una cuenta sin prestación no puede utilizar los controles', async ({ page }) => {
await page.goto('/juke-box');
await page.locator('html[data-hidratado]').waitFor();
await expect(page.getByRole('heading', { level: 1, name: 'Juke-box' })).toBeVisible();
await expect(page.getByText('Acceso reservado')).toBeVisible();
await expect(page.getByRole('button', { name: /Activar piloto automático/ })).toHaveCount(0);
await expect(page.getByRole('link', { name: 'Ver suscripciones' })).toBeVisible();
await page.getByRole('link', { name: 'Entrar', exact: true }).last().click();
await expect(page.getByRole('dialog', { name: 'Entrar o crear cuenta' })).toBeVisible();
await expect(page).toHaveURL('/juke-box');
});
test('no desborda en una pantalla estrecha', async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('/juke-box');
await page.locator('html[data-hidratado]').waitFor();
await expect(page.getByRole('heading', { level: 1, name: 'Juke-box' })).toBeVisible();
expect(
await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)
).toBe(true);
});
});

Powered by TurnKey Linux.