Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pytest.mark.run order to the rest of the pages #10

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locators/explore_ephys_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class ExploreEphysLocators:
"before:!content-none ant-table-cell-ellipsis'])[1]")
LV_SPECIES = (By.XPATH, "//th[@data-testid='column-header']//div[text()='Species']")
LV_THUMBNAIL = (By.XPATH, "//img[@alt='img preview']")
LV_TOTAL_RESULTS = (By.XPATH, "//div[@class='w-max']")
SEARCHED_SPECIES = (By.XPATH, "//td[@title='Rattus norvegicus' and contains(text(),'Rattus "
"norvegicus')][1]")
SEARCH_BUTTON = (By.XPATH, "//span[@aria-label='search']/parent::button[@type='button']")
Expand Down
14 changes: 8 additions & 6 deletions locators/explore_model_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@


class ExploreModelPageLocators:
EMODEL_TAB = (By.XPATH, "//li[@title='E-model']")
ME_MODEL_TAB = (By.XPATH, "//li[@title='ME-model']")
BRAIN_REGION_PANEL = (By.XPATH, "(//div[@class='flex h-screen flex-col bg-primary-8'])[1]")
BR_SEARCH_FIELD_TYPE = (By.XPATH, "//span[@class='ant-select-selection-search']")
BR_SEARCH_REGION_SEARCH_FIELD = (By.XPATH, "//div[@class='ant-select-selector']")
BR_CEREBRUM_TITLE = (By.XPATH, "//button[starts-with(@class, 'flex h-auto "
"items-center')]/span[contains(.,'Cerebrum')]")
CLOSE_BRAIN_REGION_PANEL_BTN = (By.XPATH, "(//button[starts-with(@class, 'ant-btn')]/span["
"@class='ant-btn-icon'])[1]")
BR_SEARCH_REGION_SEARCH_FIELD = (By.XPATH, "//div[@class='ant-select-selector']")
BR_SEARCH_FIELD_TYPE = (By.XPATH, "//span[@class='ant-select-selection-search']")
BRAIN_REGION_PANEL = (By.XPATH, "(//div[@class='flex h-screen flex-col bg-primary-8'])[1]")
SELECTED_BRAIN_REGION = (By.XPATH, "//h1[@title='Isocortex']/span[text()='Isocortex']")
EMODEL_TAB = (By.XPATH, "//li[@title='E-model']")
ME_MODEL_TAB = (By.XPATH, "//li[@title='ME-model']")
SEARCH_REGION = (By.XPATH, "//input[@class='ant-select-selection-search-input']")
SELECTED_BRAIN_REGION = (By.XPATH, "//h1[@title='Isocortex']/span[text()='Isocortex']")
4 changes: 2 additions & 2 deletions locators/home_page_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class HomePageLocators:
LOGIN_BUTTON = (By.XPATH, "//a[contains(.,'Log in')]")
ABOUT = (By.XPATH, "(//a[@href='/app/about'])[2]")
BB_GITHUB_BTN = (By.XPATH, "(//a[@href='https://github.com/BlueBrain'])[2]")
BBOP1 = (By.XPATH, "(//img[@alt='bbop'])[1]")
BBOP2 = (By.XPATH, "(//img[@alt='bbop'])[2]")
BBOP1 = (By.XPATH, "(//a[@href='/app'])[1]")
BBOP2 = (By.XPATH, "(//a[@href='/app'])[2]")
BBP1 = (By.CSS_SELECTOR, "a[href='https://www.epfl.ch/research/domains/bluebrain/']")
BBP2 = (By.CSS_SELECTOR, "a[href='https://portal.bluebrain.epfl.ch/']")
BIG_TITLE1 = (By.XPATH, "//h3[contains(text(),'Why Blue Brain Github')]")
Expand Down
3 changes: 3 additions & 0 deletions pages/explore_efys.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def lv_filter_apply(self):
def lv_row1(self):
return self.find_element(ExploreEphysLocators.LV_ROW1)

def lv_total_results(self):
return self.find_element(ExploreEphysLocators.LV_TOTAL_RESULTS)

def perform_full_validation(self):
self.validate_empty_cells()
load_more_button = self.find_load_more_btn()
Expand Down
12 changes: 9 additions & 3 deletions pages/explore_model_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ def find_emodel_tab(self):
def find_brain_region_search_field(self, timeout=20):
return self.find_element(ExploreModelPageLocators.SEARCH_REGION, timeout=timeout)

def find_selected_brain_region_title(self):
return self.find_element(ExploreModelPageLocators.SELECTED_BRAIN_REGION)

def find_brain_region_panel(self):
return self.find_element(ExploreModelPageLocators.BRAIN_REGION_PANEL)

def find_br_cerebrum_title(self):
return self.find_element(ExploreModelPageLocators.BR_CEREBRUM_TITLE)

def brain_region_panel_close_btn(self):
return self.find_element(ExploreModelPageLocators.CLOSE_BRAIN_REGION_PANEL_BTN)

def find_selected_brain_region_title(self):
return self.find_element(ExploreModelPageLocators.SELECTED_BRAIN_REGION)



12 changes: 0 additions & 12 deletions pages/explore_ndensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ def find_load_more_btn(self):
def find_table_rows(self):
return self.wait.find_all_elements(ExploreNDensityPageLocators.TABLE_ROWS)

def validate_empty_cells_in_contributors(self):
empty_cells = self.find_empty_cells_in_contributors_column()
for cell_index, cell in empty_cells:
error_message = f'Error: Empty field in cell {cell_index}'
print(error_message)

def perform_full_validation(self, max_load_more_clicks=5):
for _ in range(max_load_more_clicks):
self.validate_empty_cells_in_contributors()
load_more_button = self.find_load_more_btn()
load_more_button.click()

def find_ndensity_tab(self):
return self.find_element(ExploreNDensityPageLocators.NDENSITY_TAB)

Expand Down
5 changes: 4 additions & 1 deletion tests/test_explore_ephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestExploreEphys:
@pytest.mark.explore_page
# @pytest.mark.run(order=4)
@pytest.mark.run(order=4)
def test_explore_ephys_page(self, setup, login, logger):
browser, wait = setup
explore_ephys_page = ExploreElectrophysiologyPage(browser, wait)
Expand Down Expand Up @@ -110,6 +110,9 @@ def test_explore_ephys_page(self, setup, login, logger):
value_found = any(expected in row.text for row in filtered_etype)
assert value_found, (f'The value {expected} is not found in the table after applying the '
f'filter')
lv_total_results = explore_ephys_page.lv_total_results()
lv_total_text = lv_total_results.text
logger.info(f"The total results for Ephys/ bNAC is: {lv_total_text}")

lv_row1 = explore_ephys_page.lv_row1().click()
logger.info("Clicked on row 1 to see 'Detail View'.")
Expand Down
6 changes: 2 additions & 4 deletions tests/test_explore_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class TestExploreModelPage:
@pytest.mark.explore_page
# @pytest.mark.run(order=3)
@pytest.mark.run(order=7)
def test_explore_model(self, setup, login, logger):
"""
The commented out code below is pending changes in the platform.
Expand All @@ -31,8 +31,7 @@ def test_explore_model(self, setup, login, logger):

emodel_tab = explore_model.find_emodel_tab()
logger.info("E-model data tab is found")

cerebrum_title = explore_model.find_cerebrum_title()
cerebrum_title = explore_model.find_br_cerebrum_title()
cerebrum_text = cerebrum_title.text
logger.info(f"Found text: {cerebrum_text}")

Expand All @@ -54,4 +53,3 @@ def test_explore_model(self, setup, login, logger):
"found")
brain_region_panel_close_btn.click()
logger.info("Brain region panel is toggled close")
time.sleep(5)
8 changes: 1 addition & 7 deletions tests/test_explore_ndensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@

class TestExploreNeuronDensity:
@pytest.mark.build_page
# @pytest.mark.run(order=7)
@pytest.mark.skip(reason="Sorting not implemented yet.")
def test_sorting_functionality(self):
# Placeholder logic for a test
assert False

@pytest.mark.run(order=5)
def test_explore_neuron_density_page(self, setup, login, logger):
browser, wait = setup
explore_ndensity = ExploreNeuronDensityPage(browser, wait)
explore_ndensity.go_to_explore_neuron_density_page()
# validate_table_fields = explore_ndensity_page.perform_full_validation()
explore_ndensity_tab = explore_ndensity.find_ndensity_tab()
logger.info("Neuron density tab is displayed")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_explore_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_explore_page(self, setup, login, logger):
logger.info(f"Found the switch count/density button")
current_state = count_switch_button.get_attribute('aria-checked')
logger.info(f"Current state of the total count switch: {current_state}")

time.sleep(2)
if current_state == "false":
count_switch_button.click()
logger.info("Switch toggled to 'true'.")
Expand Down
Loading