Files
BIPMaterialManager/tests/unit/locators.test.ts
Misaka f6b19b50f3 feat: implement Extractor service with download capability
Implement Task 3.1: Core Extractor Logic with TDD approach.

Changes:
- Add ExtractorService class with batch processing and download support
- Update ERP_LOCATORS with extractor-specific selectors from Python reference
- Add integration tests for single and multiple order extraction
- Add unit tests for batch creation logic
- Update existing tests to skip gracefully without ERP credentials

Features:
- Navigate to discrete material plan page with nested iframes
- Setup query interface (search icon, order query, limit settings)
- Batch download with configurable batch size (default: 100)
- Progress callback support for real-time updates
- Error handling for individual batch failures
- File download handling with proper wait strategies

Reference: playwrite/utils/discrete_material_plan_extractor.py

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-01 12:46:15 +08:00

27 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { ERP_LOCATORS } from '../../src/main/services/erp/locators';
describe('ERP Locators', () => {
it('should have login page locators defined', () => {
expect(ERP_LOCATORS.login.usernameInput).toBeDefined();
expect(ERP_LOCATORS.login.passwordInput).toBeDefined();
expect(ERP_LOCATORS.login.submitButton).toBeDefined();
});
it('should have main frame locator', () => {
expect(ERP_LOCATORS.main.mainIframe).toBeDefined();
});
it('should have extractor page locators', () => {
expect(ERP_LOCATORS.extractor.orderNumberInputRole).toBeDefined();
expect(ERP_LOCATORS.extractor.queryButton).toBeDefined();
expect(ERP_LOCATORS.extractor.exportButton).toBeDefined();
expect(ERP_LOCATORS.extractor.confirmButton).toBeDefined();
});
it('should have cleaner page locators', () => {
expect(ERP_LOCATORS.cleaner.orderNumberInput).toBeDefined();
expect(ERP_LOCATORS.cleaner.materialGrid).toBeDefined();
expect(ERP_LOCATORS.cleaner.saveButton).toBeDefined();
});
});