feat: create test data definitions and fixtures for e2e workflows
This commit is contained in:
154
frontend/e2e/fixtures/test-data.ts
Normal file
154
frontend/e2e/fixtures/test-data.ts
Normal file
@@ -0,0 +1,154 @@
|
||||
// Test user definitions for LDAP and local authentication
|
||||
export const LDAP_USERS = {
|
||||
valid: {
|
||||
username: 'testuser1',
|
||||
password: 'Password123!',
|
||||
email: 'testuser1@ainventory.local',
|
||||
},
|
||||
invalid: {
|
||||
username: 'invalid_user',
|
||||
password: 'wrong_password',
|
||||
},
|
||||
};
|
||||
|
||||
export const LOCAL_USERS = {
|
||||
admin: {
|
||||
username: 'admin',
|
||||
password: 'AdminPassword123!',
|
||||
email: 'admin@ainventory.local',
|
||||
},
|
||||
regular: {
|
||||
username: 'testuser2',
|
||||
password: 'UserPassword123!',
|
||||
email: 'testuser2@ainventory.local',
|
||||
},
|
||||
};
|
||||
|
||||
// Test inventory items for scanning and AI extraction workflows
|
||||
export const TEST_ITEMS = [
|
||||
{
|
||||
name: 'Widget A',
|
||||
barcode: '123456789',
|
||||
part_number: 'WA-001',
|
||||
category: 'Electronics',
|
||||
quantity: 50,
|
||||
},
|
||||
{
|
||||
name: 'Widget B',
|
||||
barcode: '987654321',
|
||||
part_number: 'WB-001',
|
||||
category: 'Electronics',
|
||||
quantity: 25,
|
||||
},
|
||||
{
|
||||
name: 'Capacitor Pack',
|
||||
barcode: '555666777',
|
||||
part_number: 'CAP-100',
|
||||
category: 'Components',
|
||||
quantity: 100,
|
||||
},
|
||||
{
|
||||
name: 'Resistor Assortment',
|
||||
barcode: '111222333',
|
||||
part_number: 'RES-500',
|
||||
category: 'Components',
|
||||
quantity: 500,
|
||||
},
|
||||
];
|
||||
|
||||
// Test categories for inventory organization
|
||||
export const TEST_CATEGORIES = [
|
||||
{ name: 'Electronics', description: 'Electronic components and devices' },
|
||||
{ name: 'Components', description: 'Discrete electronic components' },
|
||||
{ name: 'Tools', description: 'Maintenance and assembly tools' },
|
||||
{ name: 'Cables', description: 'Network and power cables' },
|
||||
];
|
||||
|
||||
// Box labels for multi-item scanning workflow
|
||||
export const TEST_BOX_LABELS = [
|
||||
{ label: 'BOX-BATCH-001', items: ['123456789', '987654321'] },
|
||||
{ label: 'BOX-BATCH-002', items: ['555666777', '111222333'] },
|
||||
];
|
||||
|
||||
// AI extraction test images (base64 encoded sample data for testing)
|
||||
export const AI_EXTRACTION_TEST_DATA = {
|
||||
valid_label: {
|
||||
filename: 'valid_label.jpg',
|
||||
// Placeholder for base64 encoded test image
|
||||
base64: 'data:image/jpeg;base64,',
|
||||
expected_extraction: {
|
||||
name: 'Test Component',
|
||||
part_number: 'TEST-001',
|
||||
quantity: '10',
|
||||
},
|
||||
},
|
||||
invalid_label: {
|
||||
filename: 'invalid_label.jpg',
|
||||
base64: 'data:image/jpeg;base64,',
|
||||
expected_extraction: {
|
||||
error: 'Unable to extract data from image',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Offline sync test scenarios
|
||||
export const OFFLINE_SYNC_SCENARIOS = {
|
||||
single_item_checkin: {
|
||||
operations: [
|
||||
{ type: 'checkin', item_id: 1, quantity: 5 },
|
||||
],
|
||||
},
|
||||
multi_item_checkout: {
|
||||
operations: [
|
||||
{ type: 'checkout', item_id: 1, quantity: 3 },
|
||||
{ type: 'checkout', item_id: 2, quantity: 2 },
|
||||
],
|
||||
},
|
||||
mixed_operations: {
|
||||
operations: [
|
||||
{ type: 'checkin', item_id: 1, quantity: 5 },
|
||||
{ type: 'checkout', item_id: 2, quantity: 2 },
|
||||
{ type: 'checkin', item_id: 3, quantity: 10 },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// Port configuration for Docker containers (per workflow instance)
|
||||
export const PORT_CONFIG = {
|
||||
base: {
|
||||
backend: 8906,
|
||||
frontend: 3000,
|
||||
ldap: 389,
|
||||
},
|
||||
offsets: {
|
||||
workflow_1_login: { backend: 9001, frontend: 9100, ldap: 9389 },
|
||||
workflow_2_scan: { backend: 9002, frontend: 9101, ldap: 9390 },
|
||||
workflow_3_ai: { backend: 9003, frontend: 9102, ldap: 9391 },
|
||||
workflow_4_admin: { backend: 9004, frontend: 9103, ldap: 9392 },
|
||||
workflow_5_offline: { backend: 9005, frontend: 9104, ldap: 9393 },
|
||||
},
|
||||
};
|
||||
|
||||
// Environment variable defaults for each workflow
|
||||
export const WORKFLOW_ENV_DEFAULTS = {
|
||||
login: {
|
||||
LDAP_ENABLED: 'true',
|
||||
AI_PROVIDER: 'gemini',
|
||||
},
|
||||
scan: {
|
||||
LDAP_ENABLED: 'false',
|
||||
AI_PROVIDER: 'gemini',
|
||||
},
|
||||
ai_extraction: {
|
||||
LDAP_ENABLED: 'false',
|
||||
AI_PROVIDER: 'gemini',
|
||||
},
|
||||
admin_settings: {
|
||||
LDAP_ENABLED: 'true',
|
||||
AI_PROVIDER: 'gemini',
|
||||
},
|
||||
offline_sync: {
|
||||
LDAP_ENABLED: 'false',
|
||||
AI_PROVIDER: 'claude',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user