- 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
22 lines
1018 B
JavaScript
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 });
|
|
}
|
|
});
|
|
});
|