test(e2e): add Playwright smoke tests for catalog, inventory, checkout, auth

- catalog.spec.js: brand grid loads, search interaction
- inventory.spec.js: table loads, detail modal opens
- pos-checkout.spec.js: cart visible, catalog search from POS
- auth-guard.spec.js: unauthenticated redirect to login
This commit is contained in:
2026-04-29 07:10:34 +00:00
parent 3792e4053c
commit 45b69bcae8
4 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
const { test, expect } = require('@playwright/test');
test.describe('Nexus POS — Inventory', () => {
test('inventory page loads with table or grid', async ({ page }) => {
await page.goto('/pos/inventory');
await expect(page.locator('#inventoryTable, .data-table, #partsGrid, .grid, table')).toBeVisible({ timeout: 10000 });
const content = await page.locator('body').textContent();
expect(content).toMatch(/inventario|stock|producto|parte/i);
});
test('product detail modal or panel opens', async ({ page }) => {
await page.goto('/pos/inventory');
// Try clicking first row or card
const firstRow = page.locator('.data-table tbody tr, .grid .card, .inventory-row').first();
await firstRow.waitFor({ state: 'visible', timeout: 10000 }).catch(() => {});
if (await firstRow.isVisible().catch(() => false)) {
await firstRow.click();
await expect(page.locator('.modal, .detail-panel, #detailPanel, [role="dialog"]')).toBeVisible({ timeout: 5000 });
}
});
});