- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1121 lines
41 KiB
JSON
1121 lines
41 KiB
JSON
{
|
|
"info": {
|
|
"name": "Parametric BOM API Testing",
|
|
"description": "Comprehensive API testing collection for the parametric BOM system including model parameters, formulas, condition rules, BOM resolution, and product creation.",
|
|
"version": "1.0.0",
|
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
},
|
|
"auth": {
|
|
"type": "bearer",
|
|
"bearer": [
|
|
{
|
|
"key": "token",
|
|
"value": "{{auth_token}}",
|
|
"type": "string"
|
|
}
|
|
]
|
|
},
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"// Set API key header for all requests",
|
|
"pm.request.headers.add({",
|
|
" key: 'X-API-Key',",
|
|
" value: pm.environment.get('api_key')",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"variable": [
|
|
{
|
|
"key": "base_url",
|
|
"value": "http://localhost:8000/api/v1",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "model_id",
|
|
"value": "",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "parameter_id",
|
|
"value": "",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "formula_id",
|
|
"value": "",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "rule_id",
|
|
"value": "",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"key": "product_id",
|
|
"value": "",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"item": [
|
|
{
|
|
"name": "Authentication",
|
|
"item": [
|
|
{
|
|
"name": "Login",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Login successful', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.token).to.be.a('string');",
|
|
" pm.environment.set('auth_token', response.data.token);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"email\": \"{{user_email}}\",\n \"password\": \"{{user_password}}\"\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/login",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["login"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Design Models",
|
|
"item": [
|
|
{
|
|
"name": "List Design Models",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Models retrieved successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.data).to.be.an('array');",
|
|
" ",
|
|
" // Find KSS01 model and store ID",
|
|
" const kss01Model = response.data.data.find(model => model.code === 'KSS01');",
|
|
" if (kss01Model) {",
|
|
" pm.collectionVariables.set('model_id', kss01Model.id);",
|
|
" console.log('KSS01 Model ID:', kss01Model.id);",
|
|
" }",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/models",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "models"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Get KSS01 Model Details",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Model details retrieved', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.code).to.equal('KSS01');",
|
|
" pm.expect(response.data.name).to.include('Screen Door');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/models/{{model_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "models", "{{model_id}}"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Model Parameters",
|
|
"item": [
|
|
{
|
|
"name": "List Model Parameters",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Parameters retrieved successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.data).to.be.an('array');",
|
|
" pm.expect(response.data.data.length).to.be.greaterThan(0);",
|
|
" ",
|
|
" // Verify required parameters exist",
|
|
" const parameters = response.data.data;",
|
|
" const w0Param = parameters.find(p => p.parameter_name === 'W0');",
|
|
" const h0Param = parameters.find(p => p.parameter_name === 'H0');",
|
|
" pm.expect(w0Param).to.not.be.undefined;",
|
|
" pm.expect(h0Param).to.not.be.undefined;",
|
|
" pm.expect(w0Param.is_required).to.be.true;",
|
|
" pm.expect(h0Param.is_required).to.be.true;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-parameters?model_id={{model_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-parameters"],
|
|
"query": [
|
|
{
|
|
"key": "model_id",
|
|
"value": "{{model_id}}"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Create New Parameter",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Parameter created successfully', function () {",
|
|
" pm.response.to.have.status(201);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.parameter_name).to.equal('test_width');",
|
|
" pm.collectionVariables.set('parameter_id', response.data.id);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameter_name\": \"test_width\",\n \"parameter_type\": \"NUMBER\",\n \"is_required\": false,\n \"default_value\": \"1000\",\n \"min_value\": 500,\n \"max_value\": 3000,\n \"unit\": \"mm\",\n \"description\": \"Test width parameter\",\n \"sort_order\": 99\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-parameters",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-parameters"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Update Parameter",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Parameter updated successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "PUT",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"description\": \"Updated test width parameter\",\n \"max_value\": 3500\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-parameters/{{parameter_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-parameters", "{{parameter_id}}"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Delete Parameter",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Parameter deleted successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-parameters/{{parameter_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-parameters", "{{parameter_id}}"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Model Formulas",
|
|
"item": [
|
|
{
|
|
"name": "List Model Formulas",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Formulas retrieved successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.data).to.be.an('array');",
|
|
" pm.expect(response.data.data.length).to.be.greaterThan(0);",
|
|
" ",
|
|
" // Verify expected formulas exist",
|
|
" const formulas = response.data.data;",
|
|
" const w1Formula = formulas.find(f => f.formula_name === 'W1');",
|
|
" const areaFormula = formulas.find(f => f.formula_name === 'area');",
|
|
" pm.expect(w1Formula).to.not.be.undefined;",
|
|
" pm.expect(areaFormula).to.not.be.undefined;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-formulas?model_id={{model_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-formulas"],
|
|
"query": [
|
|
{
|
|
"key": "model_id",
|
|
"value": "{{model_id}}"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Calculate Formulas",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Formulas calculated successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data).to.be.an('object');",
|
|
" ",
|
|
" // Verify expected calculated values",
|
|
" pm.expect(response.data.W1).to.equal(1300); // 1200 + 100",
|
|
" pm.expect(response.data.H1).to.equal(900); // 800 + 100",
|
|
" pm.expect(response.data.area).to.be.approximately(1.17, 0.01); // (1300*900)/1000000",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-formulas/calculate",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-formulas", "calculate"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Create Test Formula",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Formula created successfully', function () {",
|
|
" pm.response.to.have.status(201);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.formula_name).to.equal('test_perimeter');",
|
|
" pm.collectionVariables.set('formula_id', response.data.id);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"formula_name\": \"test_perimeter\",\n \"expression\": \"(W1 + H1) * 2\",\n \"description\": \"Test perimeter calculation\",\n \"sort_order\": 99\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-formulas",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-formulas"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Delete Test Formula",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Formula deleted successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/model-formulas/{{formula_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "model-formulas", "{{formula_id}}"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "BOM Condition Rules",
|
|
"item": [
|
|
{
|
|
"name": "List Condition Rules",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Rules retrieved successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.data).to.be.an('array');",
|
|
" pm.expect(response.data.data.length).to.be.greaterThan(0);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-condition-rules?model_id={{model_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-condition-rules"],
|
|
"query": [
|
|
{
|
|
"key": "model_id",
|
|
"value": "{{model_id}}"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Evaluate Rules",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Rules evaluated successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.matched_rules).to.be.an('array');",
|
|
" pm.expect(response.data.bom_actions).to.be.an('array');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"W1\": 1300,\n \"H1\": 900,\n \"area\": 1.17,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-condition-rules/evaluate",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-condition-rules", "evaluate"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "BOM Resolution",
|
|
"item": [
|
|
{
|
|
"name": "Resolve BOM - Small Screen",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('BOM resolved successfully - Small Screen', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.model.code).to.equal('KSS01');",
|
|
" pm.expect(response.data.resolved_bom).to.be.an('array');",
|
|
" pm.expect(response.data.summary.total_items).to.be.greaterThan(0);",
|
|
" ",
|
|
" // Verify calculations",
|
|
" pm.expect(response.data.calculated_values.W1).to.equal(900); // 800 + 100",
|
|
" pm.expect(response.data.calculated_values.H1).to.equal(700); // 600 + 100",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 800,\n \"H0\": 600,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/resolve",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "resolve"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Resolve BOM - Large Screen with Steel",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('BOM resolved successfully - Large Steel Screen', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.resolved_bom).to.be.an('array');",
|
|
" ",
|
|
" // Check for steel material instead of fabric",
|
|
" const bomItems = response.data.resolved_bom;",
|
|
" const hasSteelMaterial = bomItems.some(item => ",
|
|
" item.target_type === 'MATERIAL' && ",
|
|
" item.target_info && ",
|
|
" item.target_info.code && ",
|
|
" item.target_info.code.includes('STEEL')",
|
|
" );",
|
|
" ",
|
|
" // For large screens, should use heavy duty motor",
|
|
" const hasHeavyMotor = bomItems.some(item => ",
|
|
" item.target_type === 'PRODUCT' && ",
|
|
" item.target_info && ",
|
|
" item.target_info.code && ",
|
|
" item.target_info.code.includes('HEAVY')",
|
|
" );",
|
|
" ",
|
|
" console.log('Steel material found:', hasSteelMaterial);",
|
|
" console.log('Heavy motor found:', hasHeavyMotor);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 2000,\n \"H0\": 1500,\n \"screen_type\": \"STEEL\",\n \"install_type\": \"CEILING\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/resolve",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "resolve"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Preview BOM",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('BOM preview generated successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.resolved_bom).to.be.an('array');",
|
|
" pm.expect(response.data.summary).to.be.an('object');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/preview",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "preview"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Compare BOMs",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('BOM comparison completed successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.parameters_diff).to.be.an('object');",
|
|
" pm.expect(response.data.bom_diff).to.be.an('object');",
|
|
" pm.expect(response.data.bom_diff.added).to.be.an('array');",
|
|
" pm.expect(response.data.bom_diff.removed).to.be.an('array');",
|
|
" pm.expect(response.data.bom_diff.modified).to.be.an('array');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters1\": {\n \"W0\": 800,\n \"H0\": 600,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n },\n \"parameters2\": {\n \"W0\": 1500,\n \"H0\": 1200,\n \"screen_type\": \"STEEL\",\n \"install_type\": \"CEILING\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/compare",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "compare"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "KSS01 Test Scenario",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('KSS01 test scenario successful', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.model.code).to.equal('KSS01');",
|
|
" pm.expect(response.data.calculated_values.W1).to.equal(1300);",
|
|
" pm.expect(response.data.calculated_values.H1).to.equal(900);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/kss01-test",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "kss01-test"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Product From Model",
|
|
"item": [
|
|
{
|
|
"name": "Preview Product Creation",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Product preview generated successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.preview_product).to.be.an('object');",
|
|
" pm.expect(response.data.preview_product.code).to.be.a('string');",
|
|
" pm.expect(response.data.preview_bom).to.be.an('object');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n },\n \"product_data\": {\n \"name\": \"Preview Test Product\",\n \"category_id\": 1,\n \"auto_generate_code\": true\n },\n \"generate_bom\": true\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/product-from-model/preview",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "product-from-model", "preview"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Create Product from Model",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Product created successfully from model', function () {",
|
|
" pm.response.to.have.status(201);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.product).to.be.an('object');",
|
|
" pm.expect(response.data.product.code).to.equal('TEST-KSS01-1200x800');",
|
|
" pm.expect(response.data.bom_created).to.be.true;",
|
|
" pm.expect(response.data.bom_items_count).to.be.greaterThan(0);",
|
|
" pm.collectionVariables.set('product_id', response.data.product.id);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n },\n \"product_data\": {\n \"code\": \"TEST-KSS01-1200x800\",\n \"name\": \"Test KSS01 Screen Door 1200x800\",\n \"category_id\": 1,\n \"description\": \"Test product created from KSS01 model\",\n \"unit\": \"EA\"\n },\n \"generate_bom\": true\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/product-from-model",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "product-from-model"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "List Products from Model",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Products from model listed successfully', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.data).to.be.an('array');",
|
|
" ",
|
|
" // Should find our created product",
|
|
" const createdProduct = response.data.data.find(p => p.code === 'TEST-KSS01-1200x800');",
|
|
" pm.expect(createdProduct).to.not.be.undefined;",
|
|
" pm.expect(createdProduct.model_reference).to.be.an('object');",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "GET",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/design/product-from-model/list?model_id={{model_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "product-from-model", "list"],
|
|
"query": [
|
|
{
|
|
"key": "model_id",
|
|
"value": "{{model_id}}"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Performance Tests",
|
|
"item": [
|
|
{
|
|
"name": "Batch BOM Resolution Performance",
|
|
"event": [
|
|
{
|
|
"listen": "prerequest",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"// Record start time",
|
|
"pm.globals.set('batch_start_time', Date.now());"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"// Calculate response time",
|
|
"const startTime = pm.globals.get('batch_start_time');",
|
|
"const responseTime = Date.now() - startTime;",
|
|
"",
|
|
"pm.test('Batch resolution performance acceptable', function () {",
|
|
" pm.response.to.have.status(200);",
|
|
" pm.expect(responseTime).to.be.below(1000); // Should complete within 1 second",
|
|
"});",
|
|
"",
|
|
"pm.test('All resolutions successful', function () {",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.true;",
|
|
" pm.expect(response.data.results).to.be.an('array');",
|
|
" pm.expect(response.data.results.length).to.equal(5);",
|
|
" ",
|
|
" // All results should be successful",
|
|
" response.data.results.forEach((result, index) => {",
|
|
" pm.expect(result.success, `Result ${index} should be successful`).to.be.true;",
|
|
" pm.expect(result.resolved_bom, `Result ${index} should have BOM`).to.be.an('array');",
|
|
" });",
|
|
"});",
|
|
"",
|
|
"console.log(`Batch resolution completed in ${responseTime}ms`);"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"scenarios\": [\n {\n \"W0\": 800,\n \"H0\": 600,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n },\n {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"STEEL\",\n \"install_type\": \"CEILING\"\n },\n {\n \"W0\": 1600,\n \"H0\": 1200,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"RECESSED\"\n },\n {\n \"W0\": 2000,\n \"H0\": 1500,\n \"screen_type\": \"STEEL\",\n \"install_type\": \"WALL\"\n },\n {\n \"W0\": 2400,\n \"H0\": 1800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"CEILING\"\n }\n ]\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/batch",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "batch"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Error Handling Tests",
|
|
"item": [
|
|
{
|
|
"name": "Invalid Model ID",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Invalid model ID handled correctly', function () {",
|
|
" pm.response.to.have.status(404);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.false;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": 99999,\n \"parameters\": {\n \"W0\": 1200,\n \"H0\": 800,\n \"screen_type\": \"FABRIC\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/resolve",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "resolve"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Invalid Parameters",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Invalid parameters handled correctly', function () {",
|
|
" pm.response.to.have.status(422);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.false;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 5000,\n \"H0\": 800,\n \"screen_type\": \"INVALID_TYPE\",\n \"install_type\": \"WALL\"\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/resolve",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "resolve"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "Missing Required Parameters",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Missing required parameters handled correctly', function () {",
|
|
" pm.response.to.have.status(422);",
|
|
" const response = pm.response.json();",
|
|
" pm.expect(response.success).to.be.false;",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "POST",
|
|
"header": [
|
|
{
|
|
"key": "Content-Type",
|
|
"value": "application/json"
|
|
}
|
|
],
|
|
"body": {
|
|
"mode": "raw",
|
|
"raw": "{\n \"model_id\": {{model_id}},\n \"parameters\": {\n \"W0\": 1200\n }\n}"
|
|
},
|
|
"url": {
|
|
"raw": "{{base_url}}/design/bom-resolver/resolve",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["design", "bom-resolver", "resolve"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "Cleanup",
|
|
"item": [
|
|
{
|
|
"name": "Delete Test Product",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"type": "text/javascript",
|
|
"exec": [
|
|
"pm.test('Test product deleted successfully', function () {",
|
|
" // Product deletion might return 200 or 204",
|
|
" pm.expect(pm.response.code).to.be.oneOf([200, 204]);",
|
|
"});"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"request": {
|
|
"method": "DELETE",
|
|
"header": [],
|
|
"url": {
|
|
"raw": "{{base_url}}/products/{{product_id}}",
|
|
"host": ["{{base_url}}"],
|
|
"path": ["products", "{{product_id}}"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |