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,20 @@
const { test, expect } = require('@playwright/test');
test.describe('Nexus POS — Auth Guard', () => {
test('unauthenticated user is redirected to login', async ({ browser }) => {
// Create incognito context without localStorage
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/pos/sale');
await expect(page).toHaveURL(/\/pos\/login/);
await context.close();
});
test('login page is accessible without token', async ({ browser }) => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('/pos/login');
await expect(page.locator('input[type="password"], #password, input[name="pin"]')).toBeVisible();
await context.close();
});
});