- 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.
108 lines
3.7 KiB
TypeScript
108 lines
3.7 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('Modulos', () => {
|
|
|
|
test.describe('Import Invoices', () => {
|
|
|
|
test('factura TEM carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/invoices?operation_type=imp&invoice_type=TEM')
|
|
await expect(page).toHaveURL(/invoices/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
test('factura DEF carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/invoices?operation_type=imp&invoice_type=DEF')
|
|
await expect(page).toHaveURL(/invoices/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Export Invoices', () => {
|
|
|
|
test('exportacion carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/invoices?operation_type=exp')
|
|
await expect(page).toHaveURL(/invoices/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Fixed Catalogs', () => {
|
|
|
|
test('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()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('General Catalogs', () => {
|
|
|
|
test('company information carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/general_catalogs/company_information')
|
|
await expect(page).toHaveURL(/company_information/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Transportes', () => {
|
|
|
|
test('transporters carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/general_catalogs/transporters')
|
|
await expect(page).toHaveURL(/transporters/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Goods', () => {
|
|
|
|
test('fixed asset classes carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/goods/fixed-asset-classes')
|
|
await expect(page).toHaveURL(/goods/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Settings', () => {
|
|
|
|
test('general carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/settings/general')
|
|
await expect(page).toHaveURL(/settings/)
|
|
await expect(page.locator('body')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Reportes', () => {
|
|
|
|
test('invoices carga sin error', async ({ page }) => {
|
|
await page.goto('/dashboard/reports/invoices')
|
|
await expect(page).toHaveURL(/reports/)
|
|
await expect(page.locator('main')).toBeVisible()
|
|
})
|
|
|
|
})
|
|
|
|
test.describe('Logout', () => {
|
|
|
|
test('cerrar sesion redirige a login', async ({ page }) => {
|
|
await page.goto('/dashboard')
|
|
await page.waitForLoadState('networkidle')
|
|
// Abrir el dropdown del usuario; el trigger es un Sidebar.MenuButton que
|
|
// puede no responder al click central → forzar con teclado.
|
|
const userBtn = page.getByRole('button').filter({ hasText: '@' }).first()
|
|
await userBtn.focus()
|
|
await page.keyboard.press('Enter')
|
|
// El menú está parcialmente en inglés ("Log out").
|
|
await page.getByRole('menuitem', { name: /Log out|Cerrar sesión/i }).click({ timeout: 10000 })
|
|
await expect(page).toHaveURL(/(login|workspace\.aduanasoft\.com)/, { timeout: 15000 })
|
|
})
|
|
|
|
})
|
|
|
|
}) |