codemie-test-harness 0.1.212__py3-none-any.whl → 0.1.214__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,7 +1,7 @@
1
1
  import pytest
2
-
3
2
  from codemie_sdk.models.assistant import ToolConfig
4
3
  from codemie_sdk.models.integration import CredentialTypes
4
+
5
5
  from codemie_test_harness.tests.enums.tools import Toolkit, ProjectManagementTool
6
6
  from codemie_test_harness.tests.test_data.pm_tools_test_data import (
7
7
  CONFLUENCE_TOOL_PROMPT,
@@ -13,7 +13,6 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
13
13
  from codemie_test_harness.tests.test_data.project_management_test_data import (
14
14
  pm_tools_test_data,
15
15
  )
16
- from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
17
16
  from codemie_test_harness.tests.utils.base_utils import (
18
17
  credentials_to_dict,
19
18
  assert_tool_triggered,
@@ -21,6 +20,7 @@ from codemie_test_harness.tests.utils.base_utils import (
21
20
  from codemie_test_harness.tests.utils.constants import (
22
21
  project_management_integrations,
23
22
  )
23
+ from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
24
24
 
25
25
 
26
26
  @pytest.mark.assistant
@@ -41,14 +41,14 @@ def test_assistant_with_project_management_tools(
41
41
  prompt,
42
42
  expected_response,
43
43
  ):
44
- integration = request.getfixturevalue(
44
+ _integration = request.getfixturevalue(
45
45
  project_management_integrations[integration_type]
46
46
  )
47
47
 
48
48
  assistant = assistant(
49
49
  Toolkit.PROJECT_MANAGEMENT,
50
50
  tool_name,
51
- settings=integration,
51
+ settings=_integration,
52
52
  )
53
53
 
54
54
  response, triggered_tools = assistant_utils.ask_assistant(
@@ -31,6 +31,7 @@ from codemie_test_harness.tests.test_data.google_datasource_test_data import (
31
31
  from codemie_test_harness.tests.utils.assistant_utils import AssistantUtils
32
32
  from codemie_test_harness.tests.utils.base_utils import get_random_name, wait_for_entity
33
33
  from codemie_test_harness.tests.utils.client_factory import get_client
34
+ from codemie_test_harness.tests.utils.confluence_utils import ConfluenceUtils
34
35
  from codemie_test_harness.tests.utils.constants import TESTS_PATH, FILES_PATH
35
36
  from codemie_test_harness.tests.utils.conversation_utils import ConversationUtils
36
37
  from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
@@ -41,6 +42,7 @@ from codemie_test_harness.tests.utils.env_resolver import (
41
42
  )
42
43
  from codemie_test_harness.tests.utils.gitbud_utils import GitBudUtils
43
44
  from codemie_test_harness.tests.utils.integration_utils import IntegrationUtils
45
+ from codemie_test_harness.tests.utils.jira_utils import JiraUtils
44
46
  from codemie_test_harness.tests.utils.llm_utils import LLMUtils
45
47
  from codemie_test_harness.tests.utils.logger_util import setup_logger
46
48
  from codemie_test_harness.tests.utils.notification_utils import GmailUtils
@@ -967,3 +969,15 @@ def pytest_sessionfinish(session):
967
969
 
968
970
  providers_utils = ProviderUtils(client)
969
971
  providers_utils.cleanup_test_providers()
972
+
973
+ # Clean up Jira test issues
974
+ jira_utils = JiraUtils(is_cloud=False)
975
+ jira_utils.cleanup_jira_project(summary_prefix=prefix)
976
+ jira_utils = JiraUtils(is_cloud=True)
977
+ jira_utils.cleanup_jira_project(summary_prefix=prefix)
978
+
979
+ # Clean up Confluence test pages
980
+ confluence_utils = ConfluenceUtils(is_cloud=False)
981
+ confluence_utils.cleanup_confluence_space(title_prefix=prefix)
982
+ confluence_utils = ConfluenceUtils(is_cloud=True)
983
+ confluence_utils.cleanup_confluence_space(title_prefix=prefix)
@@ -1,3 +1,7 @@
1
+ from codemie_test_harness.tests.utils.base_utils import get_random_name
2
+ from codemie_test_harness.tests.utils.confluence_utils import CONFLUENCE_SPACE_KEYS
3
+ from codemie_test_harness.tests.utils.jira_utils import JIRA_PROJECT_KEYS
4
+
1
5
  JIRA_TOOL_PROMPT = (
2
6
  "Get a title for ticket EPMCDME-222 ticket."
3
7
  "For generic jira tool use exactly the same parameters:"
@@ -89,3 +93,44 @@ RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL = """
89
93
  Description: This space includes a section for describing the purpose of the space, a search feature, and a filter by label functionality.
90
94
  If you need more detailed information about a specific page, please let me know!
91
95
  """
96
+
97
+
98
+ def get_jira_tool_create_prompt(jira_type: str) -> str:
99
+ return (
100
+ "Create a new issue in Jira with the following details. "
101
+ "For generic jira tool use exactly the same parameters: "
102
+ "relative_url=/rest/api/2/issue "
103
+ "method=POST "
104
+ f"params={{'fields': {{'project': {{'key': '{JIRA_PROJECT_KEYS[jira_type]}'}}, 'summary': '{get_random_name()} Test issue created by automation', "
105
+ "'description': 'This is a test issue created for testing purposes', 'issuetype': {'name': 'Task'}}}}}"
106
+ )
107
+
108
+
109
+ def get_response_for_jira_tool_create(jira_type: str) -> str:
110
+ return f"""
111
+ The issue has been successfully created in Jira. Here are the details:
112
+
113
+ - **ID**: 13411639
114
+ - **Key**: {JIRA_PROJECT_KEYS[jira_type]}-.....
115
+ - **Link**: [{JIRA_PROJECT_KEYS[jira_type]}-.....](https://jira.....)
116
+ """
117
+
118
+
119
+ def get_confluence_tool_create_prompt(confluence_type: str) -> str:
120
+ return f"""
121
+ Create a new page in Confluence with the following details using Generic Confluence Tool with the params:
122
+ relative_url='/rest/api/content'
123
+ method='POST'
124
+ params={{'type': 'page', 'title': '{get_random_name()} Test Page Created by Automation', 'space': {{'key': '{CONFLUENCE_SPACE_KEYS[confluence_type]}'}},
125
+ 'body': {{'storage': {{'value': '<p>This is a test page created for testing purposes.</p>', 'representation': 'storage'}}}}}}
126
+ """
127
+
128
+
129
+ def get_response_for_confluence_tool_create(confluence_type: str) -> str:
130
+ return f"""
131
+ Successfully created a new page in Confluence.
132
+ The page has been created with the following details:
133
+ - Title: Test Page Created by Automation
134
+ - Space: {CONFLUENCE_SPACE_KEYS[confluence_type]}
135
+ - Content: This is a test page created for testing purposes.
136
+ """
@@ -2,14 +2,18 @@ import pytest
2
2
 
3
3
  from codemie_test_harness.tests.enums.tools import ProjectManagementTool
4
4
  from codemie_test_harness.tests.test_data.pm_tools_test_data import (
5
- JIRA_TOOL_PROMPT,
6
- RESPONSE_FOR_JIRA_TOOL,
5
+ get_confluence_tool_create_prompt,
6
+ get_response_for_confluence_tool_create,
7
+ CONFLUENCE_CLOUD_TOOL_PROMPT,
8
+ RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
7
9
  CONFLUENCE_TOOL_PROMPT,
8
10
  RESPONSE_FOR_CONFLUENCE_TOOL,
9
- RESPONSE_FOR_JIRA_CLOUD_TOOL,
11
+ get_jira_tool_create_prompt,
12
+ get_response_for_jira_tool_create,
13
+ JIRA_TOOL_PROMPT,
14
+ RESPONSE_FOR_JIRA_TOOL,
10
15
  JIRA_CLOUD_TOOL_PROMPT,
11
- CONFLUENCE_CLOUD_TOOL_PROMPT,
12
- RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
16
+ RESPONSE_FOR_JIRA_CLOUD_TOOL,
13
17
  )
14
18
  from codemie_test_harness.tests.utils.constants import ProjectManagementIntegrationType
15
19
 
@@ -46,4 +50,36 @@ pm_tools_test_data = [
46
50
  marks=[pytest.mark.confluence, pytest.mark.confluence_cloud],
47
51
  id=ProjectManagementIntegrationType.CONFLUENCE_CLOUD,
48
52
  ),
53
+ pytest.param(
54
+ ProjectManagementTool.JIRA,
55
+ ProjectManagementIntegrationType.JIRA,
56
+ get_jira_tool_create_prompt("server"),
57
+ get_response_for_jira_tool_create("server"),
58
+ marks=[pytest.mark.jira],
59
+ id=f"{ProjectManagementIntegrationType.JIRA.value} - create",
60
+ ),
61
+ pytest.param(
62
+ ProjectManagementTool.JIRA,
63
+ ProjectManagementIntegrationType.JIRA_CLOUD,
64
+ get_jira_tool_create_prompt("cloud"),
65
+ get_response_for_jira_tool_create("cloud"),
66
+ marks=[pytest.mark.jira, pytest.mark.jira_cloud],
67
+ id=f"{ProjectManagementIntegrationType.JIRA_CLOUD.value} - create",
68
+ ),
69
+ pytest.param(
70
+ ProjectManagementTool.CONFLUENCE,
71
+ ProjectManagementIntegrationType.CONFLUENCE,
72
+ get_confluence_tool_create_prompt("server"),
73
+ get_response_for_confluence_tool_create("server"),
74
+ marks=[pytest.mark.confluence],
75
+ id=f"{ProjectManagementIntegrationType.CONFLUENCE.value} - create",
76
+ ),
77
+ pytest.param(
78
+ ProjectManagementTool.CONFLUENCE,
79
+ ProjectManagementIntegrationType.CONFLUENCE_CLOUD,
80
+ get_confluence_tool_create_prompt("cloud"),
81
+ get_response_for_confluence_tool_create("cloud"),
82
+ marks=[pytest.mark.confluence, pytest.mark.confluence_cloud],
83
+ id=f"{ProjectManagementIntegrationType.CONFLUENCE_CLOUD.value} - create",
84
+ ),
49
85
  ]
@@ -4,21 +4,11 @@ import re
4
4
  import string
5
5
  import time
6
6
  import unicodedata
7
- from time import sleep
8
7
 
9
8
  from hamcrest import assert_that, equal_to, contains_string
10
9
 
11
10
  from codemie_sdk import CodeMieClient
12
- from codemie_sdk.exceptions import ApiError
13
- from codemie_sdk.models.workflow_state import (
14
- WorkflowExecutionState,
15
- WorkflowExecutionStatusEnum,
16
- )
17
- from codemie_sdk.services.workflow_execution_state import (
18
- WorkflowExecutionStateService,
19
- )
20
11
  from codemie_test_harness.tests import autotest_entity_prefix
21
- from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
22
12
 
23
13
 
24
14
  class BaseUtils:
@@ -47,29 +37,6 @@ def to_camel_case(input_string):
47
37
  return camel_case
48
38
 
49
39
 
50
- def wait_for_completion(
51
- execution_state_service: WorkflowExecutionStateService,
52
- state_id: str,
53
- timeout: int = int(CredentialsManager.get_parameter("DEFAULT_TIMEOUT", "120")),
54
- pool_interval: int = 3,
55
- ) -> WorkflowExecutionState:
56
- start_time = time.time()
57
- while time.time() - start_time < timeout:
58
- states = [row for row in execution_state_service.list() if row.id == state_id]
59
- if len(states) == 0:
60
- sleep(pool_interval)
61
- continue
62
- state = states[0]
63
- if state.status == WorkflowExecutionStatusEnum.SUCCEEDED:
64
- return state
65
- elif state.status == WorkflowExecutionStatusEnum.FAILED:
66
- raise ApiError(
67
- f"State execution failed: {execution_state_service.get_output(state_id)}"
68
- )
69
- sleep(pool_interval)
70
- raise TimeoutError("State was not executed within the timeout period.")
71
-
72
-
73
40
  def clean_json(json_str):
74
41
  try:
75
42
  # Attempt to parse the JSON string directly
@@ -0,0 +1,128 @@
1
+ import logging
2
+
3
+ import requests
4
+
5
+ from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ CONFLUENCE_SPACE_KEYS = {"server": "EPMCDMETST", "cloud": "CODEMIE"}
10
+
11
+
12
+ class ConfluenceUtils:
13
+ """Utility class for interacting with Confluence API."""
14
+
15
+ def __init__(self, is_cloud: bool = False):
16
+ """
17
+ Initialize Confluence utilities with credentials from CredentialsManager.
18
+
19
+ Args:
20
+ is_cloud: Whether to use Confluence Cloud or Confluence Server credentials
21
+ """
22
+ self.is_cloud = is_cloud
23
+
24
+ if is_cloud:
25
+ self.confluence_url = CredentialsManager.get_parameter(
26
+ "CONFLUENCE_CLOUD_URL"
27
+ )
28
+ self.token = CredentialsManager.get_parameter("CONFLUENCE_CLOUD_TOKEN")
29
+ self.email = CredentialsManager.get_parameter("CONFLUENCE_CLOUD_EMAIL")
30
+ self.auth = (self.email, self.token)
31
+ self.headers = {
32
+ "Accept": "application/json",
33
+ "Content-Type": "application/json",
34
+ }
35
+ self.confluence_api = "/wiki/api/v2"
36
+ self.pages_endpoint = "/pages"
37
+ self.space_key = CONFLUENCE_SPACE_KEYS["cloud"]
38
+ else:
39
+ self.confluence_url = CredentialsManager.get_parameter("CONFLUENCE_URL")
40
+ self.token = CredentialsManager.get_parameter("CONFLUENCE_TOKEN")
41
+ self.email = None
42
+ self.auth = None
43
+ self.headers = {
44
+ "Authorization": f"Bearer {self.token}",
45
+ "Accept": "application/json",
46
+ "Content-Type": "application/json",
47
+ }
48
+ self.confluence_api = "/rest/api"
49
+ self.pages_endpoint = "/content"
50
+ self.space_key = CONFLUENCE_SPACE_KEYS["server"]
51
+
52
+ def delete_confluence_page(self, page_id: str):
53
+ """
54
+ Delete a Confluence page via Confluence API.
55
+
56
+ Args:
57
+ page_id: The Confluence page ID
58
+ """
59
+ # Construct API endpoint
60
+ endpoint = (
61
+ f"{self.confluence_url}{self.confluence_api}{self.pages_endpoint}/{page_id}"
62
+ )
63
+
64
+ try:
65
+ logger.info(f"Deleting Confluence page: {page_id}")
66
+ requests.delete(
67
+ url=endpoint,
68
+ headers=self.headers,
69
+ auth=self.auth,
70
+ verify=True,
71
+ )
72
+ except requests.exceptions.RequestException as e:
73
+ logger.error(f"Error deleting Confluence page {page_id}: {str(e)}")
74
+
75
+ def cleanup_confluence_space(self, title_prefix: str, space_key: str = None):
76
+ """
77
+ Clean up Confluence pages in a space with title starting with specified prefix.
78
+
79
+ Args:
80
+ title_prefix: The prefix to filter pages by title (e.g., autotest_entity_prefix)
81
+ space_key: The Confluence space key (e.g., 'TEST')
82
+ """
83
+ space_key = self.space_key if not space_key else space_key
84
+
85
+ try:
86
+ # Search for pages in the space
87
+ search_endpoint = (
88
+ f"{self.confluence_url}{self.confluence_api}{self.pages_endpoint}"
89
+ )
90
+ params = {
91
+ "spaceKey": space_key,
92
+ "type": "page",
93
+ "limit": 100,
94
+ }
95
+
96
+ logger.info(
97
+ f"Searching for Confluence pages in space {space_key} with title starting with '{title_prefix}'"
98
+ )
99
+ response = requests.get(
100
+ url=search_endpoint,
101
+ headers=self.headers,
102
+ auth=self.auth,
103
+ params=params,
104
+ verify=True,
105
+ )
106
+
107
+ if response.status_code == 200:
108
+ all_pages = response.json().get("results", [])
109
+
110
+ # Filter pages by title prefix
111
+ pages_to_delete = [
112
+ page
113
+ for page in all_pages
114
+ if page.get("title", "").startswith(title_prefix)
115
+ ]
116
+
117
+ # Delete each page
118
+ for page in pages_to_delete:
119
+ self.delete_confluence_page(page["id"])
120
+ else:
121
+ logger.error(
122
+ f"Failed to search for pages. Status: {response.status_code}, Response: {response.text}"
123
+ )
124
+
125
+ except requests.exceptions.RequestException as e:
126
+ logger.error(
127
+ f"Error during Confluence cleanup for space {space_key}: {str(e)}"
128
+ )
@@ -0,0 +1,128 @@
1
+ import logging
2
+
3
+ import requests
4
+
5
+ from codemie_test_harness.tests.utils.credentials_manager import CredentialsManager
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ JIRA_PROJECT_KEYS = {"server": "EPMCDMETST", "cloud": "SCRUM"}
10
+
11
+
12
+ class JiraUtils:
13
+ """Utility class for interacting with Jira API."""
14
+
15
+ def __init__(self, is_cloud: bool = False):
16
+ """
17
+ Initialize Jira utilities with credentials from CredentialsManager.
18
+
19
+ Args:
20
+ is_cloud: Whether to use Jira Cloud or Jira Server credentials
21
+ """
22
+ self.is_cloud = is_cloud
23
+
24
+ if is_cloud:
25
+ self.jira_url = CredentialsManager.get_parameter("JIRA_CLOUD_URL")
26
+ self.token = CredentialsManager.get_parameter("JIRA_CLOUD_TOKEN")
27
+ self.email = CredentialsManager.get_parameter("JIRA_CLOUD_EMAIL")
28
+ self.auth = (self.email, self.token)
29
+ self.headers = {
30
+ "Accept": "application/json",
31
+ "Content-Type": "application/json",
32
+ }
33
+ self.jira_api = "/rest/api/3"
34
+ self.search_endpoint = "/search/jql"
35
+ self.project_key = JIRA_PROJECT_KEYS["cloud"]
36
+ else:
37
+ self.jira_url = CredentialsManager.get_parameter("JIRA_URL")
38
+ self.token = CredentialsManager.get_parameter("JIRA_TOKEN")
39
+ self.email = None
40
+ self.auth = None
41
+ self.headers = {
42
+ "Authorization": f"Bearer {self.token}",
43
+ "Accept": "application/json",
44
+ "Content-Type": "application/json",
45
+ }
46
+ self.jira_api = "/rest/api/2"
47
+ self.search_endpoint = "/search"
48
+ self.project_key = JIRA_PROJECT_KEYS["server"]
49
+
50
+ def delete_jira_item(self, issue_key: str):
51
+ """
52
+ Delete a Jira issue via Jira API.
53
+
54
+ Args:
55
+ issue_key: The Jira issue key (e.g., 'PROJ-123')
56
+ """
57
+ # Construct API endpoint
58
+ endpoint = f"{self.jira_url}{self.jira_api}/issue/{issue_key}"
59
+
60
+ try:
61
+ logger.info(f"Deleting Jira issue: {issue_key}")
62
+ requests.delete(
63
+ url=endpoint,
64
+ headers=self.headers,
65
+ auth=self.auth,
66
+ verify=True,
67
+ )
68
+ except requests.exceptions.RequestException as e:
69
+ logger.error(f"Error deleting Jira issue {issue_key}: {str(e)}")
70
+
71
+ def cleanup_jira_project(self, summary_prefix: str, project_key: str = None):
72
+ """
73
+ Clean up Jira issues in a project with summary starting with specified prefix.
74
+
75
+ Args:
76
+ project_key: The Jira project key (e.g., 'EPMCDMETST')
77
+ summary_prefix: The prefix to filter issues by summary (e.g., autotest_entity_prefix)
78
+ """
79
+ # Construct JQL query to find all issues in the project
80
+ # We'll filter by summary prefix in Python since JQL text search has limitations
81
+ project_key = self.project_key if not project_key else project_key
82
+
83
+ jql = f'project = "{project_key}"'
84
+
85
+ try:
86
+ # Search for issues matching the JQL
87
+ search_endpoint = f"{self.jira_url}{self.jira_api}{self.search_endpoint}"
88
+ params = {
89
+ "jql": jql,
90
+ "maxResults": 100,
91
+ "fields": "key,summary",
92
+ }
93
+
94
+ logger.info(
95
+ f"Searching for Jira issues in project {project_key} with summary starting with '{summary_prefix}'"
96
+ )
97
+ response = requests.get(
98
+ url=search_endpoint,
99
+ headers=self.headers,
100
+ auth=self.auth,
101
+ params=params,
102
+ verify=True,
103
+ )
104
+
105
+ if response.status_code == 200:
106
+ all_issues = response.json().get("issues", [])
107
+
108
+ # Filter issues by summary prefix in Python
109
+ issues_to_delete = [
110
+ issue
111
+ for issue in all_issues
112
+ if issue.get("fields", {})
113
+ .get("summary", "")
114
+ .startswith(summary_prefix)
115
+ ]
116
+
117
+ # Delete each issue
118
+ for issue in issues_to_delete:
119
+ self.delete_jira_item(issue["key"])
120
+ else:
121
+ logger.error(
122
+ f"Failed to search for issues. Status: {response.status_code}, Response: {response.text}"
123
+ )
124
+
125
+ except requests.exceptions.RequestException as e:
126
+ logger.error(
127
+ f"Error during Jira cleanup for project {project_key}: {str(e)}"
128
+ )
@@ -3,9 +3,9 @@ from hamcrest import assert_that, greater_than_or_equal_to
3
3
 
4
4
  from codemie_test_harness.tests.utils.base_utils import (
5
5
  wait_for_entity,
6
- wait_for_completion,
7
6
  clean_json,
8
7
  )
8
+ from codemie_test_harness.tests.utils.workflow_utils import WorkflowUtils
9
9
 
10
10
 
11
11
  class SimilarityCheck:
@@ -27,7 +27,7 @@ class SimilarityCheck:
27
27
  lambda: states_service.list(),
28
28
  entity_name="similarity_analysis",
29
29
  )
30
- wait_for_completion(execution_state_service=states_service, state_id=state.id)
30
+ WorkflowUtils.wait_for_completion(service=states_service, _id=state.id)
31
31
  output = states_service.get_output(state_id=state.id).output
32
32
  output = int(clean_json(output).get("similarity_rank"))
33
33
  assert_that(
@@ -1,21 +1,37 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  from typing import Optional
4
+ import time
4
5
 
6
+
7
+ from codemie_sdk.exceptions import ApiError
5
8
  from codemie_sdk.models.workflow import (
6
9
  WorkflowCreateRequest,
7
10
  WorkflowUpdateRequest,
8
11
  WorkflowMode,
12
+ WorkflowExecution,
13
+ )
14
+ from codemie_sdk.models.workflow_state import (
15
+ WorkflowExecutionState,
16
+ WorkflowExecutionStatusEnum,
17
+ )
18
+ from codemie_sdk.services.workflow_execution import WorkflowExecutionService
19
+ from codemie_sdk.services.workflow_execution_state import WorkflowExecutionStateService
20
+
21
+ from codemie_test_harness.tests import (
22
+ PROJECT,
23
+ VERIFY_SSL,
24
+ API_DOMEN,
25
+ CredentialsManager,
9
26
  )
10
-
11
- from codemie_test_harness.tests import PROJECT, VERIFY_SSL, API_DOMEN
12
27
  from codemie_test_harness.tests.utils.base_utils import (
13
28
  BaseUtils,
14
29
  get_random_name,
15
30
  wait_for_entity,
16
- wait_for_completion,
17
31
  )
18
32
  from codemie_test_harness.tests.utils.http_utils import RequestHandler
33
+ from time import sleep
34
+
19
35
 
20
36
  workflow_endpoint = "/v1/workflows"
21
37
 
@@ -106,17 +122,21 @@ class WorkflowUtils(BaseUtils):
106
122
  file_name: Optional[str] = None,
107
123
  ):
108
124
  self.client.workflows.run(workflow, user_input=user_input, file_name=file_name)
109
- executions = self.client.workflows.executions(workflow)
125
+ executions_service = self.client.workflows.executions(workflow)
110
126
  execution_id = next(
111
- row.execution_id for row in executions.list() if row.prompt == user_input
127
+ row.execution_id
128
+ for row in executions_service.list()
129
+ if row.prompt == user_input
112
130
  )
113
- states_service = executions.states(execution_id)
131
+ states_service = executions_service.states(execution_id)
114
132
  state = wait_for_entity(
115
133
  lambda: states_service.list(),
116
134
  entity_name=execution_name,
117
135
  )
118
136
 
119
- wait_for_completion(execution_state_service=states_service, state_id=state.id)
137
+ self.wait_for_completion(service=states_service, _id=state.id)
138
+ self.wait_for_completion(service=executions_service, _id=execution_id)
139
+
120
140
  return states_service.get_output(state_id=state.id).output
121
141
 
122
142
  def run_workflow(self, workflow_id, user_input=""):
@@ -279,3 +299,39 @@ class WorkflowUtils(BaseUtils):
279
299
  process_thought(thought)
280
300
 
281
301
  return triggered_tools
302
+
303
+ @staticmethod
304
+ def wait_for_completion(
305
+ service: WorkflowExecutionStateService | WorkflowExecutionService,
306
+ _id: str,
307
+ timeout: int = int(CredentialsManager.get_parameter("DEFAULT_TIMEOUT", "120")),
308
+ pool_interval: int = 3,
309
+ ) -> WorkflowExecutionState | WorkflowExecution:
310
+ is_workflow_execution_state_state = isinstance(
311
+ service, WorkflowExecutionStateService
312
+ )
313
+ start_time = time.time()
314
+ while time.time() - start_time < timeout:
315
+ executions_or_states = [
316
+ row
317
+ for row in service.list()
318
+ if row.id == _id or row.execution_id == _id
319
+ ]
320
+ if len(executions_or_states) == 0:
321
+ sleep(pool_interval)
322
+ continue
323
+ execution_or_state = executions_or_states[0]
324
+ if execution_or_state.status == WorkflowExecutionStatusEnum.SUCCEEDED:
325
+ return execution_or_state
326
+ elif execution_or_state.status == WorkflowExecutionStatusEnum.FAILED:
327
+ if is_workflow_execution_state_state:
328
+ raise ApiError(f"State execution failed: {service.get_output(_id)}")
329
+ else:
330
+ raise ApiError(
331
+ f"Execution failed. Execution id: {execution_or_state.execution_id}"
332
+ )
333
+ sleep(pool_interval)
334
+ if is_workflow_execution_state_state:
335
+ raise TimeoutError("State was not executed within the timeout period.")
336
+ else:
337
+ raise TimeoutError("Workflow was not executed within the timeout period.")
@@ -54,7 +54,6 @@ class StateModel(BaseModel):
54
54
 
55
55
 
56
56
  class WorkflowYamlModel(BaseModel):
57
- enable_summarization_node: bool = False
58
57
  tools: List[ToolModel] = Field(default_factory=list)
59
58
  assistants: List[AssistantModel] = Field(default_factory=list)
60
59
  states: List[StateModel] = Field(default_factory=list)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codemie-test-harness
3
- Version: 0.1.212
3
+ Version: 0.1.214
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.212)
16
+ Requires-Dist: codemie-sdk-python (==0.1.214)
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)
@@ -55,7 +55,7 @@ codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_developmen
55
55
  codemie_test_harness/tests/assistant/tools/plugin/test_assistant_with_plugin_and_mcp_servers.py,sha256=YjKlVactCaPZhRXLu3GQXrPPgVHkUrbTgwhNbz-OP84,2239
56
56
  codemie_test_harness/tests/assistant/tools/plugin/test_single_assistant_dual_time_plugins.py,sha256=6CmNPIaFXpJdvCmV1xu48v8mXWxL0O83ecQYthENvPE,5386
57
57
  codemie_test_harness/tests/assistant/tools/project_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py,sha256=uO51ff-GXbPE_fSvTGOeaMSfEXXDLSmFbCjjwl6KpGU,6022
58
+ codemie_test_harness/tests/assistant/tools/project_management/test_assistant_pm_tools.py,sha256=gmoNr2XEZA2hgKtlnY9ULZnQW_rId9v6O5dvZdKokjk,6024
59
59
  codemie_test_harness/tests/assistant/tools/report_portal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  codemie_test_harness/tests/assistant/tools/report_portal/test_assistant_report_portal_tools.py,sha256=bGv3MS7hV3yX5S3QwaeoWkA273QCOKYAew7M4BhDUso,969
61
61
  codemie_test_harness/tests/assistant/tools/research/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,7 +64,7 @@ codemie_test_harness/tests/assistant/tools/servicenow/__init__.py,sha256=47DEQpj
64
64
  codemie_test_harness/tests/assistant/tools/servicenow/test_servicenow_tools.py,sha256=aUjfZ4773WoQJjcHx3JqH5e8ckaKB-aIMO-OZWTm0Ek,888
65
65
  codemie_test_harness/tests/assistant/tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  codemie_test_harness/tests/assistant/tools/vcs/test_assistant_with_vcs_tools.py,sha256=qOPr4XOh2rgUV2MXMxkRzRGkAKl9ViwQGCZ-dMEtscU,1145
67
- codemie_test_harness/tests/conftest.py,sha256=tgWV8m7JHElbFaQ8eWm2CdlcIdZpb93s6KeuUp40xHc,31939
67
+ codemie_test_harness/tests/conftest.py,sha256=zSOjH7Pak73BtntTPNBdBS488xJag28jNsJRzTOvh5E,32640
68
68
  codemie_test_harness/tests/conversations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
69
  codemie_test_harness/tests/conversations/test_conversations_endpoints.py,sha256=HQ2nu9lXfRNkyJhA0rzar7Rmv6pMe-te0rFYAy-X5UA,4128
70
70
  codemie_test_harness/tests/e2e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -161,8 +161,8 @@ codemie_test_harness/tests/test_data/open_api_tools_test_data.py,sha256=mvf0legy
161
161
  codemie_test_harness/tests/test_data/openapi.json,sha256=X4uqtfjpTUuMifefQRf8mHI1k8pspp8-L0rpJlhLOI4,10459
162
162
  codemie_test_harness/tests/test_data/output_schema_test_data.py,sha256=4l7AvXbMl9hIvoFxu1LPPSGz9hb5Uz2_is4zTm77ARY,261
163
163
  codemie_test_harness/tests/test_data/plugin_tools_test_data.py,sha256=bVamztyQ4bAVo1CRSrtu6f5H-gkjhAN2nq5Jbc0erqM,4168
164
- codemie_test_harness/tests/test_data/pm_tools_test_data.py,sha256=ctPwLSJYy7xPg4B-uwAAhRwIogdxTgBn-PPY2rN0llc,3248
165
- codemie_test_harness/tests/test_data/project_management_test_data.py,sha256=oBOh18LbXKntdsifoktc-d-3M7Kyl8j0q7qumdHuTYU,1692
164
+ codemie_test_harness/tests/test_data/pm_tools_test_data.py,sha256=SnXG0knX7uMb-jMvbmE1OObzYQZQSCDQtD0tL2XTvIo,5256
165
+ codemie_test_harness/tests/test_data/project_management_test_data.py,sha256=2RWzrJmdlrOuJQKcmlWOfYz2daw_Oc2RkDU5XyM-w6U,3242
166
166
  codemie_test_harness/tests/test_data/report_portal_tools_test_data.py,sha256=YZdmfEwrwOdCduNxs768LOB8OHfL8sfNI-R2k-koKTk,14555
167
167
  codemie_test_harness/tests/test_data/research_tools_test_data.py,sha256=zwpzm-VSnrLZEfG97AE9Ms7z7j3xmqxiNd1EmZyWCSk,9102
168
168
  codemie_test_harness/tests/test_data/servicenow_tools_test_data.py,sha256=PKw9zEYSNcQM1KApCSjsBiA_3Py0bNQI7clqw8cmT-s,1983
@@ -269,8 +269,9 @@ codemie_test_harness/tests/ui/workflows/test_workflows.py,sha256=zRBFiQYhJ_MWKGG
269
269
  codemie_test_harness/tests/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
270
270
  codemie_test_harness/tests/utils/assistant_utils.py,sha256=2s1MikCfIcM3UlkcuwaedyxI2hePuWT3h8F3SDjBCtk,8022
271
271
  codemie_test_harness/tests/utils/aws_parameters_store.py,sha256=YAVpvwElkKZJZvzSVxtOue1Gjs-kvSBS2y5QvIlz484,3267
272
- codemie_test_harness/tests/utils/base_utils.py,sha256=SJV-m8KuC6MAU4W5a1sWLz6Nw-1-buc0f-W1hbA1OIY,8270
272
+ codemie_test_harness/tests/utils/base_utils.py,sha256=MaYrJIQVmOYjqMIkfr7fJYgZQhnIlRr-3Xp2QlA1Ak0,7000
273
273
  codemie_test_harness/tests/utils/client_factory.py,sha256=xGta0ZaVYzWfwJ4cu3f89KkGc_R5Bq-9lqnhr57x_2w,972
274
+ codemie_test_harness/tests/utils/confluence_utils.py,sha256=auhip1ntqSDsHWAoWCxQxfuNv05BinS6TWXyg_F2dfc,4544
274
275
  codemie_test_harness/tests/utils/constants.py,sha256=aGs0gdHB38Ozd-UyCKNpWRoQXMy3D0bjmfxiPcdZdqY,1165
275
276
  codemie_test_harness/tests/utils/conversation_utils.py,sha256=SWj6TBWOQoX5Yh6Wk63yHQFveRXgK1mpLb3PUKAa57A,648
276
277
  codemie_test_harness/tests/utils/credentials_manager.py,sha256=xF7fjQbT4b1rPrOOQfo3ie5c06FLjUzppvTaJDVOg2s,55252
@@ -281,6 +282,7 @@ codemie_test_harness/tests/utils/file_utils.py,sha256=hY-kwnyzvtd1BQif8r5NhvRTGf
281
282
  codemie_test_harness/tests/utils/gitbud_utils.py,sha256=-2nHX79FHLwoLN9crbTO4Q9scLXNmNgkw8N1_JUTqys,7972
282
283
  codemie_test_harness/tests/utils/http_utils.py,sha256=wjhttibzzNhleKzWgWC01Q0Y5sV9scu-Ski-qgJPd-Q,4179
283
284
  codemie_test_harness/tests/utils/integration_utils.py,sha256=FN9OORtIahATyjzfvwVmJ96mX0BTjk_xDPTQYBLS_8E,4417
285
+ codemie_test_harness/tests/utils/jira_utils.py,sha256=-n8Kqi7HZstRgrP4KClbijGbHpGMqgvoaYcN1CnHx8c,4635
284
286
  codemie_test_harness/tests/utils/json_utils.py,sha256=PWO4Ixxgta_zkdq-8umcP9qwDSi9JFxMuaT2NW3v1eI,226
285
287
  codemie_test_harness/tests/utils/llm_utils.py,sha256=JPAlMYh-wQH4any5HWdpQOejCbhjqJCsztRU_fUq-SU,257
286
288
  codemie_test_harness/tests/utils/logger_util.py,sha256=6Kca4pLxyTYnUgm2i3j19DdZSH6XUSGXPjHtExx33QU,828
@@ -288,11 +290,11 @@ codemie_test_harness/tests/utils/notification_utils.py,sha256=WyrO8Udp4O8-C4eI6w
288
290
  codemie_test_harness/tests/utils/provider_utils.py,sha256=NSI5vG1IPpzsytuwQAGbx9Fe0xN6OYQ9Gp9mvjO0H2g,5115
289
291
  codemie_test_harness/tests/utils/pytest_utils.py,sha256=k-mEjX2qpnh37sqKpJqYhZT6BV9974y_KaAhv8Xj9GI,284
290
292
  codemie_test_harness/tests/utils/search_utils.py,sha256=SrXiB2d9wiI5ka9bgg0CD73GOX_1mqi2Hz5FBm5DsEU,1435
291
- codemie_test_harness/tests/utils/similarity_check.py,sha256=1U66NGh6esISKABodtVobE2WnuFt0f6vcK3qUri6ZqU,1485
293
+ codemie_test_harness/tests/utils/similarity_check.py,sha256=2URqvD3Ft7efwLmhh2iYVsXrYboP9f-_B_ekZmJn0ac,1527
292
294
  codemie_test_harness/tests/utils/user_utils.py,sha256=zJNrmL3Fb7iGuaVRobUMwJ2Og6NqEPcM_9lw60m18T8,242
293
295
  codemie_test_harness/tests/utils/webhook_utils.py,sha256=YjyLwAqQjR12vYFOUmYhJCJIyZvKm4SvU-1oIjIYNqg,340
294
- codemie_test_harness/tests/utils/workflow_utils.py,sha256=d0dT5ciaLCDrRPZ-uwgGvWBhOdDExebH_h_Q3oJ4KOY,9261
295
- codemie_test_harness/tests/utils/yaml_utils.py,sha256=y9fUf4u4G4SoCktPOwaC5x71iaDKhktbz_XUfI9kNis,1661
296
+ codemie_test_harness/tests/utils/workflow_utils.py,sha256=tCSJ-6QyumveTP15ZiNzlkBgGxg97GcKV5Kkc02k_Zs,11409
297
+ codemie_test_harness/tests/utils/yaml_utils.py,sha256=iIdEl-rUUh1LgzAmD_mjfftthhvlzXyCuA37yBoH0Gw,1617
296
298
  codemie_test_harness/tests/webhook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
297
299
  codemie_test_harness/tests/webhook/test_webhook_service.py,sha256=POmxQG0tpcNW9-yKQ62CcnQpUEFYlTOs0_4H9MijIHY,8127
298
300
  codemie_test_harness/tests/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -400,7 +402,7 @@ codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/__init__.
400
402
  codemie_test_harness/tests/workflow/virtual_assistant_tools/servicenow/test_workflow_with_servicenow_tools.py,sha256=D835gaRbCnB4va5mi9TdA_u9StSpGXQ_fgzwW0S2pwo,1173
401
403
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
402
404
  codemie_test_harness/tests/workflow/virtual_assistant_tools/vcs/test_workflow_with_vcs_tools.py,sha256=Se9imIiBYuJU78m1pLu0g4ZmHygKZjr6JjIWkGXTy1Q,1364
403
- codemie_test_harness-0.1.212.dist-info/METADATA,sha256=W5xS3t-HJlwgBaSWN5f45rK24dhfJB53iYFW-3XERzc,27184
404
- codemie_test_harness-0.1.212.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
405
- codemie_test_harness-0.1.212.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
406
- codemie_test_harness-0.1.212.dist-info/RECORD,,
405
+ codemie_test_harness-0.1.214.dist-info/METADATA,sha256=P60BQniiZByraDIAxld3bYLAQ1l5dhPAk8OLFvxwKVs,27184
406
+ codemie_test_harness-0.1.214.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
407
+ codemie_test_harness-0.1.214.dist-info/entry_points.txt,sha256=n98t-EOM5M1mnMl_j2X4siyeO9zr0WD9a5LF7JyElIM,73
408
+ codemie_test_harness-0.1.214.dist-info/RECORD,,