Files
plantillas-proyectos/frontend/e2e/navigation.spec.ts
Kevin_Ramirez bdd089954b
Some checks failed
Build Producción & Push a Harbor / test (push) Failing after 3s
Build Producción & Push a Harbor / build (push) Has been skipped
Aduanasoft/plantillas-proyectos/pipeline/head There was a failure building this commit
feat: plantilla base workspace SaaS
2026-07-21 13:59:00 -05:00

79 lines
3.3 KiB
TypeScript

import { test, expect } from '@playwright/test'
test.describe('Navegacion', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/dashboard')
})
test('dashboard carga con saludo', async ({ page }) => {
await expect(page.locator('h1')).toBeVisible()
})
test('header muestra nombre de la empresa', async ({ page }) => {
await page.waitForLoadState('networkidle')
// El nombre exacto depende de la empresa activa; aceptar cualquier nombre no vacío en el botón del sidebar
await expect(page.locator('[data-sidebar]').getByRole('button').first())
.toBeVisible({ timeout: 10000 })
})
test.describe('Menu lateral', () => {
// El sidebar tiene links directos y grupos plegables que cargan según permisos.
// Verificamos que aparezcan los textos en alguna parte del menú (botón o link).
test('tiene Bitácora en el menu', async ({ page }) => {
await page.waitForLoadState('networkidle')
await expect(page.getByRole('link', { name: 'Bitácora' }).or(
page.getByRole('button', { name: 'Bitácora' })
).first()).toBeVisible({ timeout: 10000 })
})
test('tiene Agentes Aduanales en el menu', async ({ page }) => {
await page.waitForLoadState('networkidle')
await expect(page.getByRole('link', { name: 'Agentes Aduanales' })).toBeVisible({ timeout: 10000 })
})
test('Fracciones aparece en el menu', async ({ page }) => {
await page.waitForLoadState('networkidle')
await expect(page.getByText('Fracciones').first()).toBeVisible({ timeout: 10000 })
})
test('Pedimentos aparece en el menu', async ({ page }) => {
await page.waitForLoadState('networkidle')
// "Pedimentos" aparece como botón top-level del sidebar (no como sub-items plegados).
await expect(page.getByRole('button', { name: /^Pedimentos$/ }).first())
.toBeVisible({ timeout: 10000 })
})
})
test.describe('Modulos accesibles', () => {
// Navegamos directo por URL — el menú lateral es dinámico y no garantiza link visible.
test('Bitácora carga sin error', async ({ page }) => {
await page.goto('/dashboard/audit_logs')
await expect(page).toHaveURL(/audit/)
await expect(page.locator('h1')).toBeVisible()
})
test('Agentes Aduanales carga sin error', async ({ page }) => {
await page.goto('/dashboard/customs_brokers')
await expect(page).toHaveURL(/customs/)
await expect(page.locator('h1')).toBeVisible()
})
test('Fraction Sitar carga sin error', async ({ page }) => {
await page.goto('/dashboard/general_catalogs/tariff-fractions/sitar')
await expect(page).toHaveURL(/tariff-fractions/)
await expect(page.locator('main')).toBeVisible()
})
test('Pedimentos carga sin error', async ({ page }) => {
await page.goto('/dashboard/reference_data/code_pedimento_regimens')
await expect(page).toHaveURL(/reference_data/)
await expect(page.locator('main')).toBeVisible()
})
})
})