diff --git a/.github/workflows/api_workflow.yml b/.github/workflows/api_workflow.yml index ee569489..fee9b760 100644 --- a/.github/workflows/api_workflow.yml +++ b/.github/workflows/api_workflow.yml @@ -41,7 +41,7 @@ jobs: fi source $HOME/.bp-venv/bin/activate - sh api_run.sh "$TAGS" "${{secrets.SLACK_WEBHOOK_URL}}" "${{secrets.TEAMS_WEBHOOK_URL}}" + sh local_run_api.sh "$TAGS" "${{secrets.SLACK_WEBHOOK_URL}}" "${{secrets.TEAMS_WEBHOOK_URL}}" - name: Get Allure history uses: actions/checkout@v4 @@ -103,7 +103,7 @@ jobs: fi source $HOME/.bp-venv/bin/activate - sh api_run.sh "$TAGS" "${{secrets.SLACK_WEBHOOK_URL}}" "${{secrets.TEAMS_WEBHOOK_URL}}" + sh local_run_api.sh "$TAGS" "${{secrets.SLACK_WEBHOOK_URL}}" "${{secrets.TEAMS_WEBHOOK_URL}}" - name: Get Allure history uses: actions/checkout@v4 diff --git a/README.md b/README.md index 78fb7264..ec2853b9 100755 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ Reference Link - https://pypi.org/project/pytest-xdist/

(back to top)

-Command for local run on chrome (also ./web_local_run.sh) +Command for local run on chrome (also ./local_run_web.sh) ```shell -v -s --gherkin-terminal-reporter --driver=Chrome --html="./output/reports/" --self-contained-html --capability headless True --tags="web_tests" --reruns 1 --reruns-delay 2 -n=2 ``` diff --git a/bp_core/backend/common/step_definitions/__init__.py b/bp_core/backend/common/step_definitions/__init__.py deleted file mode 100644 index 525bc18a..00000000 --- a/bp_core/backend/common/step_definitions/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -"""step_definitions.py - -Package for Common Step Definitions for API Testing -""" diff --git a/bp_core/frontend/common/step_definitions/__init__.py b/bp_core/frontend/common/step_definitions/__init__.py index e1c8957f..b6a15d69 100644 --- a/bp_core/frontend/common/step_definitions/__init__.py +++ b/bp_core/frontend/common/step_definitions/__init__.py @@ -1,14 +1,12 @@ -from .api_bdd import * -from .browser_navigation_window_tabs_and_screenshots import * +from .browser_navigation import * from .click_touch_and_keyboard_actions import * -from .date_time_and_pause import * +from .date_time import * from .dropdowns import * -from .element_existence_visibility_and_attribute_assertion import * +from .attribute_assertion import * from .environment_variables import * from .excel_and_csv import * from .html_tables import * -from .ionic_hybrid_mobile_apps_steps import * from .mobile_device_actions import * -from .swipe_scroll_move_hover_drag_and_drop import * -from .text_assertion_editing_and_generation import * +from .swipe_drag_and_drop import * +from .text_assertion_editing import * from .visual_comparison import * diff --git a/bp_core/frontend/common/step_definitions/api_bdd.py b/bp_core/frontend/common/step_definitions/api_bdd.py deleted file mode 100644 index a8dfb571..00000000 --- a/bp_core/frontend/common/step_definitions/api_bdd.py +++ /dev/null @@ -1,43 +0,0 @@ -import structlog - -from _pytest.fixtures import FixtureRequest -from pytest_bdd import parsers, when, then -from pytest_check import check -from bp_core.backend.common.step_definitions.steps_common import set_request_endpoint, set_request_headers, \ - add_json_payload, make_api_request, get_api_response -from bp_core.frontend.common.helpers.app import context_manager -from assertpy import assert_that -from bp_core.frontend.common.helpers.selenium_generics import SeleniumGenerics -from bp_core.frontend.common.step_definitions.steps_common import UI_API_CALL, MOBILE_SUFFIX -from bp_core.utils.bp_storage import BPStorage - - -logger = structlog.get_logger(__name__) - - -# WEB context Predefined Step -# ID 1501 -@when(parsers.re("I '(?P.*)' an API request having base URL '(?P.*)' with endpoint '(?P.*)' with headers '(?P.*)' and payload '(?P.*)' and store the response value")) -def send_api_request_store_value_bp_storage(selenium_generics: SeleniumGenerics, request: FixtureRequest, request_type: str, base_url: str, endpoint: str, headers: str, payload: str): - api_response_container = dict() - set_request_endpoint(request, base_url=base_url, endpoint=endpoint, request_name=UI_API_CALL) - set_request_headers(request, headers=headers, request_name=UI_API_CALL) - add_json_payload(request, json_payload=payload, request_name=UI_API_CALL) - make_api_request(request, api_response_container=api_response_container, request_type=request_type, request_name=UI_API_CALL) - BPStorage.store_api_bdd_response(get_api_response(request, api_response_container=api_response_container, request_name=UI_API_CALL)) - - -# WEB & MOBILE contexts Predefined Step -# ID 1502 -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' has the text equal with the API BDD response key '(?P.*)'")) -def api_contains_text(selenium_generics: SeleniumGenerics, locators, soft_assert: str, locator_path: str, key: str): - if MOBILE_SUFFIX in locator_path: - with context_manager(selenium_generics): - actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) - else: - actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) - if soft_assert is not None and soft_assert.lower() == 'true': - with check: - assert_that(actual_text).is_equal_to(BPStorage.get_api_bdd_response().json()[key]) - else: - assert_that(actual_text).is_equal_to(BPStorage.get_api_bdd_response().json()[key]) diff --git a/bp_core/frontend/common/step_definitions/element_existence_visibility_and_attribute_assertion.py b/bp_core/frontend/common/step_definitions/attribute_assertion.py similarity index 96% rename from bp_core/frontend/common/step_definitions/element_existence_visibility_and_attribute_assertion.py rename to bp_core/frontend/common/step_definitions/attribute_assertion.py index 52206bf9..887d2227 100644 --- a/bp_core/frontend/common/step_definitions/element_existence_visibility_and_attribute_assertion.py +++ b/bp_core/frontend/common/step_definitions/attribute_assertion.py @@ -1,11 +1,3 @@ -""" ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- - - ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -""" import polling import structlog @@ -23,7 +15,6 @@ # WEB context Predefined Step -# ID 501 @given(parsers.re(r"(With soft assertion '(?P.*)' )?The attribute '(?P.*)' of element '(?P.*)' is the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re(r"(With soft assertion '(?P.*)' )?The attribute '(?P.*)' of element '(?P.*)' is the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), @@ -47,7 +38,6 @@ def check_property_is(selenium_generics: SeleniumGenerics, locators: Locators, s # WEB context Predefined Step -# ID 502 @given(parsers.re(r"(With soft assertion '(?P.*)' )?The attribute '(?P.*)' of element '(?P.*)' is not the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re(r"(With soft assertion '(?P.*)' )?The attribute '(?P.*)' of element '(?P.*)' is not the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), @@ -71,7 +61,6 @@ def check_property_is_not(selenium_generics: SeleniumGenerics, locators: Locator # WEB context Predefined Step -# ID 503 @given(parsers.re(r"(With soft assertion '(?P.*)' )?The css attribute '(?P.*)' of element '(?P.*)' is the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re(r"(With soft assertion '(?P.*)' )?The css attribute '(?P.*)' of element '(?P.*)' is the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), @@ -94,7 +83,6 @@ def check_css_property_is(attribute, selenium_generics: SeleniumGenerics, locato # WEB context Predefined Step -# ID 504 @given(parsers.re(r"(With soft assertion '(?P.*)' )?The css attribute '(?P.*)' of element '(?P.*)' is not the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re(r"(With soft assertion '(?P.*)' )?The css attribute '(?P.*)' of element '(?P.*)' is not the value '(?P.*)'(\s+)?((?:within)\s+(?:')(?P\w+)(?:') seconds)?$"), @@ -117,7 +105,6 @@ def check_css_property_is_not(attribute, selenium_generics: SeleniumGenerics, lo # WEB & MOBILE contexts Predefined Step -# ID 505 & 506 & 507 @given(parsers.re("(With soft assertion '(?P.*)' )?There is an element '(?P.*)' on the page")) @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is displayed")) @when(parsers.re("(With soft assertion '(?P.*)' )?There is an element '(?P.*)' on the page")) @@ -144,7 +131,6 @@ def element_displayed(selenium_generics: SeleniumGenerics, locators: Locators, s # WEB & MOBILE contexts Predefined Step -# ID 508 & 509 & 510 @given(parsers.re("(With soft assertion '(?P.*)' )?There is no element '(?P.*)' on the page")) @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not displayed")) @when(parsers.re("(With soft assertion '(?P.*)' )?There is no element '(?P.*)' on the page")) @@ -171,7 +157,6 @@ def element_not_displayed(selenium_generics: SeleniumGenerics, locators: Locator # WEB & MOBILE contexts Predefined Step -# ID 511 @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' appears exactly '(?P.*)' times"), converters=dict(occurrence_count=data_manager.text_formatted), ) def check_element_exists(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, occurrence_count: int, ): @@ -193,7 +178,6 @@ def check_element_exists(selenium_generics: SeleniumGenerics, locators: Locators # WEB & MOBILE contexts Predefined Step -# ID 512 @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' does not appear exactly '(?P.*)' times"), converters=dict(occurrence_count=data_manager.text_formatted), ) def check_element_not_exists(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, occurrence_count: int, ): @@ -215,7 +199,6 @@ def check_element_not_exists(selenium_generics: SeleniumGenerics, locators: Loca # WEB & MOBILE contexts Predefined Step -# ID 513 @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' becomes visible within '(?P.*)' seconds"), converters=dict(wait_for=data_manager.text_formatted), ) def wait_for_displayed(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path: str, wait_for: int, ): @@ -234,8 +217,6 @@ def wait_for_displayed(selenium_generics: SeleniumGenerics, locators: Locators, assert selenium_generics.is_element_visible(locators.parse_and_get(locator_path, selenium_generics), int(wait_for)) -# WEB & MOBILE contexts Predefined Step -# ID 514 @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' becomes invisible within '(?P.*)' seconds"), converters=dict(wait_for=data_manager.text_formatted), ) def wait_for_not_displayed(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path: str, wait_for: int): @@ -257,7 +238,7 @@ def wait_for_not_displayed(selenium_generics: SeleniumGenerics, locators: Locato # WEB context Predefined Step -# ID 515 + @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' is within the viewport")) def check_within_viewport(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert:str, locator_path: str): if soft_assert is not None and soft_assert.lower() == 'true': @@ -268,7 +249,6 @@ def check_within_viewport(selenium_generics: SeleniumGenerics, locators: Locator # WEB context Predefined Step -# ID 516 @then(parsers.re("(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' is not within the viewport")) def check_within_viewport(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path): if soft_assert is not None and soft_assert.lower() == 'true': @@ -278,8 +258,6 @@ def check_within_viewport(selenium_generics: SeleniumGenerics, locators: Locator assert not selenium_generics._is_in_viewport(locators.parse_and_get(locator_path, selenium_generics)) -# WEB & MOBILE contexts Predefined Step -# ID 517 @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is enabled")) @when(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is enabled")) @then(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is enabled")) @@ -301,7 +279,6 @@ def element_enabled(selenium_generics: SeleniumGenerics, locators: Locators, sof # WEB & MOBILE contexts Predefined Step -# ID 518 @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not enabled")) @when(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not enabled")) @then(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not enabled")) @@ -318,7 +295,6 @@ def element_not_enabled(selenium_generics: SeleniumGenerics, locators: Locators, # WEB context Predefined Step -# ID 519 @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is selected")) @when(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is selected")) @then(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is selected")) @@ -332,7 +308,6 @@ def element_selected(selenium_generics: SeleniumGenerics, locators: Locators, so # WEB context Predefined Step -# ID 520 @given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not selected")) @when(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not selected")) @then(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' is not selected")) diff --git a/bp_core/frontend/common/step_definitions/browser_navigation_window_tabs_and_screenshots.py b/bp_core/frontend/common/step_definitions/browser_navigation.py similarity index 100% rename from bp_core/frontend/common/step_definitions/browser_navigation_window_tabs_and_screenshots.py rename to bp_core/frontend/common/step_definitions/browser_navigation.py diff --git a/bp_core/frontend/common/step_definitions/click_touch_and_keyboard_actions.py b/bp_core/frontend/common/step_definitions/click_touch_and_keyboard_actions.py index 21a290fa..2ce0c636 100644 --- a/bp_core/frontend/common/step_definitions/click_touch_and_keyboard_actions.py +++ b/bp_core/frontend/common/step_definitions/click_touch_and_keyboard_actions.py @@ -1,10 +1,4 @@ -""" ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -""" import structlog from pytest_bdd import parsers, given, when, then from bp_core.frontend.common.helpers.app import context_manager @@ -18,7 +12,6 @@ # WEB & MOBILE contexts Predefined Step -# ID 201, 208 @given(parsers.re("I click on (checkbox|button|dropdown|item|element) '(?P.*)'")) @given(parsers.re("I tap on '(?P.*)'")) @when(parsers.re("I click on (checkbox|button|dropdown|item|element) '(?P.*)'")) @@ -32,7 +25,6 @@ def click_on_locator(selenium_generics: SeleniumGenerics, locators: Locators, lo # WEB context Predefined Step - Chrome Only -# ID 202 @given(parsers.re( "(I wait for maximum '(?P\\d+)' seconds, and )?I click on '(?P.+)'")) @when(parsers.re( @@ -43,7 +35,6 @@ def click_element(selenium_generics: SeleniumGenerics, locators: Locators, locat # WEB context Predefined Step -# ID 203 @given(parsers.re("I (double click|doubleclick) on '(?P.*)'")) @when(parsers.re("I (double click|doubleclick) on '(?P.*)'")) def dbl_click_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str): @@ -51,7 +42,6 @@ def dbl_click_element(selenium_generics: SeleniumGenerics, locators: Locators, l # WEB context Predefined Step -# ID 204 @given(parsers.re("I click on SVG element '(?P.*)'")) @when(parsers.re("I click on SVG element '(?P.*)'")) def click_svg_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path): @@ -59,7 +49,6 @@ def click_svg_element(selenium_generics: SeleniumGenerics, locators: Locators, l # WEB context Predefined Step -# ID 205 @given(parsers.re("I click on type:'(?P.*)' element with text equal to '(?P.*)'"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re("I click on type:'(?P.*)' element with text equal to '(?P.*)'"), @@ -69,7 +58,6 @@ def click_on_text(selenium_generics: SeleniumGenerics, element_type, value: str) # WEB context Predefined Step -# ID 206 @given(parsers.re("I click on type:'(?P.*)' that contains the text:'(?P.*)'"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re("I click on type:'(?P.*)' that contains the text:'(?P.*)'"), @@ -79,7 +67,6 @@ def click_on_partial_text(selenium_generics: SeleniumGenerics, element_type, val # WEB contexts Predefined Step -# ID 207 @given(parsers.re( "I click on element with visible text '(?PEQUALS|CONTAINS|STARTS_WITH|ENDS_WITH)' '(?P.*)'"), converters=dict(value=data_manager.text_formatted), ) @@ -96,7 +83,6 @@ def click_on_element_by_visible_text(selenium_generics: SeleniumGenerics, locato # MOBILE context Predefined Step -# ID 209 @given(parsers.re("I long tap on element '(?P.*)'")) @when(parsers.re("I long tap on element '(?P.*)'")) def long_tap(selenium_generics: SeleniumGenerics, locators: Locators, locator: str): @@ -105,7 +91,6 @@ def long_tap(selenium_generics: SeleniumGenerics, locators: Locators, locator: s # MOBILE contexts Predefined Step -# ID 210 @given(parsers.re( "I tap '(?PBOTTOM_LEFT|BOTTOM_RIGHT|TOP_LEFT|TOP_RIGHT)' corner of element '(?P.*)'")) # noqa @when(parsers.re( @@ -123,7 +108,6 @@ def click_element_corner(selenium_generics: SeleniumGenerics, locators: Locators # MOBILE context Predefined Step -# ID 211 @given(parsers.re( "On '(?PAndroid|iOS)' I tap on the x='(?P.*)' % and y='(?P.*)' % of element '(?P.*)'")) @when(parsers.re( @@ -138,7 +122,6 @@ def tap_with_percentage(selenium_generics: SeleniumGenerics, locators, platform: # ANDROID MOBILE context Predefined Step -# ID 212 @given("On android, I tap on back navigation") @when("On android, I tap on back navigation") def tap_back_nav(selenium_generics: SeleniumGenerics): @@ -148,7 +131,6 @@ def tap_back_nav(selenium_generics: SeleniumGenerics): # iOS MOBILE context Predefined Step -# ID 213 @given(parsers.re("On iOS, I navigate back to app after clicking on '(?P.*)'")) @when(parsers.re("On iOS, I navigate back to app after clicking on '(?P.*)'")) def navigate_back_to_app(selenium_generics: SeleniumGenerics, locators: Locators, locator: str): @@ -158,7 +140,6 @@ def navigate_back_to_app(selenium_generics: SeleniumGenerics, locators: Locators # WEB context Predefined Step -# ID 214 @given(parsers.re("I press '(?P.*)'")) @when(parsers.re("I press '(?P.*)'")) def press_key_not_focused_on_element(selenium_generics: SeleniumGenerics, key: str): @@ -167,7 +148,6 @@ def press_key_not_focused_on_element(selenium_generics: SeleniumGenerics, key: s # WEB context Predefined Step -# ID 215 @given(parsers.re("I focus over '(?P.*)' then I press '(?P.*)'")) @when(parsers.re("I focus over '(?P.*)' then I press '(?P.*)'")) def press_key_on_element(selenium_generics: SeleniumGenerics, locator_path: str, key: str, locators: Locators): @@ -177,7 +157,6 @@ def press_key_on_element(selenium_generics: SeleniumGenerics, locator_path: str, # WEB context Predefined Step -# ID 216 @when(parsers.re("I click item '(?P.*)' for element '(?P.*)'"), converters=dict(inner_text=data_manager.text_formatted), ) def add_item_for_element(selenium_generics: SeleniumGenerics, locators: Locators, inner_text: str, locator_path: str): diff --git a/bp_core/frontend/common/step_definitions/date_time_and_pause.py b/bp_core/frontend/common/step_definitions/date_time.py similarity index 100% rename from bp_core/frontend/common/step_definitions/date_time_and_pause.py rename to bp_core/frontend/common/step_definitions/date_time.py diff --git a/bp_core/frontend/common/step_definitions/environment_variables.py b/bp_core/frontend/common/step_definitions/environment_variables.py index 51735a0a..7ed9996c 100644 --- a/bp_core/frontend/common/step_definitions/environment_variables.py +++ b/bp_core/frontend/common/step_definitions/environment_variables.py @@ -26,7 +26,6 @@ # WEB & MOBILE contexts Predefined Step -# ID 801 @given(parsers.re("I get text from element '(?P.*)' and save as environment variable '(?P.*)'")) @when(parsers.re("I get text from element '(?P.*)' and save as environment variable '(?P.*)'")) def get_text_from_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str, env_var: str, ): @@ -38,7 +37,6 @@ def get_text_from_element(selenium_generics: SeleniumGenerics, locators: Locator os.environ[env_var] = returned_text -# ID 802 @given(parsers.re("I get text from element '(?P.*)' between '(?P.*)' and '(?P.*)' boundaries, and save as environment variable '(?P.*)'"), converters=dict(initial_string=data_manager.text_formatted, final_string=data_manager.text_formatted), ) @when(parsers.re("I get text from element '(?P.*)' between '(?P.*)' and '(?P.*)' boundaries, and save as environment variable '(?P.*)'"), @@ -53,7 +51,6 @@ def get_text_from_element(selenium_generics: SeleniumGenerics, locators: Locator # WEB context Predefined Step -# ID 803 @given(parsers.re("I write within the HTML report the environment variable '(?P.*)' value")) @when(parsers.re("I write within the HTML report the environment variable '(?P.*)' value")) @then(parsers.re("I write within the HTML report the environment variable '(?P.*)' value")) @@ -65,7 +62,6 @@ def write_html_report_os_environ_value(selenium_generics: SeleniumGenerics, env_ # WEB context Predefined Step -# ID 804 @given(parsers.re("I store '(?P.*)' environment variable in .local.env config file")) @when(parsers.re("I store '(?P.*)' environment variable in .local.env config file")) def store_env_variable_in_local_env(key: str): @@ -81,7 +77,6 @@ def store_env_variable_in_local_env(key: str): raise FileNotFoundError("File not found: .local.env") -# ID 806, 909 @given(parsers.re("I get text from '(?P.*)' on '(?P.*)' of excel file '(?P.*)' and save it as environment variable with name '(?P.*)'"), converters=dict(cell=data_manager.text_formatted, sheet_name=data_manager.text_formatted)) @when(parsers.re("I get text from '(?P.*)' on '(?P.*)' of excel file '(?P.*)' and save it as environment variable with name '(?P.*)'"), @@ -92,7 +87,6 @@ def write_text_to_excel_file(cell: str, sheet_name: str, file_path: str, env_var os.environ[env_var] = text -# ID 807, 910 @given(parsers.re("I get text of '(?P.*)' of excel file '(?P.*)' and save it as environment variables"), converters=dict(sheet_name=data_manager.text_formatted)) @when(parsers.re("I get text of '(?P.*)' of excel file '(?P.*)' and save it as environment variables"), @@ -115,7 +109,6 @@ def store_excel_data_as_env_vars(sheet_name: str, file_path: str): os.environ[key] = str(value) -# ID 808, 920 @given(parsers.re("I get text from '(?P.*)' cell of csv file '(?P.*)' and save it as env variable with name '(?P.*)'"), converters=dict(cell=data_manager.text_formatted)) @when(parsers.re("I get text from '(?P.*)' cell of csv file '(?P.*)' and save it as env variable with name '(?P.*)'"), diff --git a/bp_core/frontend/common/step_definitions/excel_and_csv.py b/bp_core/frontend/common/step_definitions/excel_and_csv.py index c3ceac46..dc4ab6a2 100644 --- a/bp_core/frontend/common/step_definitions/excel_and_csv.py +++ b/bp_core/frontend/common/step_definitions/excel_and_csv.py @@ -1,11 +1,3 @@ -""" ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- - ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -""" - import os import csv import structlog diff --git a/bp_core/frontend/common/step_definitions/html_tables.py b/bp_core/frontend/common/step_definitions/html_tables.py index 659f19df..438db539 100644 --- a/bp_core/frontend/common/step_definitions/html_tables.py +++ b/bp_core/frontend/common/step_definitions/html_tables.py @@ -12,7 +12,6 @@ logger = structlog.get_logger(__name__) -# ID 1101, 1102 @then(parsers.re("I expect table '(?P.*)' headers ('(?P.*)' )?to match:(?P.*)", flags=re.S, ), converters=dict(data_table=data_table_horizontal_converter),) def verify_table_headers_match_exactly(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, data_table, header_tag_path): @@ -25,7 +24,6 @@ def verify_table_headers_match_exactly(selenium_generics: SeleniumGenerics, loca assert_that(columns_present).is_equal_to(expected_columns) -# ID 1103, 1104 @then(parsers.re("I expect table '(?P.*)' headers ('(?P.*)' )?to contain:(?P.*)", flags=re.S, ), converters=dict(data_table=data_table_horizontal_converter), ) def verify_table_headers_contain_columns(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, data_table, header_tag_path): @@ -38,7 +36,6 @@ def verify_table_headers_contain_columns(selenium_generics: SeleniumGenerics, lo assert_that(columns_present).contains(*expected_columns) -# ID 1105 @then(parsers.re("I expect the column in table '(?P.*)' has the values:(?P.*)", flags=re.S, ), converters=dict(data_table=data_table_horizontal_converter), ) def verify_table_column_contain_values(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, data_table): @@ -61,7 +58,6 @@ def verify_table_column_contain_values(selenium_generics: SeleniumGenerics, loca assert len(selenium_generics.get_elements(cell_locator)) > 0 -# ID 1106 @then(parsers.re("I expect that '(?P.*)' row has the value '(?P.*)' in column '(?P.*)' of table '(?P.*)'"), converters=dict(expected_text=data_manager.text_formatted), ) def verify_column_contain_value(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, row, column, expected_text: str): @@ -82,7 +78,6 @@ def verify_column_contain_value(selenium_generics: SeleniumGenerics, locators: L assert len(selenium_generics.get_elements(cell_locator)) > 0 -# ID 1107 @then(parsers.re("I expect that '(?P.*)' row in table '(?P.*)' has the following values:(?P.*)", flags=re.S, ), converters=dict(data_table=data_table_horizontal_converter), ) def verify_table_row_contain_values(selenium_generics: SeleniumGenerics, locators: Locators, row, locator_path, data_table): @@ -109,7 +104,6 @@ def verify_table_row_contain_values(selenium_generics: SeleniumGenerics, locator assert len(selenium_generics.get_elements(cell_locator)) > 0 -# ID 1108 @then(parsers.re("I expect that table '(?P.*)' has '(?P.*)' rows"), converters=dict(value=data_manager.text_formatted), ) def verify_column_contain_value(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, value: int): diff --git a/bp_core/frontend/common/step_definitions/ionic_hybrid_mobile_apps_steps.py b/bp_core/frontend/common/step_definitions/ionic_hybrid_mobile_apps_steps.py deleted file mode 100644 index 6c268f6a..00000000 --- a/bp_core/frontend/common/step_definitions/ionic_hybrid_mobile_apps_steps.py +++ /dev/null @@ -1,456 +0,0 @@ -""" ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- - ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -""" -import time -import structlog -import re - -from datetime import datetime, timedelta -from pytest_bdd import parsers, given, when -from bp_core.frontend.common.helpers.app import context_manager -from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException -from bp_core.frontend.common.helpers.selenium_generics import SeleniumGenerics -from bp_core.frontend.common.step_definitions.steps_common import MOBILE_SUFFIX -from bp_core.frontend.common.utils.locator_parser import Locators -from bp_core.utils import data_manager -from bp_core.utils.exceptions import YearAscendingException - -logger = structlog.get_logger(__name__) - - -# WEB context Predefined Step -# ID 1301 -@given(parsers.re("(On '(?PAndroid|iOS)' )?I click on element with text '(?P.*)' on wheel picker '(?P.*)'"), - converters=dict(element_text=data_manager.text_formatted),) -@when(parsers.re("(On '(?PAndroid|iOS)' )?I click on element with text '(?P.*)' on wheel picker '(?P.*)'"), - converters=dict(element_text=data_manager.text_formatted),) -def click_on_wheel_picker_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str, element_text: str, mobile_platform: str): - current_platform = selenium_generics.driver.capabilities['platformName'].lower() - mobile_platform = mobile_platform.lower() if mobile_platform else current_platform - picker_elements = selenium_generics.get_elements(locators.parse_and_get(locator_path, selenium_generics)) - - def get_currently_displayed_elements(elements, starting_from, direction): - elements_ = elements[starting_from::-1] if direction else elements[starting_from:] - is_displayed = False - result = dict() - for idx, element in enumerate(elements_): - if element.is_displayed(): - is_displayed = True - result[idx] = element - else: - if is_displayed: - break - keys = list(result.keys()) - keys.sort() - new_first_displayed_element = starting_from - keys[-1] if direction else keys[0] + starting_from - sorted_displayed_elements = {k: result[k] for k in keys} - return sorted_displayed_elements, new_first_displayed_element - - def try_to_click_on_the_element(elements, text): - for index in elements.keys(): - if displayed_elements[index].text == text: - selenium_generics.click(displayed_elements[index], max_wait_time=1) - return True - return False - - if current_platform == mobile_platform.lower(): - first_displayed_element = 0 - reverse = False - for _ in range(len(picker_elements)): - displayed_elements, first_displayed_element = get_currently_displayed_elements(picker_elements, first_displayed_element, reverse) - highest_key = max(displayed_elements.keys()) - if try_to_click_on_the_element(elements=displayed_elements, text=element_text): - return - try: - displayed_elements[highest_key].click() - except ElementNotVisibleException: - continue - # If the element is not found we search the other direction - else: - first_displayed_element = len(picker_elements) - reverse = True - for _ in range(len(picker_elements)): - displayed_elements, first_displayed_element = get_currently_displayed_elements(picker_elements, first_displayed_element, reverse) - highest_key = max(displayed_elements.keys()) - if try_to_click_on_the_element(elements=displayed_elements, text=element_text): - return - try: - displayed_elements[highest_key].click() - except ElementNotVisibleException: - continue - raise NoSuchElementException(f"Wheel picker element with text: {element_text} not found") - - -# ID 1302 -@given(parsers.re(r"On Android I select (?:the day '(?P.*)' month '(?P.*)' year '(?P.*)'|the date '(?P.*)' days from now) on Ionic date wheel picker with days '(?P.*)' months '(?P.*)' years '(?P.*)'")) -@when(parsers.re(r"On Android I select (?:the day '(?P.*)' month '(?P.*)' year '(?P.*)'|the date '(?P.*)' days from now) on Ionic date wheel picker with days '(?P.*)' months '(?P.*)' years '(?P.*)'")) -def click_on_android_date_wheel_picker_element(selenium_generics: SeleniumGenerics, locators: Locators, days_path, months_path, years_path, days_from_now=None, day=None, month=None, year=None): - if selenium_generics.is_android(): - days_elements = locators.parse_and_get(days_path, selenium_generics) - months_elements = locators.parse_and_get(months_path, selenium_generics) - years_elements = locators.parse_and_get(years_path, selenium_generics) - - months = {1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", - 9: "September", 10: "October", 11: "November", 12: "December"} - - def get_current_month_name(given_month: int): - return next((name_ for month_, name_ in months.items() if month_ == given_month), None) - - if days_from_now: - days_from_now = int(days_from_now) - current_date = datetime.now() - new_date = current_date + timedelta(days=days_from_now) - day = str(new_date.day) - month = get_current_month_name(new_date.month) - year = str(new_date.year) - - def element_generator(): - element_locators = [years_elements, months_elements, days_elements] - for element_locator in element_locators: - yield get_elements(element_locator) - - def get_elements(locator_): - elements = selenium_generics.get_elements(locator_) - for _ in range(3): - time.sleep(3) - if elements == selenium_generics.get_elements(locator_): - break - elements = selenium_generics.get_elements(locator_) - return elements - - def get_currently_displayed_elements(elements, starting_from, direction): - elements_ = elements[starting_from::-1] if direction else elements[starting_from:] - is_displayed = False - result = dict() - for idx, element in enumerate(elements_): - if element.is_displayed(): - is_displayed = True - result[idx] = element - else: - if is_displayed: - break - keys = list(result.keys()) - keys.sort() - new_first_displayed_element = starting_from - keys[-1] if direction else keys[0] + starting_from - sorted_displayed_elements = {k: result[k] for k in keys} - return sorted_displayed_elements, new_first_displayed_element - - def try_to_click_on_the_element(elements, text): - for index in elements.keys(): - if displayed_elements[index].text == text: - try: - selenium_generics.click(displayed_elements[index], max_wait_time=1) - return True - except Exception: - selenium_generics.scroll_into_view(displayed_elements[index]) - selenium_generics.click(displayed_elements[index], max_wait_time=1) - return True - return False - - first_displayed_element = 0 - reverse, clicked = False, False - element_iterator = element_generator() - for date_part, element_text in zip(element_iterator, (year, month, day)): - for _ in range(len(date_part)): - displayed_elements, first_displayed_element = get_currently_displayed_elements(date_part, first_displayed_element, reverse) - highest_key = max(displayed_elements.keys()) - if try_to_click_on_the_element(elements=displayed_elements, text=element_text): - clicked = True - break - try: - displayed_elements[highest_key].click() - clicked = False - except ElementNotVisibleException: - continue - if not clicked: - for date_part, element_text in zip((years_elements, months_elements, days_elements), (year, month, day)): - first_displayed_element = len(date_part) - reverse = True - for _ in range(len(date_part)): - displayed_elements, first_displayed_element = get_currently_displayed_elements(date_part, first_displayed_element, reverse) - highest_key = max(displayed_elements.keys()) - if try_to_click_on_the_element(elements=displayed_elements, text=element_text): - clicked = True - break - try: - displayed_elements[highest_key].click() - clicked = False - except ElementNotVisibleException: - continue - if not clicked: - raise NoSuchElementException(f"Wheel picker element with text: {element_text} not found") - - -# ID 1303 -@given(parsers.re(r"On iOS I select (?:the day '(?P.*)' month '(?P.*)' year '(?P.*)'|the date '(?P.*)' days from now) on Ionic date wheel picker '(?P.*)'")) -@when(parsers.re(r"On iOS I select (?:the day '(?P.*)' month '(?P.*)' year '(?P.*)'|the date '(?P.*)' days from now) on Ionic date wheel picker '(?P.*)'")) -def click_on_ios_date_wheel_picker_element_native(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, days_from_now=None, day=None, month=None, year=None): - if selenium_generics.driver.capabilities['platformName'].lower() == 'ios': - current_day, current_month, current_year = datetime.now().day, datetime.now().month, datetime.now().year - months = {1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", - 9: "September", 10: "October", 11: "November", 12: "December"} - - def identify_pattern(data): - year_pattern = re.compile(r"^\d{4}$") - day_pattern = re.compile(r"^(0?[1-9]|[1-2]\d|3[0-1])$") - if year_pattern.match(data): - return "year", f"{year}" - elif day_pattern.match(data): - return "day", f"{day}" - elif not data.isnumeric(): - return "month", f"{month}" - else: - raise ValueError(f"Unrecognized element text: {data}") - - def is_year_ascending(elements, types): - results = identify_current_date_elements(elements, types) - for key, value in results.items(): - if value[0] == 'year': - before, after = None, None - try: - before = elements[key - 1] - if identify_pattern(before.text)[0] != "year": - before = None - raise YearAscendingException - except YearAscendingException: - after = elements[key + 1] - if before: - if int(before.text) > int(elements[key].text): - return False - return True - elif after: - if int(after.text) > int(elements[key].text): - return True - return False - - def get_current_month_name(given_month: int): - return next((name_ for month_, name_ in months.items() if month_ == given_month), None) - - def is_later(date_part, order=None): - result = True - if date_part[0] == 'month': - given_month_number = next((month_ for month_, name_ in months.items() if name_ == date_part[1]), None) - if given_month_number is None: - raise ValueError(f"Bad month value: {given_month_number}") - elif given_month_number < current_month: - result = False - elif date_part[0] == 'year': - if order: - if int(date_part[1]) < current_year: - result = False - else: - if int(date_part[1]) > current_year: - result = False - elif date_part[0] == 'day' and int(date_part[1]) < current_day: - result = False - return result - - def identify_current_date_elements(elements, types): - results = dict() - for idx, e in enumerate(elements): - if e.text in (str(current_day), get_current_month_name(current_month), str(current_year)): - _type = identify_pattern(e.text)[0] - if _type in types: - results[idx] = identify_pattern(e.text) - return results - - def find_elements(locator, max_attempts=3): - counter = 0 - while counter < max_attempts: - result = selenium_generics.get_elements(locator) - if result: - return result - time.sleep(5) - counter += 1 - raise NoSuchElementException(f"Elements with locator: {locator} not found") - - if days_from_now: - days_from_now = int(days_from_now) - current_date = datetime.now() - new_date = current_date + timedelta(days=days_from_now) - day = new_date.day - month = get_current_month_name(new_date.month) - year = new_date.year - - if MOBILE_SUFFIX in locator_path: - with context_manager(selenium_generics): - types_ = ["day", "month", "year"] - if all(date_part is not None for date_part in (day, month, year)): - for i in range(3): - picker_elements = find_elements(locators.parse_and_get(locator_path, selenium_generics)) - current_elements = identify_current_date_elements(picker_elements, types_) - year_order = is_year_ascending(picker_elements, ["year",]) - key, value = list(current_elements.keys())[0], current_elements[list(current_elements.keys())[0]] - if is_later(value, year_order): - _elements = picker_elements[key:] - else: - _elements = picker_elements[:key + 1][::-1] - for element in _elements: - element_match = element.text == identify_pattern(element.text)[1] - selenium_generics.click(element) - time.sleep(2) # Additional wait time once there is a transition in the elements after the click - if element_match: - types_.remove(identify_pattern(element.text)[0]) - break - else: - raise ValueError(f"Expected to have all values: day {day}, month: {month}, year: {year}") - - -# ID 1304 -@given(parsers.re(r"On Android I select (?:the hour '(?P.*)' minute '(?P.*)' in time period '(?P.*)'|the time '(?P.*)' minutes from now) on Ionic time wheel picker with minutes '(?P.*)' hours '(?P.*)' time period '(?P.*)'")) -@when(parsers.re(r"On Android I select (?:the hour '(?P.*)' minute '(?P.*)' in time period '(?P.*)'|the time '(?P.*)' minutes from now) on Ionic time wheel picker with minutes '(?P.*)' hours '(?P.*)' time period '(?P.*)'")) -def click_on_android_time_wheel_picker_element(selenium_generics: SeleniumGenerics, locators: Locators, minutes_path, hours_path, time_period_path, minutes_from_now=None, hour=None, minute=None, time_period=None): - if selenium_generics.is_android(): - minutes_elements = locators.parse_and_get(minutes_path, selenium_generics) - hours_elements = locators.parse_and_get(hours_path, selenium_generics) - time_period_elements = locators.parse_and_get(time_period_path, selenium_generics) - - def convert_to_12h(hours_24h): - if hours_24h == 0: - return "12", "AM" - elif 1 <= hours_24h <= 11: - return str(hours_24h), "AM" - elif hours_24h == 12: - return "12", "PM" - else: - return str(hours_24h - 12), "PM" - - if minutes_from_now: - minutes_from_now = int(minutes_from_now) - current_date = datetime.now() - new_date = current_date + timedelta(minutes=minutes_from_now) - minute = str(new_date.minute) - hour, time_period = convert_to_12h(new_date.hour) - - def get_elements(locator_): - elements = selenium_generics.get_elements(locator_) - for _ in range(3): - time.sleep(3) - if elements == selenium_generics.get_elements(locator_): - break - elements = selenium_generics.get_elements(locator_) - return elements - - hours = get_elements(hours_elements) - for element in hours: - if element.text == hour: - try: - selenium_generics.click(element, max_wait_time=1) - break - except Exception: - selenium_generics.scroll_into_view(element) - selenium_generics.click(element, max_wait_time=1) - break - - minutes = get_elements(minutes_elements) - for element in minutes: - if element.text == minute: - try: - selenium_generics.click(element, max_wait_time=1) - break - except Exception: - selenium_generics.scroll_into_view(element) - selenium_generics.click(element, max_wait_time=1) - break - - time_period_ = get_elements(time_period_elements) - for element in time_period_: - if element.text.lower() == time_period.lower(): - try: - selenium_generics.click(element, max_wait_time=1) - break - except Exception: - selenium_generics.scroll_into_view(element) - selenium_generics.click(element, max_wait_time=1) - break - - -# ID 1305 -@given(parsers.re(r"On iOS I select (?:the hour '(?P.*)' minute '(?P.*)' in time period '(?P.*)'|the time '(?P.*)' minutes from now) on Ionic time wheel picker '(?P.*)'")) -@when(parsers.re(r"On iOS I select (?:the hour '(?P.*)' minute '(?P.*)' in time period '(?P.*)'|the time '(?P.*)' minutes from now) on Ionic time wheel picker '(?P.*)'")) -def click_on_ios_time_wheel_picker_element_native(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, minutes_from_now=None, hour=None, minute=None, time_period=None): - if selenium_generics.driver.capabilities['platformName'].lower() == 'ios': - def convert_to_12h(hours_24h): - if hours_24h == 0: - return "12", "AM" - elif 1 <= hours_24h <= 11: - return str(hours_24h), "AM" - elif hours_24h == 12: - return "12", "PM" - else: - return str(hours_24h - 12), "PM" - - current_time = selenium_generics.driver.device_time - timestamp_format = '%Y-%m-%dT%H:%M:%S%z' - timestamp_datetime = datetime.strptime(current_time, timestamp_format) - current_hour, current_minute = timestamp_datetime.hour, str(timestamp_datetime.minute) - current_hour, current_time_period = convert_to_12h(current_hour) - time_period = time_period if time_period else current_time_period - - def find_elements(locator, max_attempts=3): - counter = 0 - while counter < max_attempts: - result = selenium_generics.get_elements(locator) - if result: - return result - time.sleep(5) - counter += 1 - raise NoSuchElementException(f"Elements with locator: {locator} not found") - - def identify_current_hour_index(elements): - for idx, e in enumerate(elements): - if e.text == str(current_hour): - return idx - raise ElementNotVisibleException(f"Element with current hour: {current_hour} not found") - - def identify_current_minute_index(elements): - for idx, e in enumerate(elements): - if e.text == str(current_minute): - return idx - raise ElementNotVisibleException(f"Element with current minute: {current_minute} not found") - - def click_on_the_element(elements_, expected_text): - for e in elements_: - if e.text == str(expected_text): - time.sleep(1) - e.click() - break - if e.text == current_hour: - continue - time.sleep(1) - e.click() - - if minutes_from_now: - minutes_from_now = int(minutes_from_now) - new_date = timestamp_datetime + timedelta(minutes=minutes_from_now) - minute = str(new_date.minute) - hour, time_period = convert_to_12h(new_date.hour) - if MOBILE_SUFFIX in locator_path: - with context_manager(selenium_generics): - hour_elements = find_elements(locators.parse_and_get(locator_path, selenium_generics))[:12] - current_hour_index = identify_current_hour_index(hour_elements) - if int(hour) == 12: - hour_elements_ = hour_elements[:current_hour_index + 1][::-1] - click_on_the_element(hour_elements_, hour) - elif int(current_hour) > int(hour) and int(current_hour) != 12: - hour_elements_ = hour_elements[:current_hour_index + 1][::-1] - click_on_the_element(hour_elements_, hour) - else: - hour_elements_ = hour_elements[current_hour_index:13] - click_on_the_element(hour_elements_, hour) - - minute_elements = find_elements(locators.parse_and_get(locator_path, selenium_generics))[12:72] - current_minute_index = identify_current_minute_index(minute_elements) - if int(current_minute) > int(minute): - minute_elements_ = minute_elements[:current_minute_index + 1][::-1] - click_on_the_element(minute_elements_, minute) - else: - minute_elements_ = minute_elements[current_minute_index:72] - click_on_the_element(minute_elements_, minute) - - time_period_elements = find_elements(locators.parse_and_get(locator_path, selenium_generics))[72:74] - click_on_the_element(time_period_elements, time_period) diff --git a/bp_core/frontend/common/step_definitions/mobile_device_actions.py b/bp_core/frontend/common/step_definitions/mobile_device_actions.py index d0e18425..61bfe8a8 100644 --- a/bp_core/frontend/common/step_definitions/mobile_device_actions.py +++ b/bp_core/frontend/common/step_definitions/mobile_device_actions.py @@ -11,25 +11,6 @@ logger = structlog.get_logger(__name__) -# MOBILE Predefined Step -# ID 1201 -@when(parsers.re("I turn '(?PON|OFF)' the network connectivity in Browserstack")) -@then(parsers.re("I turn '(?PON|OFF)' the network connectivity in Browserstack")) -def change_network_status(selenium, request: FixtureRequest, network_status: str): - NETWORK_STATUS = "CHANGE_NETWORK_STATUS_IN_BROWSERSTACK" - payload = {"networkProfile": "no-network"} if network_status.lower() == "off" else {"networkProfile": "reset"} - api_response = dict() - set_request_endpoint(request, base_url="https://api-cloud.browserstack.com/app-automate/sessions/", - endpoint=f"{selenium.session_id}/update_network.json", request_name=NETWORK_STATUS) - selenium_host = request.session.config.option.selenium_host - BS_USERNAME = selenium_host[0: selenium_host.index(":")] - BS_PASSWORD = selenium_host[selenium_host.index(":") + 1: selenium_host.index("@")] - setup_basic_auth(request=request, username=BS_USERNAME, password=BS_PASSWORD) - add_json_payload(request, json_payload=payload, request_name=NETWORK_STATUS) - make_api_request(request, api_response, request_type="PUT", request_name=NETWORK_STATUS) - assert get_api_response(request, api_response, request_name=NETWORK_STATUS).status_code == 200 - - # MOBILE Predefined Step # ID 1202 @when("I reset the mobile app") diff --git a/bp_core/frontend/common/step_definitions/swipe_scroll_move_hover_drag_and_drop.py b/bp_core/frontend/common/step_definitions/swipe_drag_and_drop.py similarity index 98% rename from bp_core/frontend/common/step_definitions/swipe_scroll_move_hover_drag_and_drop.py rename to bp_core/frontend/common/step_definitions/swipe_drag_and_drop.py index 77d5e037..a3202a38 100644 --- a/bp_core/frontend/common/step_definitions/swipe_scroll_move_hover_drag_and_drop.py +++ b/bp_core/frontend/common/step_definitions/swipe_drag_and_drop.py @@ -12,7 +12,6 @@ # WEB context Predefined Step -# ID 301 @given(parsers.re("I drag and drop element '(?P.*)' to element '(?P.*)'")) @when(parsers.re("I drag and drop element '(?P.*)' to element '(?P.*)'")) def drag_and_drop_element(selenium_generics: SeleniumGenerics, locators: Locators, source: str, target: str): @@ -21,7 +20,6 @@ def drag_and_drop_element(selenium_generics: SeleniumGenerics, locators: Locator # WEB context Predefined Step -# ID 302 @given(parsers.re("I drag and drop element '(?P.*)' by offset '(?P.*)' and '(?P.*)'"), converters=dict(x=data_manager.text_formatted, y=data_manager.text_formatted), ) @when(parsers.re("I drag and drop element '(?P.*)' by offset '(?P.*)' and '(?P.*)'"), @@ -32,7 +30,6 @@ def drag_and_drop_element_by_offset(selenium_generics: SeleniumGenerics, locator # WEB context Predefined Step -# ID 303 @given(parsers.re("I scroll to element '(?P.*)'")) @when(parsers.re("I scroll to element '(?P.*)'")) def scroll_to_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str): @@ -44,7 +41,6 @@ def scroll_to_element(selenium_generics: SeleniumGenerics, locators: Locators, l # WEB context Predefined Step -# ID 304 @given(parsers.re("I scroll to view and click on '(?P.*)'")) @when(parsers.re("I scroll to view and click on '(?P.*)'")) def click_on_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str): @@ -54,7 +50,6 @@ def click_on_element(selenium_generics: SeleniumGenerics, locators: Locators, lo # MOBILE context Predefined Step -# ID 305 @given(parsers.re("I scroll to element '(?P.*)' for '(?P.*)' iterations"), converters=dict(iterations=data_manager.text_formatted), ) @when(parsers.re("I scroll to element '(?P.*)' for '(?P.*)' iterations"), @@ -69,7 +64,6 @@ def scroll_to_native_element(selenium_generics: SeleniumGenerics, locators: Loca # WEB & MOBILE contexts Predefined Step -# ID 306 @given(parsers.re("I scroll on the '(?Ptop|bottom)' of the page")) @when(parsers.re("I scroll on the '(?Ptop|bottom)' of the page")) def scroll_to_edge(selenium_generics: SeleniumGenerics, scroll_direction): @@ -84,7 +78,6 @@ def scroll_to_edge(selenium_generics: SeleniumGenerics, scroll_direction): # WEB context Predefined Step -# ID 307 @given(parsers.re("I hover over '(?P.*)'")) @given(parsers.re("I move to element '(?P.*)'")) @when(parsers.re("I hover over '(?P.*)'")) @@ -96,7 +89,6 @@ def hover_over_element(selenium_generics: SeleniumGenerics, locators: Locators, # WEB context Predefined Step -# ID 308 @given(parsers.re("I move to an element '(?P.*)' with offset '(?P.*)' '(?P.*)'"), converters=dict(x=data_manager.text_formatted, y=data_manager.text_formatted), ) @when(parsers.re("I move to an element '(?P.*)' with offset '(?P.*)' '(?P.*)'"), @@ -106,7 +98,6 @@ def move_to_element_by_offset(selenium_generics: SeleniumGenerics, locators: Loc # WEB context Predefined Step -# ID 309 @given(parsers.re("I hover over '(?P.*)' and click element '(?P.*)'")) @when(parsers.re("I hover over '(?P.*)' and click element '(?P.*)'")) def hover_over_and_click_sub_menu( @@ -122,7 +113,6 @@ def hover_over_and_click_sub_menu( # MOBILE context Predefined Step -# ID 310 @given(parsers.re("I swipe down '(?P.*)' % each time for '(?P.*)' times"), converters=dict(percent=data_manager.text_formatted, number=data_manager.text_formatted), ) @when(parsers.re("I swipe down '(?P.*)' % each time for '(?P.*)' times"), @@ -133,7 +123,6 @@ def swipe_down_each_time_in_percentage(selenium_generics: SeleniumGenerics, perc # MOBILE contexts Predefined Step -# ID 311 @given(parsers.re(r"I swipe '(?Pleft|right)' on element '(?P.*)'( by '(?P\d+)' px)?$")) @when(parsers.re(r"I swipe '(?Pleft|right)' on element '(?P.*)'( by '(?P\d+)' px)?$")) def swipe_horizontally_on_element(selenium_generics: SeleniumGenerics, locators: Locators, direction: str, locator_path, @@ -148,7 +137,6 @@ def swipe_horizontally_on_element(selenium_generics: SeleniumGenerics, locators: # MOBILE contexts Predefined Step -# ID 312 @given(parsers.re( r"I swipe '(?Pleft|right)' on the page( from x = '(?P\d+)' px and y = '(?P\d+)' px)?( by '(?P\d+)' px)?$")) @when(parsers.re( diff --git a/bp_core/frontend/common/step_definitions/text_assertion_editing_and_generation.py b/bp_core/frontend/common/step_definitions/text_assertion_editing.py similarity index 69% rename from bp_core/frontend/common/step_definitions/text_assertion_editing_and_generation.py rename to bp_core/frontend/common/step_definitions/text_assertion_editing.py index c4d4beb8..cf595bb3 100644 --- a/bp_core/frontend/common/step_definitions/text_assertion_editing_and_generation.py +++ b/bp_core/frontend/common/step_definitions/text_assertion_editing.py @@ -14,20 +14,21 @@ from bp_core.utils.faker_data import DataUtils from bp_core.utils import data_manager - logger = structlog.get_logger(__name__) - # WEB & MOBILE contexts Predefined Step -# ID 401 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +def element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, + value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) @@ -41,14 +42,17 @@ def element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, # WEB & MOBILE contexts Predefined Step -# ID 402 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' text is not '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +def element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, + value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) @@ -62,13 +66,15 @@ def element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locat # WEB & MOBILE contexts Predefined Step -# ID 403 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) def contains_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): @@ -83,14 +89,17 @@ def contains_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_ # WEB & MOBILE contexts Predefined Step -# ID 404 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def does_not_contain_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain the text '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +def does_not_contain_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, + value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) @@ -104,10 +113,12 @@ def does_not_contain_text(selenium_generics: SeleniumGenerics, locators: Locator # WEB & MOBILE contexts Predefined Step -# ID 405 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' contains any text")) def contains_any_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): @@ -122,10 +133,12 @@ def contains_any_text(selenium_generics: SeleniumGenerics, locators: Locators, s # WEB & MOBILE contexts Predefined Step -# ID 406 -@given(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) -@when(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) -@then(parsers.re("(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The (button|element) '(?P.*)' does not contain any text")) def does_not_contain_any_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): @@ -140,10 +153,10 @@ def does_not_contain_any_text(selenium_generics: SeleniumGenerics, locators: Loc # WEB & MOBILE contexts Predefined Step -# ID 407 @then(parsers.re( "(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' contains the same text as element '(?P.*)'$")) -def check_contains_same_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path1, locator_path2, ): +def check_contains_same_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path1, + locator_path2, ): if MOBILE_SUFFIX in locator_path1 and MOBILE_SUFFIX in locator_path2: with context_manager(selenium_generics): actual_text1 = selenium_generics.get_element_text(locators.parse_and_get(locator_path1, selenium_generics)) @@ -159,10 +172,10 @@ def check_contains_same_text(selenium_generics: SeleniumGenerics, locators: Loca # WEB & MOBILE contexts Predefined Step -# ID 408 @then(parsers.re( "(With soft assertion '(?P.*)' )?I expect that element '(?P.*)' does not contain the same text as element '(?P.*)'$")) -def check_does_not_contain_same_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path1, locator_path2, ): +def check_does_not_contain_same_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, + locator_path1, locator_path2, ): if MOBILE_SUFFIX in locator_path1 and MOBILE_SUFFIX in locator_path2: with context_manager(selenium_generics): actual_text1 = selenium_generics.get_element_text(locators.parse_and_get(locator_path1, selenium_generics)) @@ -178,10 +191,11 @@ def check_does_not_contain_same_text(selenium_generics: SeleniumGenerics, locato # WEB & MOBILE contexts Predefined Step -# ID 409 -@then(parsers.re("(With soft assertion '(?P.*)' )?The trimmed text on (button|element) '(?P.*)' is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def check_element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The trimmed text on (button|element) '(?P.*)' is '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +def check_element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, + value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) @@ -195,10 +209,11 @@ def check_element_equals_text(selenium_generics: SeleniumGenerics, locators: Loc # WEB & MOBILE contexts Predefined Step -# ID 410 -@then(parsers.re("(With soft assertion '(?P.*)' )?The trimmed text on (button|element) '(?P.*)' is not '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def check_element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The trimmed text on (button|element) '(?P.*)' is not '(?P.*)'"), + converters=dict(value=data_manager.text_formatted), ) +def check_element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, + locator_path, value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) @@ -212,19 +227,24 @@ def check_element_not_equals_text(selenium_generics: SeleniumGenerics, locators: # WEB & MOBILE contexts Predefined Step -# ID 411 -@given(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), - converters=dict(value=data_manager.text_formatted)) -@when(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), +@given(parsers.re( + "(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), + converters=dict(value=data_manager.text_formatted)) +@when(parsers.re( + "(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), converters=dict(value=data_manager.text_formatted)) -@then(parsers.re("(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), +@then(parsers.re( + "(With soft assertion '(?P.*)' )?The element '(?P.*)' text value is '(?PEQUAL|LESS_THAN|LESS_THAN_OR_EQUAL|GREATER_THAN|GREATER_THAN_OR_EQUAL)' to '(?P.*)'"), converters=dict(value=data_manager.text_formatted)) -def compare_numbers(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str, soft_assert: str, comparison_value: str, value: str): +def compare_numbers(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str, soft_assert: str, + comparison_value: str, value: str): comparison_values = dict(EQUAL=lambda number_1, number_2: assert_that(number_1).is_equal_to(number_2), LESS_THAN=lambda number_1, number_2: assert_that(number_1).is_less_than(number_2), - LESS_THAN_OR_EQUAL=lambda number_1, number_2: assert_that(number_1).is_less_than_or_equal_to(number_2), + LESS_THAN_OR_EQUAL=lambda number_1, number_2: assert_that( + number_1).is_less_than_or_equal_to(number_2), GREATER_THAN=lambda number_1, number_2: assert_that(number_1).is_greater_than(number_2), - GREATER_THAN_OR_EQUAL=lambda number_1, number_2: assert_that(number_1).is_greater_than_or_equal_to(number_2)) + GREATER_THAN_OR_EQUAL=lambda number_1, number_2: assert_that( + number_1).is_greater_than_or_equal_to(number_2)) number_value = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) if number_value.isnumeric() and number_value.strip().isdigit(): @@ -250,17 +270,15 @@ def compare_numbers(selenium_generics: SeleniumGenerics, locators: Locators, loc # WEB context Predefined Step -# ID 412 @given(parsers.re("I add text '(?P.*)' to field '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) + converters=dict(value=data_manager.text_formatted), ) @when(parsers.re("I add text '(?P.*)' to field '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) + converters=dict(value=data_manager.text_formatted), ) def add_element_value(selenium_generics: SeleniumGenerics, value: str, locators: Locators, locator_path: str): selenium_generics.enter_text(locators.parse_and_get(locator_path, selenium_generics), f"{value}") # WEB & MOBILE contexts Predefined Step -# ID 413 @given(parsers.re("I set text '(?P.*)' to field '(?P.*)'"), converters=dict(value=data_manager.text_formatted), ) @when(parsers.re("I set text '(?P.*)' to field '(?P.*)'"), @@ -274,7 +292,6 @@ def set_element_value(selenium_generics: SeleniumGenerics, value: str, locators: # WEB & MOBILE contexts Predefined Step -# ID 414 @given(parsers.re("I clear text from field '(?P.*)'")) @when(parsers.re("I clear text from field '(?P.*)'")) def clear_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str): @@ -286,7 +303,6 @@ def clear_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_ # WEB context Predefined Step -# ID 415 @given(parsers.re("I clear text using keys from field '(?P.*)'")) @when(parsers.re("I clear text using keys from field '(?P.*)'")) def clear_text_actions(selenium_generics: SeleniumGenerics, locators: Locators, locator_path: str): @@ -294,7 +310,6 @@ def clear_text_actions(selenium_generics: SeleniumGenerics, locators: Locators, # WEB context Predefined Step -# ID 416 @given(parsers.re( "(?PWith gap of (?P\\d+) seconds, )?I type text '(?P.+)' in the input field '(?P.+)'"), converters=dict(text=data_manager.text_formatted)) @@ -302,7 +317,7 @@ def clear_text_actions(selenium_generics: SeleniumGenerics, locators: Locators, "(?PWith gap of (?P\\d+) seconds, )?I type text '(?P.+)' in the input field '(?P.+)'"), converters=dict(text=data_manager.text_formatted)) def step_realistic_typing(selenium_generics: SeleniumGenerics, locators: Locators, - gap_seconds: typing.Union[float, None], text: str, locator_path: str, ): + gap_seconds: typing.Union[float, None], text: str, locator_path: str, ): func = selenium_generics.simulate_realistic_typing gap_seconds = float(gap_seconds or func.__kwdefaults__["gap_seconds"]) func(locators.parse_and_get(locator_path, selenium_generics), text, gap_seconds=gap_seconds) @@ -310,10 +325,12 @@ def step_realistic_typing(selenium_generics: SeleniumGenerics, locators: Locator # WEB context Predefined Step # ID 417 -@given(parsers.re("I add text '(?P.*)' in input field whose attribute '(?P.*)' is equal to '(?P.*)'"), - converters=dict(text=data_manager.text_formatted), ) -@when(parsers.re("I add text '(?P.*)' in input field whose attribute '(?P.*)' is equal to '(?P.*)'"), - converters=dict(text=data_manager.text_formatted), ) +@given(parsers.re( + "I add text '(?P.*)' in input field whose attribute '(?P.*)' is equal to '(?P.*)'"), + converters=dict(text=data_manager.text_formatted), ) +@when(parsers.re( + "I add text '(?P.*)' in input field whose attribute '(?P.*)' is equal to '(?P.*)'"), + converters=dict(text=data_manager.text_formatted), ) def add_text_based_on_attribute(selenium_generics: SeleniumGenerics, locators, text: str, attribute: str, value: str): locator = locators.get_element_by_attribute(attribute, value) num_of_elements = len(selenium_generics.get_elements(locator)) @@ -326,9 +343,12 @@ def add_text_based_on_attribute(selenium_generics: SeleniumGenerics, locators, t # WEB & MOBILE contexts Predefined Step # ID 418, 805 -@given(parsers.re(r"I add random string of length (?:')(?P.*)(?:') composed of (?:')(?Palphabetic characters|numeric characters|alphabetic and numeric characters)(?:') to field (?:')(?P.*)(?:')(\s+)?((?:and save as)\s+(?:')(?P\w+)(?:') environment variable)?$")) -@when(parsers.re(r"I add random string of length (?:')(?P.*)(?:') composed of (?:')(?Palphabetic characters|numeric characters|alphabetic and numeric characters)(?:') to field (?:')(?P.*)(?:')(\s+)?((?:and save as)\s+(?:')(?P\w+)(?:') environment variable)?$")) -def set_random_element_value(selenium_generics: SeleniumGenerics, length: str, character_type: str, locators: Locators, locator_path, storage_var): +@given(parsers.re( + r"I add random string of length (?:')(?P.*)(?:') composed of (?:')(?Palphabetic characters|numeric characters|alphabetic and numeric characters)(?:') to field (?:')(?P.*)(?:')(\s+)?((?:and save as)\s+(?:')(?P\w+)(?:') environment variable)?$")) +@when(parsers.re( + r"I add random string of length (?:')(?P.*)(?:') composed of (?:')(?Palphabetic characters|numeric characters|alphabetic and numeric characters)(?:') to field (?:')(?P.*)(?:')(\s+)?((?:and save as)\s+(?:')(?P\w+)(?:') environment variable)?$")) +def set_random_element_value(selenium_generics: SeleniumGenerics, length: str, character_type: str, locators: Locators, + locator_path, storage_var): storage_var = storage_var if storage_var else None if length.isdigit(): random_string = DataUtils.get_random_text(length=int(length), source=character_type) @@ -345,10 +365,11 @@ def set_random_element_value(selenium_generics: SeleniumGenerics, length: str, c # WEB & MOBILE contexts Predefined Step # ID 419 -@given(parsers.re(r"I add a random email to field '(?P.*)'((\s+)?with (?:')(?P.*)(?:') domain)?$"), - converters=dict(domain=data_manager.text_formatted), ) +@given( + parsers.re(r"I add a random email to field '(?P.*)'((\s+)?with (?:')(?P.*)(?:') domain)?$"), + converters=dict(domain=data_manager.text_formatted), ) @when(parsers.re(r"I add a random email to field '(?P.*)'((\s+)?with (?:')(?P.*)(?:') domain)?$"), - converters=dict(domain=data_manager.text_formatted), ) + converters=dict(domain=data_manager.text_formatted), ) def set_random_email_value(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, domain: str): domain = domain if domain else "gmail.com" random_email = DataUtils().get_random_email(domain=domain) @@ -361,23 +382,23 @@ def set_random_email_value(selenium_generics: SeleniumGenerics, locators: Locato # WEB & MOBILE contexts Predefined Step -# ID 420 @given(parsers.re( "(With soft assertion '(?P.*)' )?The element '(?P.*)' text after removing new lines is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) + converters=dict(value=data_manager.text_formatted), ) @when(parsers.re( "(With soft assertion '(?P.*)' )?The element '(?P.*)' text after removing new lines is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) + converters=dict(value=data_manager.text_formatted), ) @then(parsers.re( "(With soft assertion '(?P.*)' )?The element '(?P.*)' text after removing new lines is '(?P.*)'"), - converters=dict(value=data_manager.text_formatted), ) -def element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, value: str): + converters=dict(value=data_manager.text_formatted), ) +def element_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, soft_assert: str, locator_path, + value: str): if MOBILE_SUFFIX in locator_path: with context_manager(selenium_generics): - actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics))\ + actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) \ .replace("\n", "") else: - actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics))\ + actual_text = selenium_generics.get_element_text(locators.parse_and_get(locator_path, selenium_generics)) \ .replace("\n", "") if soft_assert is not None and soft_assert.lower() == 'true': with check: diff --git a/bp_core/frontend/common/utils/__init__.py b/bp_core/frontend/common/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/frontend/common/utils/locator_parser.py b/bp_core/frontend/common/utils/locator_parser.py index e16c43a0..e5373f71 100644 --- a/bp_core/frontend/common/utils/locator_parser.py +++ b/bp_core/frontend/common/utils/locator_parser.py @@ -15,10 +15,6 @@ __all__ = ["parse_locator", "Locators"] -# locator format: "[ID]ikkzvv" or "[TN]td" or "[XP]//div/span" -# shadow locator format: "[ID]ikkzvv -> .className -> [TN]grv-input" - - def _parse_locator_string( locator_string: str, default_loc_type=ValidLocatorTypes.XP ) -> Locator: diff --git a/bp_core/installation/__init__.py b/bp_core/installation/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/installation/installation_scripts/__init__.py b/bp_core/installation/installation_scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/installation/installation_tests/__init__.py b/bp_core/installation/installation_tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/lib/__init__.py b/bp_core/lib/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py b/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py index d9c19926..afd4216b 100644 --- a/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py +++ b/bp_core/lib/pytest_testrail_client/pytest_testrail_client.py @@ -403,8 +403,6 @@ def build_case( tg["name"].replace("@", "") for tg in (feature_refs + scenario_refs) ) - # Setting Case tags - Reads the scenario and feature level tags except "automated', "manual", "nondestructive" and - # anything with "project_name-" raw_custom_tags = [ sc["name"] for sc in scenario["tags"] @@ -702,11 +700,6 @@ def export_tests_results(session, tr: TestRailAPI, project_data: dict, scenarios # tr_plan = tr.plans.get_plan(project_data["plan_id"]) tr_statuses = tr.statuses.get_statuses() - """ - Commenting out these lines for now as its more related to suites - and also not really working appropriately in both cases (type1 and type3) - We can delete it later if no regression. I have tested few scenarios and it worked fine - """ tr_plan = tr.plans.get_plan(project_data["plan_id"]) for tr_plan_entry in tr_plan.entries: diff --git a/bp_core/lib/pytest_testrail_client/testrail_api.py b/bp_core/lib/pytest_testrail_client/testrail_api.py index 9f55eba1..f367e47c 100644 --- a/bp_core/lib/pytest_testrail_client/testrail_api.py +++ b/bp_core/lib/pytest_testrail_client/testrail_api.py @@ -14,14 +14,6 @@ def validate_setup(tr: TestRailAPI, project_id): f"Project ID must be set. Invalid value {project_id}" ) - """ This can be un-commented after completely moving to Project Type1""" - # project_id = int(project_id) - # if tr.projects.get_project(project_id).suite_mode != 1: - # TestRailConfigurationError( - # f"Project suite_mode {tr.projects.get_project().suite_mode} not compatible with this plugin. " - # f"Use Single repository to manage cases" - # ) - class TestRailAPI(Session): """API reference: https://support.testrail.com/hc/en-us/sections/7077185274644-API-reference""" diff --git a/bp_core/plugin.py b/bp_core/plugin.py index f5c24a3c..dad16f35 100644 --- a/bp_core/plugin.py +++ b/bp_core/plugin.py @@ -220,7 +220,6 @@ def pytest_sessionstart(session: pytest.Session) -> None: @pytest.hookimpl(tryfirst=True) def pytest_sessionfinish(session, exitstatus) -> None: - """Called after whole test run finished, right before returning the exit status to the system. :param pytest.Session session: The pytest session object. @@ -272,7 +271,7 @@ def pytest_sessionfinish(session, exitstatus) -> None: # HTML Report: Show Tests Scripts Version and App Version in the HTML report if os.getenv("CI") == "true": if os.environ.get("TEST_SCRIPTS_VERSION", None) and not \ - os.environ.get("TEST_SCRIPTS_VERSION", "").startswith("refs"): + os.environ.get("TEST_SCRIPTS_VERSION", "").startswith("refs"): metadata["Test Scripts Version"] = os.environ.get("TEST_SCRIPTS_VERSION", "") if os.environ.get("APP_VERSION", None): metadata["App Version"] = os.environ.get("APP_VERSION") @@ -300,7 +299,7 @@ def pytest_sessionfinish(session, exitstatus) -> None: # Collect all tags / markers for the tests def pytest_collection_modifyitems( - config: pytest_config.Config, items: List[pytest.Item] + config: pytest_config.Config, items: List[pytest.Item] ) -> None: """Called after collection has been performed. May filter or re-order the items in-place. @@ -316,8 +315,8 @@ def pytest_collection_modifyitems( for marker in item.cls.pytestmark: item.add_marker(marker.name) if ( - "pytest_testrail_export_test_cases" not in config.option - or config.option.pytest_testrail_export_test_cases is False + "pytest_testrail_export_test_cases" not in config.option + or config.option.pytest_testrail_export_test_cases is False ): raw_tags = config.option.tags if raw_tags is not None: @@ -445,7 +444,7 @@ def pytest_runtest_makereport(item, call): if driver.capabilities.get("browserVersion", False): html_metadata["Driver"].update({"Browser version": str(driver.capabilities["browserVersion"])}) if driver.capabilities.get("browserstack", "") == "True" or \ - html_metadata.get('Capabilities', {}).get('browserstack', None) == "True": + html_metadata.get('Capabilities', {}).get('browserstack', None) == "True": html_metadata.update({"Server": "Browserstack"}) xfail = hasattr(rep, "wasxfail") @@ -555,8 +554,9 @@ def pytest_html_results_table_row(report, cells): if link[0] == "Browser Log": setattr(link.attr, "download", f"{link[0]}") elif link[0] in ( - "URL", "Driver Log", "HTML", "Syslog Log", "Crashlog Log", "Performance Log", "Logcat Log", - "Bugreport Log"): + "URL", "Driver Log", "HTML", "Syslog Log", "Crashlog Log", "Performance Log", + "Logcat Log", + "Bugreport Log"): del link[0] cells[2], cells[3] = cells[3], cells[2] else: @@ -616,11 +616,11 @@ def pytest_html_results_summary(prefix, summary, postfix): if result: failed_count = result.group() if ( - isinstance(passed_count, str) - and isinstance(failed_count, str) - and passed_count.isnumeric() - and failed_count.isnumeric() - and int(passed_count) + int(failed_count) > 0 + isinstance(passed_count, str) + and isinstance(failed_count, str) + and passed_count.isnumeric() + and failed_count.isnumeric() + and int(passed_count) + int(failed_count) > 0 ): pass_rate = float((int(passed_count) / (int(passed_count) + int(failed_count))) * 100) if pass_rate is not None: diff --git a/bp_core/__init__.py b/bp_core/setup/setup_scripts/__init__.py similarity index 100% rename from bp_core/__init__.py rename to bp_core/setup/setup_scripts/__init__.py diff --git a/bp_core/installation/installation_scripts/download_assets.py b/bp_core/setup/setup_scripts/download_assets.py similarity index 100% rename from bp_core/installation/installation_scripts/download_assets.py rename to bp_core/setup/setup_scripts/download_assets.py diff --git a/bp_core/installation/installation_scripts/text_formatting.py b/bp_core/setup/setup_scripts/text_formatting.py similarity index 100% rename from bp_core/installation/installation_scripts/text_formatting.py rename to bp_core/setup/setup_scripts/text_formatting.py diff --git a/bp_core/frontend/__init__.py b/bp_core/setup/setup_tests/__init__.py similarity index 100% rename from bp_core/frontend/__init__.py rename to bp_core/setup/setup_tests/__init__.py diff --git a/bp_core/installation/installation_tests/conftest.py b/bp_core/setup/setup_tests/conftest.py similarity index 100% rename from bp_core/installation/installation_tests/conftest.py rename to bp_core/setup/setup_tests/conftest.py diff --git a/bp_core/installation/installation_tests/test_installation_check.py b/bp_core/setup/setup_tests/test_installation_check.py similarity index 77% rename from bp_core/installation/installation_tests/test_installation_check.py rename to bp_core/setup/setup_tests/test_installation_check.py index 3765b735..6ab80aa4 100644 --- a/bp_core/installation/installation_tests/test_installation_check.py +++ b/bp_core/setup/setup_tests/test_installation_check.py @@ -5,7 +5,7 @@ @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_root_folder(): assert_that(os.path.isfile("./.editorconfig")).is_true() assert_that(os.path.isfile("./.gitignore")).is_true() @@ -15,11 +15,12 @@ def test_check_root_folder(): assert_that(os.path.isfile("./pytest.ini")).is_true() assert_that(os.path.isfile("./README.md")).is_true() assert_that(os.path.isfile("./requirements.txt")).is_true() + assert_that(os.path.isfile("./docker-compose.yml")).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_bp_core_folder(): assert_that(os.path.isfile("./bp_core/.pylintrc")).is_true() assert_that(os.path.isfile("./bp_core/plugin.py")).is_true() @@ -27,14 +28,14 @@ def test_check_bp_core_folder(): assert_that(os.path.isfile("./bp_core/notifications/teams_plugin.py")).is_true() assert_that(os.path.isdir("./bp_core/backend")).is_true() assert_that(os.path.isdir("./bp_core/frontend")).is_true() - assert_that(os.path.isdir("./bp_core/installation")).is_true() + assert_that(os.path.isdir("./bp_core/setup")).is_true() assert_that(os.path.isdir("./bp_core/lib")).is_true() assert_that(os.path.isdir("./bp_core/utils")).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_common_ui_folder(): assert_that( os.path.isfile("./bp_core/frontend/common/helpers/elements.py") @@ -55,44 +56,41 @@ def test_check_common_ui_folder(): @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_screenshots_folder(): assert_that(os.path.isdir("./output/screenshots")).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_step_definitions_folder(): assert_that(os.path.isdir("./bp_core/frontend/common/step_definitions")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/api_bdd.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/browser_navigation_window_tabs_and_screenshots.py")).is_true() + assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/browser_navigation.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/click_touch_and_keyboard_actions.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/date_time_and_pause.py")).is_true() + assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/date_time.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/dropdowns.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/element_existence_visibility_and_attribute_assertion.py")).is_true() + assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/attribute_assertion.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/environment_variables.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/excel_and_csv.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/html_tables.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/ionic_hybrid_mobile_apps_steps.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/mobile_device_actions.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/swipe_scroll_move_hover_drag_and_drop.py")).is_true() - assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/text_assertion_editing_and_generation.py")).is_true() + assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/swipe_drag_and_drop.py")).is_true() + assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/text_assertion_editing.py")).is_true() assert_that(os.path.isfile("./bp_core/frontend/common/step_definitions/visual_comparison.py")).is_true() - assert_that(os.path.isdir("./bp_core/backend/common/step_definitions")).is_true() assert_that(os.path.isfile("./bp_core/backend/common/step_definitions/steps_common.py")).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_test_data_folder(): assert_that(os.path.isdir("./test_data")).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_utils_folder(): assert_that(os.path.isdir("./bp_core/utils")).is_true() assert_that(os.path.isfile("./bp_core/utils/env_variables.py")).is_true() @@ -104,7 +102,7 @@ def test_check_utils_folder(): @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_configs_folder(): assert_that(os.path.isdir("./env_configs")).is_true() assert_that(os.path.isfile("./env_configs/.local.env")).is_true() @@ -112,7 +110,7 @@ def test_check_configs_folder(): @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_lib_folder(): assert_that(os.path.isdir("./bp_core/lib")).is_true() assert_that(os.path.isdir("./bp_core/lib/pytest_testrail_client")).is_true() @@ -120,18 +118,18 @@ def test_check_lib_folder(): @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_installation_folder(): - assert_that(os.path.isdir("./bp_core/installation")).is_true() - assert_that(os.path.isdir("./bp_core/installation/installation_scripts")).is_true() - assert_that(os.path.isdir("./bp_core/installation/installation_tests")).is_true() + assert_that(os.path.isdir("./bp_core/setup")).is_true() + assert_that(os.path.isdir("./bp_core/setup/setup_scripts")).is_true() + assert_that(os.path.isdir("./bp_core/setup/setup_tests")).is_true() assert_that( - os.path.isfile("./bp_core/installation/installation_scripts/download_assets.py") + os.path.isfile("./bp_core/setup/setup_scripts/download_assets.py") ).is_true() @pytest.mark.nondestructive @pytest.mark.automated -@pytest.mark.installation_check +@pytest.mark.setup_check def test_check_binaries_folder(): assert_that(os.path.isdir("./webdriver")).is_true() diff --git a/bp_core/utils/__init__.py b/bp_core/utils/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/bp_core/utils/data_manager.py b/bp_core/utils/data_manager.py index 0c63042a..17453baf 100644 --- a/bp_core/utils/data_manager.py +++ b/bp_core/utils/data_manager.py @@ -3,6 +3,7 @@ from bp_core.utils.dataset_handler import DatasetHandler + def text_formatted(string_to_format: str): """text_formatted diff --git a/frontend/test_project/step_definitions/shared_steps/common_steps.py b/frontend/test_project/step_definitions/shared_steps/common_steps.py index 7f6560fd..1b1d453f 100644 --- a/frontend/test_project/step_definitions/shared_steps/common_steps.py +++ b/frontend/test_project/step_definitions/shared_steps/common_steps.py @@ -8,15 +8,16 @@ from bp_core.frontend.common.helpers.app import context_manager from pathlib import Path -MOBILE_SUFFIX = "_mob" from bp_core.utils import data_manager -from bp_core.frontend.common.step_definitions.element_existence_visibility_and_attribute_assertion import \ +from bp_core.frontend.common.step_definitions.attribute_assertion import \ element_displayed, wait_for_displayed from bp_core.frontend.common.step_definitions.click_touch_and_keyboard_actions import click_on_locator -from bp_core.frontend.common.step_definitions.text_assertion_editing_and_generation import set_element_value, \ +from bp_core.frontend.common.step_definitions.text_assertion_editing import set_element_value, \ element_equals_text +MOBILE_SUFFIX = "_mob" + @given(parsers.re("I set selenium resolution to '(?P.*)' per '(?P.*)'"), converters=dict(width=str, height=str)) diff --git a/frontend/test_project/step_definitions/test_steps/test_api_steps.py b/frontend/test_project/step_definitions/test_steps/test_api_steps.py index 401d60d3..64a896e3 100644 --- a/frontend/test_project/step_definitions/test_steps/test_api_steps.py +++ b/frontend/test_project/step_definitions/test_steps/test_api_steps.py @@ -1,3 +1,4 @@ +import os from pytest_bdd import scenarios diff --git a/android_local_run.sh b/local_run_android.sh similarity index 100% rename from android_local_run.sh rename to local_run_android.sh diff --git a/api_run.sh b/local_run_api.sh similarity index 100% rename from api_run.sh rename to local_run_api.sh diff --git a/web_local_run.sh b/local_run_web.sh similarity index 100% rename from web_local_run.sh rename to local_run_web.sh diff --git a/setup_install.py b/setup_install.py index 3db88a3b..613d077b 100755 --- a/setup_install.py +++ b/setup_install.py @@ -7,7 +7,7 @@ import venv from collections import namedtuple from pathlib import Path -from bp_core.installation.installation_scripts.text_formatting import BColors, print_red, print_green, print_cyan +from bp_core.setup.setup_scripts.text_formatting import BColors, print_red, print_green, print_cyan TERMINAL_WIDTH = 100 try: @@ -23,7 +23,7 @@ def install_selenium_drivers(): print_green(_ := "Installing Selenium Drivers") print_green("-" * len(_)) - from bp_core.installation.installation_scripts.download_assets import get_bs_local_by_platform + from bp_core.setup.setup_scripts.download_assets import get_bs_local_by_platform PROJECT_DIR = Path.cwd() TEMP_DIR = PROJECT_DIR / "temp" @@ -48,10 +48,10 @@ def run_install_tests(): TESTS_ARGS = [ "-v", "--gherkin-terminal-reporter", - "--tags=installation_check" + "--tags=setup_check" ] - print_green(_ := "Running default tests to validate installation") + print_green(_ := "Running default tests to validate setup") print_green("-" * len(_)) os.environ['BOILERPLATE_INSTALLATION'] = 'True' test = pytest.main(TESTS_ARGS) @@ -64,7 +64,7 @@ def run_install_tests(): print_red("Installation Tests Returned Exit Code:", test) print_red("INSTALLATION FAILED !!!.") print_red( - "Please review the installation check results in terminal logs above, fix the script, and re-run. If the issue seems to be in boilerplate framework itself, then raise an issue in github." + "Please review the setup check results in terminal logs above, fix the script, and re-run. If the issue seems to be in boilerplate framework itself, then raise an issue in github." ) @@ -85,7 +85,7 @@ def check_for_python_v3_9(self) -> None: if not self.py_ver.startswith("3.9"): sys.exit( BColors.FAIL - + "Unsupported Python Version. Please install Python Version 3.9.X and proceed (Recommended = 3.9.6 and above). For installation instruction, please refer project README.md" + + "Unsupported Python Version. Please install Python Version 3.9.X and proceed (Recommended = 3.9.6 and above). For setup instruction, please refer project README.md" + BColors.ENDC ) diff --git a/setup_install.sh b/setup_install.sh index af37e853..02fe3c66 100755 --- a/setup_install.sh +++ b/setup_install.sh @@ -23,7 +23,7 @@ fi echo "Activated Virtual Environment .bp-venv..." echo "\n" -# Activate Virtual Environment and then run remaining installation steps that's dependent on venv & dependencies. +# Activate Virtual Environment and then run remaining setup steps that's dependent on venv & dependencies. python ./setup_install.py venv RETCODE=$?