Files
Autoparts-DB/tests/e2e/inventory.spec.js
consultoria-as 45b69bcae8 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
2026-04-29 07:10:34 +00:00

22 lines
1018 B
JavaScript

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 });
}
});
});