from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from ui.helpers import assertions as assr from steps.ui.common_steps import * from ui.helpers import utils as utils from lib import parsers from steps.ui.common_steps import * from steps.ui.lsh.locators.lsh_locator import LSHLocators ############### # STEPS # ############### @given(parsers.parse('I navigate from top menu "{top_menu}" to "{sub_menu}" module')) def navigate_to_module(driver, top_menu, sub_menu): selector_top_menu = LSHLocators.LOC_SELECTOR_TOP_MENU_XPATH_FORMAT.format(top_menu) selector_sub_menu = LSHLocators.LOC_SELECTOR_SUB_MENU_XPATH_FORMAT.format(sub_menu) elem_top_menu = utils.find_element(driver, By.XPATH, selector_top_menu) elem_sub_menu = utils.find_element(driver, By.XPATH, selector_sub_menu) actions = ActionChains(driver) actions.move_to_element(elem_top_menu).perform() # utils.wait_for_window(1) elem_sub_menu.click() iframes = driver.find_elements_by_tag_name('iframe') driver.switch_to.frame(iframes[0]) utils.wait_for_window() @then(parsers.parse('I verify the Module is opened with header "{header}"')) def verify_header(driver, header): # selector_header = LSHLocators.LOC_SELECTOR_HEADER_XPATH_FORMAT.format(header) assr.assert_text_present(driver, header, By.CSS_SELECTOR, LSHLocators.LOC_SELECTOR_HEADER_CLASS_CSS) @then(parsers.parse('I verify My Audiences Module is opened with header "{header}"')) def verify_module_open_with_header(driver, header): selector_header = LSHLocators.LOC_SELECTOR_HEADER_XPATH_FORMAT.format(header) assr.assert_text_present(driver, header, By.XPATH, selector_header) @given(parsers.parse('A fixture test step "{account_name}" "{account_name_sub01}"')) def fixture_test(driver, get_lsh_target_env_config, account_name, account_name_sub01): """A fixture test method""" print("------------------------") print(os.environ.get("PYTHON_ENV")) print(get_lsh_target_env_config.get('Mutual', account_name)) print(get_lsh_target_env_config.get('Mutual', account_name_sub01, raw=0)) print(get_lsh_target_env_config.get('Distribution', '1st.party.dataset.name', raw=0)) print(get_lsh_target_env_config.get('Distribution', '1st.party.taxonomy.name', raw=0)) print(get_lsh_target_env_config.get('Distribution', 'destination.name.default', raw=0)) print("------------------------") assert False