|
1 | 1 | """Home page object module for Fabric SQL automation tests.""" |
2 | 2 | import logging |
3 | 3 | import json |
| 4 | +import os |
4 | 5 | import re |
5 | 6 | import math |
6 | 7 | from io import BytesIO |
@@ -440,7 +441,7 @@ def delete_chat_history(self): |
440 | 441 | initial_count = chat_history.count() |
441 | 442 | logger.info(f"Initial chat history count: {initial_count}") |
442 | 443 |
|
443 | | - if initial_count == 0: |
| 444 | + if not initial_count: |
444 | 445 | error_msg = "No chat history items available to delete" |
445 | 446 | logger.error(f"❌ {error_msg}") |
446 | 447 | raise AssertionError(error_msg) |
@@ -574,7 +575,7 @@ def send_prompt_from_quick_link(self, quick_link=None): |
574 | 575 |
|
575 | 576 | try: |
576 | 577 | # Step 1: Click on the quick link |
577 | | - logger.info(f"Step 1: Clicking on quick link...") |
| 578 | + logger.info("Step 1: Clicking on quick link...") |
578 | 579 | user_message = self.page.locator(quick_link) |
579 | 580 | expect(user_message).to_be_visible(timeout=10000) |
580 | 581 | user_message.click() |
@@ -902,7 +903,6 @@ def download_image(self): |
902 | 903 | # Step 3: Validate the downloaded file is not empty |
903 | 904 | logger.info("Step 3: Validating downloaded file is not empty...") |
904 | 905 | download_path = download.path() |
905 | | - import os |
906 | 906 | file_size = os.path.getsize(download_path) |
907 | 907 | logger.info(f" Downloaded file size: {file_size} bytes") |
908 | 908 | assert file_size > 0, "Downloaded file is empty (0 bytes)" |
@@ -1226,7 +1226,7 @@ def validate_brief_confirmed_accuracy(self, expected_keywords=None, extra_fields |
1226 | 1226 | logger.error(f"❌ {error_msg}") |
1227 | 1227 | raise AssertionError(error_msg) from e |
1228 | 1228 |
|
1229 | | - def validate_generated_copy_accuracy(self, product_name, generated_content_locator=None, |
| 1229 | + def validate_generated_copy_accuracy(self, product_name, generated_content_locator=None, # noqa: ARG002 |
1230 | 1230 | min_length=30, expected_copy_keywords=None): |
1231 | 1231 | """ |
1232 | 1232 | Validate that the generated marketing copy is accurate and relevant. |
@@ -1391,7 +1391,6 @@ def validate_products_selected_section(self, expected_product_name, |
1391 | 1391 | logger.info(f"✓ [Soft] Price found: {expected_price_pattern}") |
1392 | 1392 | else: |
1393 | 1393 | # Also try a generic price regex as fallback |
1394 | | - import re |
1395 | 1394 | price_match = re.search(r'\$\d+\.\d{2}\s*usd', section_text_lower) |
1396 | 1395 | if price_match: |
1397 | 1396 | logger.info( |
|
0 commit comments