def test_lhn_stays_expanded(self, selenium): """Tests if, after opening LHN, it slides out and stays expanded.""" conftest_utils.navigate_to_page_with_lhn(selenium) lhn_menu = dashboard.Header(selenium).open_lhn_menu() initial_position = lhn_menu.my_objects.element.location selenium_utils.wait_until_stops_moving(lhn_menu.my_objects.element) selenium_utils.hover_over_element( selenium, dashboard.Header(selenium).button_my_tasks.element) assert initial_position == lhn.Menu(selenium).my_objects.element.location
def test_destructive_obj_count(self, selenium): """Checks if count updates in LHN after creating new program.""" selenium_utils.open_url(url.Urls().dashboard) count_before = dashboard.Header(selenium).open_lhn_menu( ).select_my_objects().toggle_programs.members_count rest_facade.create_program() selenium.refresh() count_after = dashboard.Header(selenium).open_lhn_menu( ).select_my_objects().toggle_programs.members_count assert count_after == count_before + 1
def test_object_count_updates(self, selenium, new_program_ui): """Checks if count updates in LHN after creating new program object.""" _, program_info_page = new_program_ui lhn_menu = dashboard.Header(selenium).open_lhn_menu().select_my_objects() assert (lhn_menu.toggle_programs.members_count >= int(program_info_page.source_obj_id_from_url))
def get_lhn_accordion(driver, object_name): """Select relevant section in LHN and return relevant section accordion.""" selenium_utils.open_url(driver, dashboard.Dashboard.URL) lhn_menu = dashboard.Header(driver).open_lhn_menu() # if object button not visible, open this section first if object_name in cache.LHN_SECTION_MEMBERS: method_name = factory.get_method_lhn_select(object_name) lhn_menu = getattr(lhn_menu, method_name)() return getattr(lhn_menu, constants.method.SELECT_PREFIX + object_name)()
def test_lhn_stays_expanded(self, header_dashboard, selenium): """Tests if, after opening LHN, it slides out and stays expanded.""" lhn_menu = header_dashboard.open_lhn_menu() initial_position = lhn_menu.my_objects.element.location selenium_utils.wait_until_stops_moving(lhn_menu.my_objects.element) selenium_utils.hover_over_element( selenium, dashboard.Header(selenium).button_my_tasks.element) expected_el_position = initial_position actual_el_position = lhn.Menu(selenium).my_objects.element.location assert expected_el_position == actual_el_position
def test_object_count_updates(self, selenium, new_program): """Checks if the count updates in LHN after creating a new program object.""" _, program_info_page = new_program lhn_menu = dashboard.Header(selenium) \ .open_lhn_menu() \ .select_my_objects() assert lhn_menu.toggle_programs.members_count \ >= int(program_info_page.object_id)
def test_user_menu_checkbox(self, selenium): """Tests the user menu checkbox. With that also the user menu itself is tested since the model initializes all elements (and throws and exception if they're not present.""" conftest_utils.navigate_to_page_with_lhn(selenium) user_list = dashboard.Header(selenium).open_user_list() user_list.checkbox_daily_digest.click() user_list.checkbox_daily_digest.element.get_attribute("disabled") # restore previous state user_list.checkbox_daily_digest.click()
def test_redirect(self, selenium): """Tests if the user is redirected to the My Work page after clicking on the my work button in user dropdown""" conftest_utils.navigate_to_page_with_lhn(selenium) dashboard.Header(selenium)\ .open_user_list()\ .select_my_work() assert selenium.current_url == dashboard.Dashboard.URL
def get_lhn_accordion(driver, object_name): """Select relevant section in LHN and return relevant section accordion. """ navigate_to_page_with_lhn(driver) lhn_contents = dashboard.Header(driver).open_lhn_menu() # if object button not visible, open this section first if object_name in cache.LHN_SECTION_MEMBERS: method_name = factory.get_method_lhn_select(object_name) lhn_contents = getattr(lhn_contents, method_name)() return getattr(lhn_contents, constants.method.SELECT_PREFIX + object_name)()
def test_mapping_via_lhn(self, selenium, new_product, new_project, new_system, new_data_asset, new_process): """LHN mapping tests from smoke tests, section 6""" objects = [ new_product, new_project, new_system, new_data_asset, new_process ] for object_ in objects: selenium.get(object_.url) header = dashboard.Header(selenium) # map objects for mapped_object in objects: # don't map an object to itself if mapped_object != object_: extended_info = conftest_utils\ .get_lhn_accordion(selenium, mapped_object.object_name)\ .hover_over_visible_member(mapped_object.title_entered.text) if not extended_info.is_mapped: extended_info.map_to_object() # workaround for CORE-3324 selenium_utils.hover_over_element( selenium, header.toggle_user_dropdown.element) # close LHN so that the contents are seen header.close_lhn_menu() widget = factory.get_cls_widget( mapped_object.object_name)(selenium) # check that the focus is on relevant widget assert widget.name_from_url in mapped_object.object_name # check items count assert widget.member_count == 1 # check that all mapped widgets are shown widget_bar = dashboard.Dashboard(selenium) for mapped_object in objects: if mapped_object != object_: # select a widget getattr( widget_bar, factory.get_method_select(mapped_object.object_name))() # verify widget widget = factory.get_cls_widget( mapped_object.object_name)(selenium) assert widget.name_from_url in mapped_object.object_name
def test_mapping_controls_via_lhn(self, selenium, new_control_ui, new_program_ui): """Tests if widget number increases when mapping via LHN.""" # check that the widget isn't opened yet since it doesn't have any members assert selenium.find_element( *locator.WidgetBar.CONTROLS).is_displayed() is False # map to obj (dashboard.Header(selenium).open_lhn_menu( ).select_my_objects().select_controls_or_objectives().select_controls( ).hover_over_visible_member( new_control_ui.title_entered.text).map_to_object()) control_widget_count = ( widget_bar.Programs(selenium).select_controls().member_count) assert control_widget_count == 1
def test_lhn_remembers_tab_state(self, header_dashboard, selenium): """Tests if LHN remembers which tab is selected (my or all objects) after closing it.""" lhn_menu = header_dashboard.open_lhn_menu() # check if all objects tab is selected by default assert selenium_utils.is_value_in_attr( lhn_menu.all_objects.element) is True for tab in ['my_objects', 'all_objects']: getattr(header_dashboard.open_lhn_menu(), 'select_{0}'.format(tab))() header_dashboard.close_lhn_menu() selenium.refresh() new_lhn_menu = dashboard.Header(selenium).open_lhn_menu() # check if selected tab saves state assert selenium_utils.is_value_in_attr( getattr(new_lhn_menu, tab).element) is True
def test_lhn_remembers_tab_state(self, header_dashboard, selenium): """Tests if LHN remembers which tab is selected (my or all objects) after closing it.""" lhn_menu = header_dashboard.open_lhn_menu() # check if my objects tab saves state lhn_menu.select_my_objects() header_dashboard.close_lhn_menu() header_dashboard.open_user_list() selenium.get(dashboard.Dashboard.URL) new_lhn_menu = dashboard.Header(selenium).open_lhn_menu() assert selenium_utils.is_value_in_attr( new_lhn_menu.my_objects.element) is True # check if all objects tab saves state lhn_menu = header_dashboard.open_lhn_menu() lhn_menu.select_all_objects() header_dashboard.close_lhn_menu() header_dashboard.open_user_list() assert selenium_utils.is_value_in_attr( new_lhn_menu.all_objects.element) is True
def test_lhn_remembers_tab_state(self, selenium): """Tests if LHN remembers which tab is selected (my or all objects) after closing it.""" conftest_utils.navigate_to_page_with_lhn(selenium) header = dashboard.Header(selenium) # check if my objects tab saves state lhn_menu = header.open_lhn_menu() lhn_menu.select_my_objects() header.close_lhn_menu() header.open_user_list() new_lhn = header.open_lhn_menu() assert selenium_utils.is_value_in_attr(new_lhn.my_objects.element) is True # check if all objects tab saves state lhn_menu = header.open_lhn_menu() lhn_menu.select_all_objects() header.close_lhn_menu() header.open_user_list() new_lhn = header.open_lhn_menu() assert selenium_utils.is_value_in_attr(new_lhn.all_objects.element) is True
def header_dashboard(selenium): """Open My Work Dashboard URL and return Header Dashboard page objects model.""" selenium_utils.open_url(url.Urls().dashboard) return dashboard.Header(selenium)
def test_lhn_pin(self, selenium): """Tests if the pin is present and if it's default state is off.""" conftest_utils.navigate_to_page_with_lhn(selenium) lhn_menu = dashboard.Header(selenium).open_lhn_menu() assert lhn_menu.pin.is_activated is False