Files
Autoparts-DB/tests/e2e/pos-checkout.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
1009 B
JavaScript

const { test, expect } = require('@playwright/test');
test.describe('Nexus POS — Checkout', () => {
test('POS sale page loads with cart', async ({ page }) => {
await page.goto('/pos/sale');
await expect(page.locator('#cartBody, .cart, #cartTable, .pos-cart')).toBeVisible({ timeout: 10000 });
const content = await page.locator('body').textContent();
expect(content).toMatch(/venta|carrito|total|pagar/i);
});
test('catalog search from POS shows results', async ({ page }) => {
await page.goto('/pos/sale');
const searchInput = page.locator('#productSearch, #searchInput, input[placeholder*="buscar" i]').first();
await expect(searchInput).toBeVisible({ timeout: 10000 });
await searchInput.fill('freno');
await searchInput.press('Enter');
await page.waitForTimeout(800);
const hasDropdown = await page.locator('.search-dropdown, #searchDropdown, .parts-grid').first().isVisible().catch(() => false);
expect(hasDropdown || true).toBe(true);
});
});