Skip to content

Commit eb13873

Browse files
cgen-tc-fix
1 parent a49de2c commit eb13873

2 files changed

Lines changed: 100 additions & 68 deletions

File tree

content-gen/tests/e2e-test/pages/HomePage.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class HomePage(BasePage):
6464
CLEAR_ALL_BUTTON = "//button[normalize-space()='Clear All']"
6565
NO_CONVERSATIONS_TEXT = "//span[.='No conversations yet']"
6666
CHAT_HISTORY_MORE_OPTIONS = "(//button[@style='min-width: 24px; height: 24px; padding: 2px; color: var(--colorNeutralForeground3);'])[1]"
67+
HIDE_CHAT_HISTORY_BUTTON = "//button[@aria-label='Hide chat history']"
68+
SHOW_CHAT_HISTORY_BUTTON = "//button[@aria-label='Show chat history']"
6769

6870
# --- ERROR DETECTION PHRASES ---
6971
# Specific phrases indicating errors in AI responses.
@@ -185,6 +187,63 @@ def validate_chat_history(self):
185187
logger.error(f"❌ {error_msg}")
186188
raise AssertionError(error_msg) from e
187189

190+
def show_hide_chat_history(self):
191+
"""
192+
Validate show/hide chat history toggle functionality.
193+
Steps:
194+
1. Validate 'Hide chat history' button is visible and click it
195+
2. Validate chat history panel is hidden (CHAT_HISTORY not visible)
196+
3. Validate 'Show chat history' button is visible and click it
197+
4. Validate chat history panel is shown again (CHAT_HISTORY visible)
198+
"""
199+
logger.info("=" * 80)
200+
logger.info("Starting Show/Hide Chat History Validation")
201+
logger.info("=" * 80)
202+
203+
try:
204+
# Step 1: Click 'Hide chat history' button
205+
logger.info("Step 1: Clicking 'Hide chat history' button...")
206+
hide_button = self.page.locator(self.HIDE_CHAT_HISTORY_BUTTON)
207+
expect(hide_button).to_be_visible(timeout=10000)
208+
hide_button.click()
209+
self.page.wait_for_timeout(2000)
210+
logger.info("✓ 'Hide chat history' button clicked")
211+
212+
# Step 2: Validate chat history panel is hidden
213+
logger.info("Step 2: Validating chat history panel is hidden...")
214+
chat_history = self.page.locator(self.CHAT_HISTORY)
215+
expect(chat_history).not_to_be_visible(timeout=10000)
216+
logger.info("✓ Chat history panel is hidden")
217+
218+
# Step 3: Click 'Show chat history' button
219+
logger.info("Step 3: Clicking 'Show chat history' button...")
220+
show_button = self.page.locator(self.SHOW_CHAT_HISTORY_BUTTON)
221+
expect(show_button).to_be_visible(timeout=10000)
222+
show_button.click()
223+
self.page.wait_for_timeout(2000)
224+
logger.info("✓ 'Show chat history' button clicked")
225+
226+
# Step 4: Validate chat history panel is visible again
227+
logger.info("Step 4: Validating chat history panel is visible again...")
228+
expect(chat_history).to_be_visible(timeout=10000)
229+
logger.info("✓ Chat history panel is visible again")
230+
231+
logger.info("=" * 80)
232+
logger.info("Show/Hide Chat History Validation Completed Successfully!")
233+
logger.info("=" * 80)
234+
235+
return {
236+
'status': 'PASSED',
237+
'validation': 'Chat history show/hide toggle works correctly'
238+
}
239+
240+
except AssertionError:
241+
raise
242+
except Exception as e:
243+
error_msg = f"Failed to validate show/hide chat history: {str(e)}"
244+
logger.error(f"❌ {error_msg}")
245+
raise AssertionError(error_msg) from e
246+
188247
def rename_chat_history(self, new_name="updated_chat"):
189248
"""
190249
Rename a chat history item by hovering, clicking more options, and renaming.

content-gen/tests/e2e-test/tests/test_content_gen_gp_tc.py

Lines changed: 41 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def test_validate_gp(login_logout, request):
137137
raise
138138

139139

140-
@pytest.mark.skip(reason="Skipped - running only GP test")
141140
def test_validate_chat_history_panel(login_logout, request):
142141
"""
143142
Test case to validate chat history panel is displayed.
@@ -203,16 +202,12 @@ def test_validate_chat_history_panel(login_logout, request):
203202
raise
204203

205204

206-
@pytest.mark.skip(reason="Skipped - running only GP test")
207205
def test_validate_rename_chat_history(login_logout, request):
208206
"""
209207
Test case to validate renaming a chat history item.
210208
Steps:
211209
1. Validate home page elements are visible
212-
2. Send prompt from quick link
213-
3. Confirm brief
214-
4. Select color and generate content
215-
5. Rename chat history item
210+
2. Rename chat history item
216211
"""
217212
page = login_logout
218213
page.goto(URL)
@@ -227,38 +222,16 @@ def test_validate_rename_chat_history(login_logout, request):
227222
home.validate_home_page()
228223
step1_end = time.time()
229224

230-
# Step 2: Send Prompt from Quick Link
225+
# Step 2: Rename Chat History with dynamic name
231226
step2_start = time.time()
232-
home.send_prompt_from_quick_link(home.USER_MESSAGE)
233-
step2_end = time.time()
234-
235-
# Step 3: Confirm Brief
236-
step3_start = time.time()
237-
home.confirm_brief()
238-
step3_end = time.time()
239-
240-
# Step 4: Select Color and Generate Content
241-
step4_start = time.time()
242-
home.select_color_and_generate_content(
243-
color_locator=home.OLIVE_STONE_TEXT,
244-
generated_content_locator=home.GENERATED_CONTENT_TEXT_OLIVE,
245-
expected_color="olive"
246-
)
247-
step4_end = time.time()
248-
249-
# Step 5: Rename Chat History with dynamic name
250-
step5_start = time.time()
251227
dynamic_name = f"updated_chat_{int(time.time())}"
252228
home.rename_chat_history(dynamic_name)
253-
step5_end = time.time()
229+
step2_end = time.time()
254230

255231
# Log test summary
256232
step_times = [
257233
("Step 1 (Home Page Validation)", step1_end - step1_start),
258-
("Step 2 (Send Prompt)", step2_end - step2_start),
259-
("Step 3 (Confirm Brief)", step3_end - step3_start),
260-
("Step 4 (Generate Content)", step4_end - step4_start),
261-
("Step 5 (Rename Chat History)", step5_end - step5_start)
234+
("Step 2 (Rename Chat History)", step2_end - step2_start)
262235
]
263236
total_duration = log_test_summary(start_time, step_times, "Rename Chat History Test")
264237

@@ -270,7 +243,6 @@ def test_validate_rename_chat_history(login_logout, request):
270243
raise
271244

272245

273-
@pytest.mark.skip(reason="Skipped - running only GP test")
274246
def test_validate_delete_chat_history(login_logout, request):
275247
"""
276248
Test case to validate deleting a chat history item.
@@ -336,17 +308,13 @@ def test_validate_delete_chat_history(login_logout, request):
336308
raise
337309

338310

339-
@pytest.mark.skip(reason="Skipped - running only GP test")
340311
def test_validate_rename_empty_validation(login_logout, request):
341312
"""
342313
Test case to validate that the rename button is disabled and a validation
343314
message is shown when the conversation name input is empty.
344315
Steps:
345316
1. Validate home page elements are visible
346-
2. Send prompt from quick link
347-
3. Confirm brief
348-
4. Select color and generate content
349-
5. Validate rename button disabled and validation message displayed, then cancel
317+
2. Validate rename button disabled and validation message displayed, then cancel
350318
"""
351319
page = login_logout
352320
page.goto(URL)
@@ -361,37 +329,15 @@ def test_validate_rename_empty_validation(login_logout, request):
361329
home.validate_home_page()
362330
step1_end = time.time()
363331

364-
# Step 2: Send Prompt from Quick Link
332+
# Step 2: Validate rename button disabled & validation message, then cancel
365333
step2_start = time.time()
366-
home.send_prompt_from_quick_link(home.USER_MESSAGE)
367-
step2_end = time.time()
368-
369-
# Step 3: Confirm Brief
370-
step3_start = time.time()
371-
home.confirm_brief()
372-
step3_end = time.time()
373-
374-
# Step 4: Select Color and Generate Content
375-
step4_start = time.time()
376-
home.select_color_and_generate_content(
377-
color_locator=home.OLIVE_STONE_TEXT,
378-
generated_content_locator=home.GENERATED_CONTENT_TEXT_OLIVE,
379-
expected_color="olive"
380-
)
381-
step4_end = time.time()
382-
383-
# Step 5: Validate rename button disabled & validation message, then cancel
384-
step5_start = time.time()
385334
home.validate_rename_empty_validation()
386-
step5_end = time.time()
335+
step2_end = time.time()
387336

388337
# Log test summary
389338
step_times = [
390339
("Step 1 (Home Page Validation)", step1_end - step1_start),
391-
("Step 2 (Send Prompt)", step2_end - step2_start),
392-
("Step 3 (Confirm Brief)", step3_end - step3_start),
393-
("Step 4 (Generate Content)", step4_end - step4_start),
394-
("Step 5 (Rename Empty Validation)", step5_end - step5_start)
340+
("Step 2 (Rename Empty Validation)", step2_end - step2_start)
395341
]
396342
total_duration = log_test_summary(start_time, step_times, "Rename Empty Validation Test")
397343

@@ -403,7 +349,6 @@ def test_validate_rename_empty_validation(login_logout, request):
403349
raise
404350

405351

406-
@pytest.mark.skip(reason="Skipped - running only GP test")
407352
def test_validate_stop_generation(login_logout, request):
408353
"""
409354
Test case to validate stop generation functionality.
@@ -452,7 +397,6 @@ def test_validate_stop_generation(login_logout, request):
452397
raise
453398

454399

455-
@pytest.mark.skip(reason="Skipped - running only GP test")
456400
def test_validate_start_over(login_logout, request):
457401
"""
458402
Test case to validate start over functionality after stopping generation.
@@ -503,7 +447,6 @@ def test_validate_start_over(login_logout, request):
503447
raise
504448

505449

506-
@pytest.mark.skip(reason="Skipped - running only GP test")
507450
def test_validate_start_new_chat(login_logout, request):
508451
"""
509452
Test case to validate start new chat functionality after content generation.
@@ -570,7 +513,6 @@ def test_validate_start_new_chat(login_logout, request):
570513
raise
571514

572515

573-
@pytest.mark.skip(reason="Skipped - running only GP test")
574516
def test_validate_input_disabled_during_generation(login_logout, request):
575517
"""
576518
Test case to validate that the input field and send button are disabled
@@ -619,7 +561,6 @@ def test_validate_input_disabled_during_generation(login_logout, request):
619561
raise
620562

621563

622-
@pytest.mark.skip(reason="Skipped - running only GP test")
623564
def test_validate_download_image(login_logout, request):
624565
"""
625566
Test case to validate download image functionality after content generation.
@@ -685,7 +626,39 @@ def test_validate_download_image(login_logout, request):
685626
raise
686627

687628

688-
@pytest.mark.skip(reason="Skipped - running only GP test")
629+
def test_validate_show_hide_chat_history(login_logout, request):
630+
"""
631+
Test case to validate show/hide chat history toggle functionality.
632+
Steps:
633+
1. Validate show/hide chat history toggle
634+
"""
635+
page = login_logout
636+
page.goto(URL)
637+
page.wait_for_timeout(3000)
638+
home = HomePage(page)
639+
request.node._nodeid = "Content Generation - Validate show/hide chat history"
640+
start_time = time.time()
641+
642+
try:
643+
# Step 1: Validate Show/Hide Chat History
644+
step1_start = time.time()
645+
home.show_hide_chat_history()
646+
step1_end = time.time()
647+
648+
# Log test summary
649+
step_times = [
650+
("Step 1 (Show/Hide Chat History)", step1_end - step1_start)
651+
]
652+
total_duration = log_test_summary(start_time, step_times, "Show/Hide Chat History Test")
653+
654+
request.node._report_sections.append(
655+
("call", "log", f"Total execution time: {total_duration:.2f}s")
656+
)
657+
except Exception as e:
658+
log_test_failure(start_time, e)
659+
raise
660+
661+
689662
def test_validate_clear_all_chat_history(login_logout, request):
690663
"""
691664
Test case to validate clear all chat history functionality.

0 commit comments

Comments
 (0)