codemie-test-harness 0.1.200__py3-none-any.whl → 0.1.201__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of codemie-test-harness might be problematic. Click here for more details.

@@ -1,10 +1,13 @@
1
1
  import os
2
+ from pathlib import Path
3
+ from typing import Optional
2
4
 
3
5
  from codemie_sdk.models.workflow import (
4
6
  WorkflowCreateRequest,
5
7
  WorkflowUpdateRequest,
6
8
  WorkflowMode,
7
9
  )
10
+
8
11
  from codemie_test_harness.tests import PROJECT
9
12
  from codemie_test_harness.tests.utils.base_utils import (
10
13
  BaseUtils,
@@ -97,8 +100,14 @@ class WorkflowUtils(BaseUtils):
97
100
  entity_name=response[1],
98
101
  )
99
102
 
100
- def execute_workflow(self, workflow, execution_name, user_input=""):
101
- self.client.workflows.run(workflow, user_input=user_input)
103
+ def execute_workflow(
104
+ self,
105
+ workflow,
106
+ execution_name,
107
+ user_input="",
108
+ file_name: Optional[str] = None,
109
+ ):
110
+ self.client.workflows.run(workflow, user_input=user_input, file_name=file_name)
102
111
  executions = self.client.workflows.executions(workflow)
103
112
  execution_id = next(
104
113
  row.execution_id for row in executions.list() if row.prompt == user_input
@@ -232,6 +241,9 @@ class WorkflowUtils(BaseUtils):
232
241
 
233
242
  return triggered_tools
234
243
 
244
+ def upload_file(self, file_path: Path):
245
+ return self.client.files.bulk_upload([file_path])
246
+
235
247
  @staticmethod
236
248
  def _extract_tools_from_thoughts(thoughts_data):
237
249
  """
@@ -3,8 +3,18 @@ import json
3
3
  import pytest
4
4
  from hamcrest import assert_that, equal_to
5
5
 
6
+ from codemie_test_harness.tests.enums.tools import Default
7
+ from codemie_test_harness.tests.test_data.assistant_test_data import (
8
+ EXCEL_TOOL_TEST_DATA,
9
+ DOCX_TOOL_TEST_DATA,
10
+ )
11
+ from codemie_test_harness.tests.test_data.file_test_data import file_test_data
6
12
  from codemie_test_harness.tests.test_data.output_schema_test_data import output_schema
7
- from codemie_test_harness.tests.utils.base_utils import get_random_name
13
+ from codemie_test_harness.tests.utils.base_utils import (
14
+ get_random_name,
15
+ assert_tool_triggered,
16
+ )
17
+ from codemie_test_harness.tests.utils.constants import FILES_PATH
8
18
  from codemie_test_harness.tests.utils.yaml_utils import AssistantModel, StateModel
9
19
 
10
20
 
@@ -37,3 +47,191 @@ def test_workflow_with_json_output_schema(default_llm, workflow, workflow_utils)
37
47
  )
38
48
 
39
49
  assert_that(json.loads(response)["results"][0], equal_to(2))
50
+
51
+
52
+ @pytest.mark.workflow
53
+ @pytest.mark.api
54
+ @pytest.mark.smoke
55
+ @pytest.mark.file
56
+ @pytest.mark.parametrize(
57
+ "file_name, expected_response, expected_tool",
58
+ file_test_data,
59
+ ids=[f"{row[0]}" for row in file_test_data],
60
+ )
61
+ def test_workflow_with_user_input_and_file_attachment(
62
+ workflow_with_virtual_assistant,
63
+ workflow_utils,
64
+ assistant_utils,
65
+ file_name,
66
+ expected_response,
67
+ expected_tool,
68
+ similarity_check,
69
+ ):
70
+ """
71
+ Test workflow execution with user input that includes file attachment.
72
+
73
+ This test demonstrates how workflows can handle file attachments by:
74
+ 1. Uploading a file
75
+ 2. Creating a workflow with file processing capabilities
76
+ 3. Executing the workflow with user input that references the uploaded file
77
+ 4. Verifying that file processing tools are triggered
78
+ """
79
+ assistant_and_state_name = get_random_name()
80
+
81
+ # Upload file to get file URL
82
+ upload_response = workflow_utils.upload_file(FILES_PATH / file_name)
83
+ file_url = upload_response.files[0].file_url
84
+
85
+ # Create workflow with virtual assistant that has file analysis capabilities
86
+ # Note: File analysis tools are automatically available when files are processed
87
+ system_prompt = "You are a helpful assistant that can analyze and process files. "
88
+
89
+ workflow_instance = workflow_with_virtual_assistant(
90
+ assistant_and_state_name=assistant_and_state_name,
91
+ system_prompt=system_prompt,
92
+ task=(
93
+ "Analyze the uploaded file from the provided file URL and give a detailed summary. "
94
+ "Use the appropriate file analysis tools based on the file type to extract and process the content."
95
+ ),
96
+ )
97
+
98
+ # Prepare user input that includes file reference
99
+ user_input = "Please provide a summary about file content."
100
+
101
+ # Execute workflow
102
+ response = workflow_utils.execute_workflow(
103
+ workflow_instance.id,
104
+ assistant_and_state_name,
105
+ user_input=user_input,
106
+ file_name=file_url,
107
+ )
108
+
109
+ # Extract triggered tools from execution
110
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
111
+ workflow_instance
112
+ )
113
+
114
+ assert_tool_triggered(expected_tool, triggered_tools)
115
+ similarity_check.check_similarity(response, expected_response)
116
+
117
+
118
+ @pytest.mark.workflow
119
+ @pytest.mark.file
120
+ @pytest.mark.api
121
+ @pytest.mark.smoke
122
+ @pytest.mark.parametrize("prompt, expected_response", EXCEL_TOOL_TEST_DATA)
123
+ def test_workflow_excel_tool_extended_functionality(
124
+ workflow_with_virtual_assistant,
125
+ workflow_utils,
126
+ similarity_check,
127
+ prompt,
128
+ expected_response,
129
+ ):
130
+ """
131
+ Test extended Excel tool functionality with various scenarios in workflow.
132
+
133
+ This test covers:
134
+ - Data extraction from visible sheets only
135
+ - All data including hidden sheets
136
+ - Sheet name listing functionality
137
+ - File statistics and structure analysis
138
+ - Single sheet extraction by index and name
139
+ - Data cleaning and normalization
140
+ - Hidden sheet visibility control
141
+ - Column structure and data type analysis
142
+ - Tabular structure normalization
143
+ - Multi-sheet comprehensive analysis
144
+
145
+ """
146
+ assistant_and_state_name = get_random_name()
147
+
148
+ # Upload file to get file URL
149
+ upload_response = workflow_utils.upload_file(FILES_PATH / "test_extended.xlsx")
150
+ file_url = upload_response.files[0].file_url
151
+
152
+ # Create workflow with virtual assistant that has Excel file processing capabilities
153
+ system_prompt = "You have all required information in initial prompt. Do not ask additional questions and proceed with request."
154
+
155
+ workflow_instance = workflow_with_virtual_assistant(
156
+ assistant_and_state_name=assistant_and_state_name,
157
+ system_prompt=system_prompt,
158
+ task=prompt,
159
+ )
160
+
161
+ # Execute workflow with the file URL
162
+ response = workflow_utils.execute_workflow(
163
+ workflow_instance.id,
164
+ assistant_and_state_name,
165
+ user_input="Process the uploaded Excel file as requested.",
166
+ file_name=file_url,
167
+ )
168
+
169
+ # Extract triggered tools from execution
170
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
171
+ workflow_instance
172
+ )
173
+
174
+ assert_tool_triggered(Default.EXCEL_TOOL, triggered_tools)
175
+ similarity_check.check_similarity(response, expected_response)
176
+
177
+
178
+ @pytest.mark.workflow
179
+ @pytest.mark.file
180
+ @pytest.mark.api
181
+ @pytest.mark.smoke
182
+ @pytest.mark.parametrize("prompt, expected_response", DOCX_TOOL_TEST_DATA)
183
+ def test_workflow_docx_tool_extended_functionality(
184
+ workflow_with_virtual_assistant,
185
+ workflow_utils,
186
+ similarity_check,
187
+ prompt,
188
+ expected_response,
189
+ ):
190
+ """
191
+ Test extended Docx tool functionality with various scenarios in workflow.
192
+
193
+ This test covers:
194
+ - Extract plain text using 'text' query
195
+ - Extract text with metadata using 'text_with_metadata' query
196
+ - Extract document structure using 'structure_only' query
197
+ - Extract tables using 'table_extraction' query
198
+ - Generate summary using 'summary' query
199
+ - Perform analysis with custom instructions using 'analyze' query
200
+ - Process specific pages '1-3' using pages parameter
201
+ - Process specific pages '1,5,10' using pages parameter
202
+ - Extract images using 'image_extraction' query
203
+ - Extract text with OCR from images using 'text_with_images' query
204
+
205
+ """
206
+ assistant_and_state_name = get_random_name()
207
+
208
+ # Upload file to get file URL
209
+ upload_response = workflow_utils.upload_file(FILES_PATH / "test_extended.docx")
210
+ file_url = upload_response.files[0].file_url
211
+
212
+ # Create workflow with virtual assistant that has DOCX file processing capabilities
213
+ system_prompt = """You are a helpful assistant that can analyze and process DOCX files.
214
+ You have all required information in initial prompt.
215
+ Do not ask additional questions and proceed with request."""
216
+
217
+ workflow_instance = workflow_with_virtual_assistant(
218
+ assistant_and_state_name=assistant_and_state_name,
219
+ system_prompt=system_prompt,
220
+ task=prompt,
221
+ )
222
+
223
+ # Execute workflow with the file URL
224
+ response = workflow_utils.execute_workflow(
225
+ workflow_instance.id,
226
+ assistant_and_state_name,
227
+ user_input="Process the uploaded DOCX file as requested.",
228
+ file_name=file_url,
229
+ )
230
+
231
+ # Extract triggered tools from execution
232
+ triggered_tools = workflow_utils.extract_triggered_tools_from_execution(
233
+ workflow_instance
234
+ )
235
+
236
+ assert_tool_triggered(Default.DOCX_TOOL, triggered_tools)
237
+ similarity_check.check_similarity(response, expected_response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codemie-test-harness
3
- Version: 0.1.200
3
+ Version: 0.1.201
4
4
  Summary: Autotest for CodeMie backend and UI
5
5
  Author: Anton Yeromin
6
6
  Author-email: anton_yeromin@epam.com
@@ -13,7 +13,7 @@ Requires-Dist: aws-assume-role-lib (>=2.10.0,<3.0.0)
13
13
  Requires-Dist: boto3 (>=1.39.8,<2.0.0)
14
14
  Requires-Dist: click (>=8.1.7,<9.0.0)
15
15
  Requires-Dist: codemie-plugins (>=0.1.123,<0.2.0)
16
- Requires-Dist: codemie-sdk-python (==0.1.200)
16
+ Requires-Dist: codemie-sdk-python (==0.1.201)
17
17
  Requires-Dist: pytest (>=8.4.1,<9.0.0)
18
18
  Requires-Dist: pytest-playwright (>=0.7.0,<0.8.0)
19
19
  Requires-Dist: pytest-repeat (>=0.9.3,<0.10.0)
@@ -284,7 +284,7 @@ codemie_test_harness/tests/utils/pytest_utils.py,sha256=k-mEjX2qpnh37sqKpJqYhZT6
284
284
  codemie_test_harness/tests/utils/search_utils.py,sha256=SrXiB2d9wiI5ka9bgg0CD73GOX_1mqi2Hz5FBm5DsEU,1435
285
285
  codemie_test_harness/tests/utils/similarity_check.py,sha256=1U66NGh6esISKABodtVobE2WnuFt0f6vcK3qUri6ZqU,1485
286
286
  codemie_test_harness/tests/utils/user_utils.py,sha256=zJNrmL3Fb7iGuaVRobUMwJ2Og6NqEPcM_9lw60m18T8,242
287
- codemie_test_harness/tests/utils/workflow_utils.py,sha256=awEoO0U23_JkHzg_DAZyblM9GW-rQ6hYjdsqRBdyeOw,9101
287
+ codemie_test_harness/tests/utils/workflow_utils.py,sha256=Kz4F4Xzdx42PNmye--ENpjSakdB1Y-QL_nwSfKhMAXE,9359
288
288
  codemie_test_harness/tests/utils/yaml_utils.py,sha256=y9fUf4u4G4SoCktPOwaC5x71iaDKhktbz_XUfI9kNis,1661
289
289
  codemie_test_harness/tests/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
290
290
  codemie_test_harness/tests/workflow/assistant_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -350,7 +350,7 @@ codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_repo
350
350
  codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_research_tools.py,sha256=lQzzWV6mcKH1_8k4-OxXoI9_hb48JJbYAmDT9bj-WQ0,2558
351
351
  codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_servicenow_tools.py,sha256=meR9c8BgMTgM6LpwqE0n7ygTCIHGVooMvYfb6kGF7UE,2377
352
352
  codemie_test_harness/tests/workflow/direct_tools_calling/test_workflow_with_vcs_tools.py,sha256=dbfjHnIhjneW3_JZyElvmswE7omOp0A0EgzoztZ7vow,3098
353
- codemie_test_harness/tests/workflow/test_workflows.py,sha256=9AJbZ3URcJH3M9yu6NMJmO7BXv8-CibiznN-qk38DmA,1156
353
+ codemie_test_harness/tests/workflow/test_workflows.py,sha256=HxwY2VKGLvLW2sl3CwR_0xFOmXrLwj_nfGdqnC39CSw,8129
354
354
  codemie_test_harness/tests/workflow/virtual_assistant_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
355
355
  codemie_test_harness/tests/workflow/virtual_assistant_tools/access_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
356
356
  codemie_test_harness/tests/workflow/virtual_assistant_tools/access_management/test_workflow_with_keycloak_tool.py,sha256=eLM804LRG-Rd5ZIgrO_W53FGoSJ_TxWPKQPtWG598CY,1203
@@ -391,7 +391,7 @@ codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/__init__.
391
391
  codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py,sha256=D835gaRbCnB4va5mi9TdA_u9StSpGXQ_fgzwW0S2pwo,1173
392
392
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
393
393
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py,sha256=Se9imIiBYuJU78m1pLu0g4ZmHygKZjr6JjIWkGXTy1Q,1364
394
- codemie_test_harness-0.1.200.dist-info/METADATA,sha256=s-ASsAfnRD0a5t_Yiy30KzzDXtV-O5P1xICb8YTWEeE,22968
395
- codemie_test_harness-0.1.200.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
396
- codemie_test_harness-0.1.200.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
397
- codemie_test_harness-0.1.200.dist-info/RECORD,,
394
+ codemie_test_harness-0.1.201.dist-info/METADATA,sha256=sImU4ox8RDDcp34BebNcJV-gT_ua2wqx9kNKs0rIDWo,22968
395
+ codemie_test_harness-0.1.201.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
396
+ codemie_test_harness-0.1.201.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
397
+ codemie_test_harness-0.1.201.dist-info/RECORD,,