- Updated `auth.setup.ts` to handle multiple app launches in Workspace and ensure proper redirection to the dashboard. - Improved invoice creation tests in `export-flow.spec.ts` and `invoice-flow.spec.ts` to check for existing exchange rates before creating new ones, and adjusted button names for consistency. - Refactored selectors to use placeholders for invoice number inputs across multiple test files. - Enhanced error handling and visibility checks in various test scenarios to improve reliability. - Removed obsolete `setup-catalogs.spec.ts` file as its functionality is no longer needed. These changes aim to streamline the testing process and ensure more robust interactions with the application.
79 lines
3.3 KiB
TypeScript
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()
|
|
})
|
|
|
|
})
|
|
|
|
}) |