codemie-test-harness 0.1.168__py3-none-any.whl → 0.1.170__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.

Files changed (22) hide show
  1. codemie_test_harness/cli/cli.py +18 -74
  2. codemie_test_harness/cli/commands/assistant_cmd.py +104 -0
  3. codemie_test_harness/cli/commands/config_cmd.py +610 -20
  4. codemie_test_harness/cli/commands/workflow_cmd.py +64 -0
  5. codemie_test_harness/cli/constants.py +385 -6
  6. codemie_test_harness/cli/utils.py +9 -0
  7. codemie_test_harness/tests/test_data/assistant_test_data.py +197 -0
  8. codemie_test_harness/tests/test_data/project_management_test_data.py +1 -1
  9. codemie_test_harness/tests/ui/assistants/__init__.py +0 -0
  10. codemie_test_harness/tests/ui/assistants/test_create_assistant.py +408 -0
  11. codemie_test_harness/tests/ui/conftest.py +23 -3
  12. codemie_test_harness/tests/ui/pageobject/assistants/assistants_page.py +3 -4
  13. codemie_test_harness/tests/ui/pageobject/assistants/create_assistant_page.py +689 -0
  14. codemie_test_harness/tests/ui/pageobject/assistants/generate_with_ai_modal.py +367 -0
  15. codemie_test_harness/tests/ui/pageobject/base_page.py +2 -2
  16. codemie_test_harness/tests/ui/pytest.ini +18 -0
  17. codemie_test_harness/tests/ui/workflows/test_workflows.py +1 -1
  18. codemie_test_harness/tests/utils/credentials_manager.py +0 -15
  19. {codemie_test_harness-0.1.168.dist-info → codemie_test_harness-0.1.170.dist-info}/METADATA +2 -2
  20. {codemie_test_harness-0.1.168.dist-info → codemie_test_harness-0.1.170.dist-info}/RECORD +22 -14
  21. {codemie_test_harness-0.1.168.dist-info → codemie_test_harness-0.1.170.dist-info}/WHEEL +0 -0
  22. {codemie_test_harness-0.1.168.dist-info → codemie_test_harness-0.1.170.dist-info}/entry_points.txt +0 -0
@@ -6,8 +6,8 @@ from codemie_test_harness.tests.test_data.pm_tools_test_data import (
6
6
  RESPONSE_FOR_JIRA_TOOL,
7
7
  CONFLUENCE_TOOL_PROMPT,
8
8
  RESPONSE_FOR_CONFLUENCE_TOOL,
9
- JIRA_CLOUD_TOOL_PROMPT,
10
9
  RESPONSE_FOR_JIRA_CLOUD_TOOL,
10
+ JIRA_CLOUD_TOOL_PROMPT,
11
11
  CONFLUENCE_CLOUD_TOOL_PROMPT,
12
12
  RESPONSE_FOR_CONFLUENCE_CLOUD_TOOL,
13
13
  )
File without changes
@@ -0,0 +1,408 @@
1
+ """
2
+ UI Test Suite for Create Assistant Feature - Critical Happy Path Scenarios
3
+
4
+ This test suite implements UI automated tests for the "create assistant" feature
5
+ following Page Object Model (POM) best practices as specified in JIRA ticket EPMCDME-8153.
6
+
7
+ Test Coverage:
8
+ - Critical happy path for assistant creation workflow
9
+ - Form field interactions and validation
10
+ - Navigation and UI component verification
11
+ - Essential assistant creation scenarios
12
+ - AI Generator modal handling
13
+
14
+ Exclusions (as per requirements):
15
+ - Edge cases and negative scenarios
16
+ - Advanced configuration testing
17
+ - Complex error handling scenarios
18
+
19
+ Architecture:
20
+ - Follows Page Object Model (POM) pattern
21
+ - Reusable UI components abstracted into dedicated classes
22
+ - Comprehensive locator strategies with fallbacks
23
+ - Property-based element access for maintainability
24
+ - Integration with AIAssistantGeneratorPage modal
25
+ """
26
+
27
+ import pytest
28
+
29
+ from codemie_test_harness.tests.test_data.assistant_test_data import (
30
+ get_minimal_assistant_data,
31
+ )
32
+ from codemie_test_harness.tests.ui.pageobject.assistants.assistants_page import (
33
+ AssistantsPage,
34
+ )
35
+ from codemie_test_harness.tests.ui.pageobject.assistants.create_assistant_page import (
36
+ CreateAssistantPage,
37
+ )
38
+
39
+
40
+ # noinspection PyArgumentList
41
+ class TestCreateAssistantPageElements:
42
+ """Test suite for Create Assistant page element visibility and structure."""
43
+
44
+ @pytest.mark.assistant_ui
45
+ @pytest.mark.ui
46
+ def test_create_assistant_page_elements_visibility(self, page):
47
+ """
48
+ Test that all main elements are visible on Create Assistant page.
49
+
50
+ This test verifies the basic page structure and essential UI components
51
+ are properly rendered and accessible to users.
52
+
53
+ Critical Elements Verified:
54
+ - Page title and navigation
55
+ - Essential form fields (name, description, system prompt)
56
+ - Action buttons (create, cancel)
57
+ - Common page components (header, navigation)
58
+ """
59
+ create_page = CreateAssistantPage(page)
60
+ create_page.navigate_to()
61
+
62
+ # Verify we are on the correct page
63
+ create_page.should_be_on_create_assistant_page()
64
+
65
+ # Verify essential form fields are visible
66
+ create_page.should_have_all_form_fields_visible()
67
+
68
+ # Verify action buttons are present
69
+ create_page.should_have_action_buttons_visible()
70
+
71
+ # Verify common page components
72
+ create_page.should_have_page_content_visible()
73
+ create_page.should_not_have_loading_indicator()
74
+
75
+ @pytest.mark.assistant_ui
76
+ @pytest.mark.ui
77
+ def test_create_assistant_navigation_from_assistants_page(self, page):
78
+ """
79
+ Test navigation to Create Assistant page from main Assistants page.
80
+
81
+ This test verifies the critical navigation path that users follow
82
+ to access the assistant creation functionality.
83
+
84
+ Navigation Flow:
85
+ 1. Navigate to Assistants page
86
+ 2. Click "Create Assistant" button
87
+ 3. Verify arrival at Create Assistant page
88
+ """
89
+ # Start from the main assistants page
90
+ assistants_page = AssistantsPage(page)
91
+ assistants_page.navigate_to()
92
+ assistants_page.should_be_on_assistants_page()
93
+
94
+ # Navigate to create assistant page
95
+ assistants_page.click_create_assistant()
96
+
97
+ # Verify we're on the create assistant page
98
+ create_page = CreateAssistantPage(page)
99
+ create_page.should_be_on_create_assistant_page()
100
+
101
+ @pytest.mark.assistant_ui
102
+ @pytest.mark.ui
103
+ def test_ai_generator_modal_visibility_and_handling(self, page):
104
+ """
105
+ Test AI Generator modal visibility and proper handling when navigating to Create Assistant page.
106
+
107
+ This test verifies that the AI Assistant Generator modal is properly handled
108
+ when it appears during navigation to the Create Assistant page.
109
+
110
+ Modal Handling Flow:
111
+ 1. Navigate to Create Assistant page
112
+ 2. Check if AI Generator modal appears
113
+ 3. Verify modal can be closed or handled appropriately
114
+ 4. Ensure manual form is accessible after modal handling
115
+ """
116
+ create_page = CreateAssistantPage(page)
117
+
118
+ # Navigate to create assistant page - this will handle the modal automatically
119
+ create_page.navigate_to()
120
+
121
+ # After navigation, modal should be handled and not visible
122
+ create_page.verify_ai_generator_modal_not_visible()
123
+
124
+ # Verify we can proceed with manual form
125
+ create_page.should_be_on_create_assistant_page()
126
+ create_page.should_have_all_form_fields_visible()
127
+
128
+ @pytest.mark.assistant_ui
129
+ @pytest.mark.ui
130
+ def test_ai_generator_modal_create_manually_workflow(self, page):
131
+ """
132
+ Test the workflow of using 'Create Manually' option from AI Generator modal.
133
+
134
+ This test verifies that users can properly choose manual creation
135
+ when the AI Generator modal appears.
136
+
137
+ Manual Creation Flow:
138
+ 1. Navigate to Create Assistant page
139
+ 2. If AI Generator modal appears, click 'Create Manually'
140
+ 3. Verify modal closes and manual form is accessible
141
+ 4. Proceed with manual assistant creation
142
+ """
143
+ create_page = CreateAssistantPage(page)
144
+
145
+ # Navigate without automatic modal handling
146
+ page.goto(create_page.page_url)
147
+ create_page.wait_for_page_load()
148
+
149
+ # If modal is visible, use 'Create Manually' option
150
+ if create_page.is_ai_generator_modal_visible():
151
+ # Verify modal is properly displayed
152
+ create_page.verify_ai_generator_modal_visible()
153
+
154
+ # Choose manual creation
155
+ create_page.create_manually_from_ai_modal()
156
+
157
+ # Verify modal is closed
158
+ create_page.verify_ai_generator_modal_not_visible()
159
+
160
+ # Verify manual form is accessible
161
+ create_page.should_be_on_create_assistant_page()
162
+ create_page.should_have_all_form_fields_visible()
163
+
164
+
165
+ # noinspection PyArgumentList
166
+ class TestCreateAssistantFormInteractions:
167
+ """Test suite for form field interactions and input validation."""
168
+
169
+ @pytest.mark.assistant_ui
170
+ @pytest.mark.ui
171
+ def test_create_assistant_form_field_interactions(self, page):
172
+ """
173
+ Test form field interactions and input handling.
174
+
175
+ This test verifies that users can successfully interact with all
176
+ essential form fields and that input values are properly retained.
177
+
178
+ Form Fields Tested:
179
+ - Assistant name input
180
+ - Description textarea
181
+ - System prompt textarea
182
+ - Icon URL input
183
+ - Shared toggle switch
184
+ """
185
+ create_page = CreateAssistantPage(page)
186
+ create_page.navigate_to()
187
+
188
+ # Test shared toggle interaction
189
+ create_page.toggle_shared_assistant(True)
190
+ create_page.should_have_shared_checked()
191
+
192
+ # Toggle back to private
193
+ create_page.toggle_shared_assistant(False)
194
+ create_page.should_have_shared_unchecked()
195
+
196
+ # Get test data using the factory
197
+ test_data = get_minimal_assistant_data()
198
+
199
+ # Test name field interaction
200
+ test_name = test_data.name
201
+ create_page.fill_name(test_name)
202
+ create_page.should_have_name_value(test_name)
203
+
204
+ # Test description field interaction
205
+ test_description = test_data.description
206
+ create_page.fill_description(test_description)
207
+ create_page.should_have_description_value(test_description)
208
+
209
+ # Test system prompt field interaction
210
+ test_prompt = test_data.system_prompt
211
+ create_page.fill_system_prompt(test_prompt)
212
+ create_page.should_have_system_prompt_value(test_prompt)
213
+
214
+ # Test icon URL field interaction
215
+ test_icon_url = test_data.icon_url
216
+ create_page.fill_icon_url(test_icon_url)
217
+ create_page.should_have_icon_url_value(test_icon_url)
218
+
219
+ @pytest.mark.assistant_ui
220
+ @pytest.mark.ui
221
+ def test_create_assistant_default_field_values(self, page):
222
+ """
223
+ Test default field values on page load.
224
+
225
+ This test verifies that form fields have appropriate default values
226
+ when the Create Assistant page is first loaded.
227
+
228
+ Default Values Verified:
229
+ - Empty name field
230
+ - Empty description field
231
+ - Empty system prompt field
232
+ - Unchecked shared toggle
233
+ - Default assistant type selection
234
+ """
235
+ create_page = CreateAssistantPage(page)
236
+ create_page.navigate_to()
237
+
238
+ # Verify default empty field values
239
+ create_page.should_have_empty_fields()
240
+
241
+ # Verify default buttons availability
242
+ create_page.should_have_create_button_disabled()
243
+ create_page.should_have_cancel_button_enabled()
244
+
245
+ # Verify default shared toggle state (should be unchecked/private)
246
+ create_page.should_have_shared_unchecked()
247
+
248
+
249
+ # noinspection PyArgumentList
250
+ class TestCreateAssistantCriticalHappyPath:
251
+ """
252
+ Test suite for critical happy path scenarios.
253
+
254
+ This test class focuses on the most important user workflows for creating assistants,
255
+ ensuring that the essential functionality works correctly for end users.
256
+ """
257
+
258
+ @pytest.mark.assistant_ui
259
+ @pytest.mark.ui
260
+ def test_create_assistant_minimal_required_fields(self, page):
261
+ """
262
+ Test assistant creation with minimal required fields - Critical Happy Path.
263
+
264
+ This test represents the core scenario outlined in JIRA ticket EPMCDME-8153:
265
+ 1. User navigates to Create Assistant page
266
+ 2. Fills essential fields (name, description, system prompt)
267
+ 3. Saves and publishes the assistant
268
+ 4. Verifies assistant appears in the assistants list
269
+
270
+ This is the most critical test case for the feature.
271
+ """
272
+ # Get test data using the factory
273
+ test_data = get_minimal_assistant_data()
274
+
275
+ # Navigate to create assistant page
276
+ create_page = CreateAssistantPage(page)
277
+ create_page.navigate_to()
278
+
279
+ # Use the comprehensive create_assistant method with test data
280
+ create_page.create_assistant(
281
+ name=test_data.name,
282
+ description=test_data.description,
283
+ system_prompt=test_data.system_prompt,
284
+ shared=test_data.shared,
285
+ )
286
+
287
+ # Verify successful creation
288
+ assistants_page = AssistantsPage(page)
289
+ assert_assistant_created_successfully(assistants_page, test_data.name)
290
+
291
+ @pytest.mark.assistant_ui
292
+ @pytest.mark.ui
293
+ def test_create_assistant_button_states_and_validation(self, page):
294
+ """
295
+ Test create button states.
296
+
297
+ This test ensures that the form validation works correctly and provides
298
+ appropriate feedback to users about required fields.
299
+ """
300
+ create_page = CreateAssistantPage(page)
301
+ create_page.navigate_to()
302
+
303
+ # Get test data using the factory
304
+ test_data = get_minimal_assistant_data()
305
+
306
+ # Fill required fields and verify button becomes enabled
307
+ create_page.fill_name(test_data.name)
308
+ create_page.should_have_create_button_disabled()
309
+ create_page.fill_description(test_data.description)
310
+ create_page.should_have_create_button_disabled()
311
+ create_page.fill_system_prompt(test_data.system_prompt)
312
+
313
+ # Verify create button is available for interaction
314
+ create_page.should_have_create_button_enabled()
315
+
316
+
317
+ # noinspection PyArgumentList
318
+ class TestCreateAssistantNavigation:
319
+ """Test suite for navigation functionality within the Create Assistant workflow."""
320
+
321
+ @pytest.mark.assistant_ui
322
+ @pytest.mark.ui
323
+ def test_create_assistant_cancel_navigation(self, page):
324
+ """
325
+ Test cancel functionality returns user to assistants list.
326
+
327
+ This test verifies that users can abort the assistant creation process
328
+ and return to the main assistants page without creating an assistant.
329
+
330
+ Navigation Flow:
331
+ 1. Navigate to Create Assistant page
332
+ 2. Fill some fields (simulate user input)
333
+ 3. Click Cancel button
334
+ 4. Verify return to Assistants page
335
+ """
336
+ create_page = CreateAssistantPage(page)
337
+ create_page.navigate_to()
338
+
339
+ # Get test data using the factory
340
+ test_data = get_minimal_assistant_data()
341
+
342
+ # Simulate some user input
343
+ create_page.fill_name(test_data.name)
344
+ create_page.fill_description(test_data.description)
345
+
346
+ # Cancel the creation process
347
+ create_page.click_cancel()
348
+
349
+ # Verify we're back on the assistants page
350
+ assistants_page = AssistantsPage(page)
351
+ assistants_page.should_be_on_assistants_page()
352
+
353
+ @pytest.mark.assistant_ui
354
+ @pytest.mark.ui
355
+ def test_create_assistant_back_button_navigation(self, page):
356
+ """
357
+ Test back button functionality returns user to previous page.
358
+
359
+ This test verifies that the back button works correctly and provides
360
+ users with an alternative way to return to the assistants list.
361
+
362
+ Navigation Flow:
363
+ 1. Start from Assistants page
364
+ 2. Navigate to Create Assistant page
365
+ 3. Click Back button
366
+ 4. Verify return to Assistants page
367
+ """
368
+ # Start from assistants page to establish navigation history
369
+ assistants_page = AssistantsPage(page)
370
+ assistants_page.navigate_to()
371
+ assistants_page.click_create_assistant()
372
+
373
+ # Now on create assistant page
374
+ create_page = CreateAssistantPage(page)
375
+ create_page.should_be_on_create_assistant_page()
376
+ create_page.handle_ai_generator_modal_if_visible()
377
+
378
+ # Use back button to return
379
+ create_page.click_back()
380
+
381
+ # Verify we're back on assistants page
382
+ assistants_page.should_be_on_assistants_page()
383
+
384
+
385
+ # ==================== HELPER METHODS FOR CUSTOM ASSERTIONS ====================
386
+
387
+
388
+ # noinspection PyArgumentList
389
+ def assert_assistant_created_successfully(
390
+ assistants_page: AssistantsPage, assistant_name: str
391
+ ):
392
+ """
393
+ Helper method to verify successful assistant creation.
394
+
395
+ Args:
396
+ assistants_page: The AssistantsPage instance
397
+ assistant_name: Name of the assistant to verify
398
+ """
399
+ assistants_page.should_be_on_assistants_page()
400
+ assistants_page.should_see_assistant_with_name(assistant_name)
401
+
402
+
403
+ # ==================== PYTEST MARKERS AND CONFIGURATION ====================
404
+
405
+ pytestmark = [
406
+ pytest.mark.assistant_ui, # Mark all tests in this module as assistant UI tests
407
+ pytest.mark.ui, # Mark all tests as UI tests
408
+ ]
@@ -1,12 +1,16 @@
1
1
  import logging
2
2
  import os
3
- import pytest
4
3
  from datetime import datetime
4
+ from time import sleep
5
5
 
6
- from codemie_test_harness.tests.ui.pageobject.login_page import LoginPage
7
-
6
+ import pytest
8
7
  from reportportal_client import RPLogger, RPLogHandler
9
8
 
9
+ from codemie_test_harness.tests import autotest_entity_prefix
10
+ from codemie_test_harness.tests.ui.pageobject.login_page import LoginPage
11
+ from codemie_test_harness.tests.utils.client_factory import get_client
12
+ from codemie_test_harness.tests.utils.env_resolver import EnvironmentResolver
13
+
10
14
  # Create ReportPortal logger
11
15
  logging.setLoggerClass(RPLogger)
12
16
  rp_logger = logging.getLogger("reportportal_logger")
@@ -85,3 +89,19 @@ def browser_type_launch_args():
85
89
  "headless": os.getenv("HEADLESS", "false").lower() == "true",
86
90
  "slow_mo": 150,
87
91
  }
92
+
93
+
94
+ def pytest_sessionfinish(session):
95
+ """Run cleanup code after all tests have finished."""
96
+ clean_up_timeout = 1 if EnvironmentResolver.is_production() else 0
97
+ client = get_client()
98
+ prefix = autotest_entity_prefix
99
+ assistants = client.assistants.list(filters={"search": prefix}, per_page=200)
100
+ for assistant in assistants:
101
+ if prefix in assistant.name:
102
+ client.assistants.delete(assistant_id=assistant.id)
103
+ sleep(clean_up_timeout)
104
+ conversations = client.conversations.list_by_assistant_id(assistant.id)
105
+ for conversation in conversations:
106
+ client.conversations.delete(conversation.id)
107
+ sleep(clean_up_timeout)
@@ -1,7 +1,6 @@
1
- from reportportal_client import step
2
- from playwright.sync_api import expect
3
-
4
1
  from codemie_test_harness.tests.ui.pageobject.base_page import BasePage
2
+ from playwright.sync_api import expect
3
+ from reportportal_client import step
5
4
 
6
5
 
7
6
  class AssistantsPage(BasePage):
@@ -132,7 +131,7 @@ class AssistantsPage(BasePage):
132
131
  @step
133
132
  def get_assistant_card_by_name(self, name: str):
134
133
  """Get assistant card by its name."""
135
- return self.page.locator(f'.assistant-card:has-text("{name}")')
134
+ return self.page.locator(".body.h-card").filter(has_text=name)
136
135
 
137
136
  @step
138
137
  def click_assistant_card(self, name: str):