- 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
21 lines
783 B
JavaScript
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();
|
|
});
|
|
});
|