Files
Autoparts-DB/tests/e2e/auth-guard.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

21 lines
783 B
JavaScript

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