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:
21
tests/e2e/inventory.spec.js
Normal file
21
tests/e2e/inventory.spec.js
Normal 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 });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user