From f9e8fa25bd8e5faa8eda4ba03a453b8d20ed8c27 Mon Sep 17 00:00:00 2001 From: Ayima Okeeva Date: Wed, 11 Dec 2024 10:43:06 +0100 Subject: [PATCH] Trying out to click inside the search field of the Mtype --- .github/workflows/selenium-tests.yml | 16 +++--- locators/explore_morphology_locators.py | 1 + pages/explore_morphology.py | 3 + tests/test_morphology.py | 74 +++++++++++++------------ 4 files changed, 50 insertions(+), 44 deletions(-) diff --git a/.github/workflows/selenium-tests.yml b/.github/workflows/selenium-tests.yml index c0d4f73..6f58910 100644 --- a/.github/workflows/selenium-tests.yml +++ b/.github/workflows/selenium-tests.yml @@ -83,11 +83,11 @@ jobs: $SLACK_WEBHOOK_URL_PASS # Step 8: Slack notification on failure - - name: Notify Slack on Failure - if: failure() - env: - SLACK_WEBHOOK_URL_FAIL: ${{ secrets.SLACK_WEBHOOK_URL_FAIL }} - run: | - curl -X POST -H 'Content-type: application/json' \ - --data "{\"text\":\":x: Test pipeline failed in *${{ github.repository }}*. Branch: *${{ github.ref_name }}*. Check the logs for details.\", \"username\":\"GitHub Actions\", \"icon_emoji\":\":warning:\"}" \ - $SLACK_WEBHOOK_URL_FAIL \ No newline at end of file +# - name: Notify Slack on Failure +# if: failure() +# env: +# SLACK_WEBHOOK_URL_FAIL: ${{ secrets.SLACK_WEBHOOK_URL_FAIL }} +# run: | +# curl -X POST -H 'Content-type: application/json' \ +# --data "{\"text\":\":x: Test pipeline failed in *${{ github.repository }}*. Branch: *${{ github.ref_name }}*. Check the logs for details.\", \"username\":\"GitHub Actions\", \"icon_emoji\":\":warning:\"}" \ +# $SLACK_WEBHOOK_URL_FAIL \ No newline at end of file diff --git a/locators/explore_morphology_locators.py b/locators/explore_morphology_locators.py index 163aa9a..6d7b08d 100644 --- a/locators/explore_morphology_locators.py +++ b/locators/explore_morphology_locators.py @@ -44,6 +44,7 @@ class ExploreMorphologyPageLocators: "before:!content-none ant-table-cell-ellipsis' and " "@title='L5_TPC:A']") FILTER_MTYPE_SEARCH = (By.XPATH, "//div[@class='ant-select-selection-overflow']") + ANT_SELECT_SELECTOR = (By.XPATH, "(//div[@class='ant-select-selector'])[2]") FILTER_MTYPE_TEXT_INPUT = (By.XPATH, "(//input[@class='ant-select-selection-search-input'])[2]") FILTER_PANEL = (By.XPATH, "//div[@data-testid='listing-view-filter-panel']") FIRST_ROW = (By.XPATH, "//tbody[@class='ant-table-tbody']/tr[2]") diff --git a/pages/explore_morphology.py b/pages/explore_morphology.py index a1595bf..fff98e2 100644 --- a/pages/explore_morphology.py +++ b/pages/explore_morphology.py @@ -216,3 +216,6 @@ def is_filter_panel_closed(self): def lv_filter_search(self): return self.find_element(ExploreMorphologyPageLocators.LV_FILTER_SEARCH) + + def ant_selector(self): + return self.find_element(ExploreMorphologyPageLocators.ANT_SELECT_SELECTOR) diff --git a/tests/test_morphology.py b/tests/test_morphology.py index c632010..f001a5e 100644 --- a/tests/test_morphology.py +++ b/tests/test_morphology.py @@ -23,41 +23,41 @@ def test_explore_morphology(self, setup, login, logger): morphology_tab = explore_morphology.find_morphology_tab() logger.info("Morphology tab is displayed") - # column_locators = [ - # ExploreMorphologyPageLocators.LV_PREVIEW, - # ExploreMorphologyPageLocators.LV_BRAIN_REGION, - # ExploreMorphologyPageLocators.LV_MTYPE, - # ExploreMorphologyPageLocators.LV_NAME, - # ExploreMorphologyPageLocators.LV_SPECIES, - # ] - # column_headers = explore_morphology.find_column_headers(column_locators) - # - # for header in column_headers: - # assert header.is_displayed(), f"Column header {header} is not displayed." - # logger.info("Morphology column headers are displayed.") - # - # thumbnail_img = explore_morphology.verify_all_thumbnails_displayed() - # logger.info("Morphology thumbnail is displayed.") - # - # for thumbnail in thumbnail_img: - # assert thumbnail['is_displayed'], f"Thumbnail {thumbnail['element']} is not displayed!" - # logger.info(f"Thumbnail {thumbnail['element']} is displayed.") - # - # results = explore_morphology.find_results() - # logger.info("Total number of results for morphology tab is displayed.") - # - # original_data = explore_morphology.get_table_data() - # logger.info("Fetch table data before sorting") - # - # br_sort_arrow = explore_morphology.find_br_sort_arrow() - # br_sort_arrow.click() - # logger.info("Click the column sort arrow.") - # - # explore_morphology.wait_for_page_ready(timeout=15) - # logger.info("Wait for the sorting action to complete.") - # sorted_data = explore_morphology.get_table_data() - # assert original_data != sorted_data, "Table data did not change after sorting." - # logger.info("Asserting that the table data was sorted.") + column_locators = [ + ExploreMorphologyPageLocators.LV_PREVIEW, + ExploreMorphologyPageLocators.LV_BRAIN_REGION, + ExploreMorphologyPageLocators.LV_MTYPE, + ExploreMorphologyPageLocators.LV_NAME, + ExploreMorphologyPageLocators.LV_SPECIES, + ] + column_headers = explore_morphology.find_column_headers(column_locators) + + for header in column_headers: + assert header.is_displayed(), f"Column header {header} is not displayed." + logger.info("Morphology column headers are displayed.") + + thumbnail_img = explore_morphology.verify_all_thumbnails_displayed() + logger.info("Morphology thumbnail is displayed.") + + for thumbnail in thumbnail_img: + assert thumbnail['is_displayed'], f"Thumbnail {thumbnail['element']} is not displayed!" + logger.info(f"Thumbnail {thumbnail['element']} is displayed.") + + results = explore_morphology.find_results() + logger.info("Total number of results for morphology tab is displayed.") + + original_data = explore_morphology.get_table_data() + logger.info("Fetch table data before sorting") + + br_sort_arrow = explore_morphology.find_br_sort_arrow() + br_sort_arrow.click() + logger.info("Click the column sort arrow.") + + explore_morphology.wait_for_page_ready(timeout=15) + logger.info("Wait for the sorting action to complete.") + sorted_data = explore_morphology.get_table_data() + assert original_data != sorted_data, "Table data did not change after sorting." + logger.info("Asserting that the table data was sorted.") morphology_filter = explore_morphology.morphology_filter() morphology_filter.click() @@ -86,7 +86,9 @@ def test_explore_morphology(self, setup, login, logger): filter_mtype_text_input.send_keys(Keys.ENTER) logger.info("L5_TPC:A is typed in the search field.") explore_morphology.wait_for_page_ready(timeout=15) - lv_filter_search_field = explore_morphology.lv_filter_search() + ant_selector = explore_morphology.ant_selector() + ant_selector.click() + logger.info("CLICKED ON ANT SELECTOR") logger.info("Found filter search field") lv_filter_apply_btn = explore_morphology.lv_filter_apply(timeout=10) assert lv_filter_apply_btn, f"The APPLY button is not found"