feat: scaffold operator-first 3proxy panel ui
This commit is contained in:
30
src/App.test.tsx
Normal file
30
src/App.test.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import App from './App';
|
||||
|
||||
describe('App login gate', () => {
|
||||
it('rejects wrong hardcoded credentials and keeps the panel locked', async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<App />);
|
||||
|
||||
await user.type(screen.getByLabelText(/login/i), 'admin');
|
||||
await user.type(screen.getByLabelText(/password/i), 'wrong-pass');
|
||||
await user.click(screen.getByRole('button', { name: /open panel/i }));
|
||||
|
||||
expect(screen.getByText(/wrong panel credentials/i)).toBeInTheDocument();
|
||||
expect(screen.queryByRole('navigation', { name: /primary/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('unlocks the panel with the configured credentials', async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<App />);
|
||||
|
||||
await user.type(screen.getByLabelText(/login/i), 'admin');
|
||||
await user.type(screen.getByLabelText(/password/i), 'proxy-ui-demo');
|
||||
await user.click(screen.getByRole('button', { name: /open panel/i }));
|
||||
|
||||
expect(screen.getByRole('navigation', { name: /primary/i })).toBeInTheDocument();
|
||||
expect(screen.getByText(/operator panel/i)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user