feat: define ERP page element locators
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
44
src/main/services/erp/locators.ts
Normal file
44
src/main/services/erp/locators.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* ERP Page Element Locators
|
||||
* Reference: playwrite/utils/ discrete_material_plan_extractor.py
|
||||
* Reference: playwrite/utils/ discrete_material_plan_cleaner.py
|
||||
*/
|
||||
|
||||
export const ERP_LOCATORS = {
|
||||
// Login Page
|
||||
login: {
|
||||
usernameInput: '#username',
|
||||
passwordInput: '#password',
|
||||
submitButton: 'button[type="submit"]',
|
||||
},
|
||||
|
||||
// Main Frame
|
||||
main: {
|
||||
mainIframe: '#mainiframe',
|
||||
loadingOverlay: '.loading-overlay',
|
||||
contentFrame: '#contentframe',
|
||||
},
|
||||
|
||||
// Extractor (Data Export) Page
|
||||
extractor: {
|
||||
orderNumberInput: 'input[name="orderNumber"]',
|
||||
queryButton: 'button:has-text("查询")',
|
||||
exportButton: 'button:has-text("导出")',
|
||||
},
|
||||
|
||||
// Cleaner (Material Delete) Page
|
||||
cleaner: {
|
||||
orderNumberInput: 'input[name="orderNumber"]',
|
||||
materialGrid: 'table.material-grid tbody tr',
|
||||
saveButton: 'button:has-text("保存")',
|
||||
},
|
||||
|
||||
// Common Elements
|
||||
common: {
|
||||
successMessage: '.message.success',
|
||||
errorMessage: '.message.error',
|
||||
confirmDialog: '.confirm-dialog',
|
||||
confirmButton: 'button:has-text("确定")',
|
||||
cancelButton: 'button:has-text("取消")',
|
||||
},
|
||||
};
|
||||
26
tests/unit/locators.test.ts
Normal file
26
tests/unit/locators.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
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.orderNumberInput).toBeDefined();
|
||||
expect(ERP_LOCATORS.extractor.queryButton).toBeDefined();
|
||||
expect(ERP_LOCATORS.extractor.exportButton).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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user