def test_positive_overview_elements(self): with Session(self.browser): Navigator(self.browser).go_to_overview() self.assertEqual('Overview', self.overview.overview_title()) LOGGER.info(self.overview.overview_latest_news()) self.assertIsNotNone(self.overview.overview_latest_news()) #Assert all elements under Actions self.assertEqual('Availability', self.overview.overview_action_availability()) self.assertIsNotNone(self.overview.overview_action_avl_count()) self.assertEqual('Stability', self.overview.overview_action_stability()) self.assertIsNotNone(self.overview.overview_action_stable_count()) self.assertEqual('Performance', self.overview.overview_action_performance()) self.assertIsNotNone(self.overview.overview_action_perf_count()) self.assertEqual('Security', self.overview.overview_action_security()) self.assertIsNotNone(self.overview.overview_action_security_count()) #Assert all elements under Newest Summary self.assertEqual("NEWEST SYSTEMS", self.overview.overview_newest_summary()) self.assertIsNotNone(self.overview.overview_newset_first_system()) #Assert all elements under Plan Summary self.assertEqual("PLAN", str(self.overview.overview_plan_summary()).rstrip(' ')) self.assertTrue(self.overview.is_create_plan_displayed())
def test_positive_configuration_elements(self): """ This test verifies all the elements available on configuration page """ with Session(self.browser): Navigator(self.browser).go_to_configuration() self.configuration.conf_click_on_configuration_tabs() # Checking Hidden rule section self.assertEqual("Hidden Rules", self.configuration.conf_hidden_rule_text()) self.assertEqual("These are account wide. You must be an Org Admin to make these changes.", self.configuration.conf_hidden_rule_info()) # Checking Groups section self.configuration.conf_group_tab() self.configuration.conf_group_search_box(search=123) self.assertEqual("Add Group", self.configuration.conf_add_group_text()) self.configuration.conf_add_group_button() self.assertEqual("Groups List", self.configuration.conf_group_list_text()) self.assertEqual("Delete Group", self.configuration.conf_delete_group_text()) self.configuration.conf_delete_group_button() self.configuration.conf_popup_yes_button() # Checking Messaging section self.assertEqual("Messaging Preferences", self.configuration.conf_messaging_title()) self.configuration.conf_messaging_checkbox() # Checking Settings section self.configuration.conf_settings_title() self.configuration.conf_settings_checkbox() # Checking Dev section self.configuration.conf_dev_title() self.assertEqual("API Prefix", self.configuration.conf_dev_api_prefix()) self.assertEqual("API Version", self.configuration.conf_dev_api_version()) self.assertEqual("Fake user info", self.configuration.conf_dev_fake_user_info()) self.assertEqual("Fake Entitlements", self.configuration.conf_dev_fake_entitlements())
def test_positive_inventory_elements(self): """ This test verifies all the elements available on Inventory page """ with Session(self.browser): Navigator(self.browser).go_to_inventory() # Checking systems filter self.inventory.search_inventory('test-k.novalocal') self.inventory.wait_for_inventory_hostname('test-k.novalocal') host, sys_type = self.inventory.get_inventory_details() self.assertEqual("test-k.novalocal", str(host).strip(' ')) self.assertEqual("RHEL Server", str(sys_type).strip(' ')) # Check all elements self.assertIsNotNone(self.inventory.inventory_search_icon()) self.assertIsNotNone(self.inventory.get_inventory_details()) # Checking single inventory self.inventory.inventory_click_system_name() system_name = self.inventory.inventory_text_system_name() system_name_on_detail = self.inventory.inventory_system_name_on_detail_page( ) self.assertEqual(system_name.lstrip(), system_name_on_detail) self.inventory.inventory_cross_button() # Checking group from inventory page Navigator(self.browser).go_to_configuration() self.configuration.conf_group_tab() self.configuration.conf_group_search_box(search=123) self.assertEqual("Add Group", self.configuration.conf_add_group_text()) self.configuration.conf_add_group_button() # Add Inventory in Group self.inventory.inventory_groups_search_box('test-k.novalocal') self.inventory.inventory_group_checkbox_click() self.inventory.inventory_group_add_systems_click() # Check on group dropdown on inventory page Navigator(self.browser).go_to_inventory() self.assertEqual('Groups', self.inventory.inventory_groups_label()) self.inventory.inventory_groups_dropdown_click() self.assertEqual('All Groups', self.inventory.inventory_groups_dropdown_text()) # Remove Group Navigator(self.browser).go_to_configuration() self.configuration.conf_group_tab() self.inventory.minimize_group_on_configuration() self.assertEqual("Delete Group", self.inventory.inventory_remove_group_text()) self.inventory.inventory_remove_group() self.assertEqual( "Yes", self.inventory.inventory_remove_group_popup_text()) self.inventory.inventory_remove_group_popup()
def test_positive_navigate_to_sections(self): """ This test navigates to all sections available on Actions page """ with Session(self.browser): Navigator(self.browser).go_to_actions() for section_name in self.actions_sections: self.actions.go_to_section(section_name) self.assertEqual(section_name, self.actions.get_section_title()) self.actions.click_on_actions()
def test_search_rule(self): """ This test verifies search text ion Rule tab. """ with Session(self.browser): Navigator(self.browser).go_to_rules() #Search rule HTTPoxy self.rules.search_rule(search_text="HTTPoxy") #Assert only 2 rules are displayed LOGGER.info("Total rules displayed after filter ") LOGGER.info(self.rules.get_rules_count()) self.assertEqual(2, self.rules.get_rules_count())
def test_positive_overview_elements(self): with Session(self.browser): Navigator(self.browser).go_to_overview() self.assertEqual('Overview', self.overview.overview_title()) self.assertEqual('LATEST', self.overview.overview_latest()) LOGGER.info(self.overview.overview_latest_news()) self.assertIsNotNone(self.overview.overview_latest_news()) self.assertEqual('NEWEST SYSTEMS', self.overview.overview_newest_summary()) # Assert all elements under Plan Summary self.assertEqual('PLAN', str(self.overview.overview_plan_summary()).rstrip(' ')) self.assertTrue(self.overview.is_create_plan_displayed())
def test_positive_inventory_elements(self): """ This test verifies all the elements available on Inventory page """ with Session(self.browser): Navigator(self.browser).go_to_inventory() # Checking systems filter self.inventory.search_inventory('test-k.novalocal') self.inventory.wait_for_inventory_hostname('test-k.novalocal') host, sys_type = self.inventory.get_inventory_details() self.assertEqual("test-k.novalocal", str(host).strip(' ')) self.assertEqual("RHEL Server", str(sys_type).strip(' ')) # Check all elements self.assertIsNotNone(self.inventory.inventory_search_icon()) self.assertIsNotNone(self.inventory.get_inventory_details()) self.assertIsNotNone(self.inventory.inventory_toggle()) self.assertEqual('Show only not checking in', self.inventory.inventory_not_checking_in_text()) self.assertEqual('EXPAND ALL', self.inventory.inventory_expand_all_text()) self.assertEqual('Hostname', self.inventory.inventory_hostname_dropdown_text()) self.assertEqual(' WITH ACTIONS', self.inventory.inventory_action_tab_text()) self.assertEqual( ' WITHOUT ACTIONS', self.inventory.inventory_without_action_tab_text()) self.assertIsNotNone(self.inventory.inventory_system_avl_count()) # Checking single inventory self.inventory.inventory_click_system_name() system_name = self.inventory.inventory_text_system_name() system_name_on_detail = self.inventory.inventory_system_name_on_detail_page( ) self.assertEqual(system_name.lstrip(), system_name_on_detail) self.inventory.inventory_cross_button() # Checking group from inventory page Navigator(self.browser).go_to_configuration() self.configuration.conf_group_tab() self.configuration.conf_group_search_box(search=123) self.assertEqual("Add Group", self.configuration.conf_add_group_text()) self.configuration.conf_add_group_button() Navigator(self.browser).go_to_inventory() self.assertEqual('Groups', self.inventory.inventory_groups_label()) self.inventory.inventory_groups_dropdown_click() self.assertEqual('123', self.inventory.inventory_groups_dropdown_text())
def test_rhi_register(self): """ Test for RHEL machine registration to Insights and verifying it on portal """ self.vm.rhsm_register(distro='rhel7') self.vm.register_to_insights() self.host_name = self.vm.hostname.rstrip('\n') with Session(self.browser): Navigator(self.browser).go_to_inventory() self.inventory.search_inventory(self.host_name) self.inventory.wait_for_inventory_hostname(self.host_name) host, sys_type = self.inventory.get_inventory_details() self.assertEqual(self.host_name, str(host).strip(' ')) self.assertEqual("RHEL Server", str(sys_type).strip(' '))
def test_positive_planner_elements(self): """ This test verifies all the elements available on planner page """ with Session(self.browser): Navigator(self.browser).go_to_planner() # Check all elements self.assertEqual('Planner', self.planner.planner_title()) self.assertEqual(' Create a plan', self.planner.planner_create_plan_text()) self.assertEqual('New suggested plan', self.planner.planner_new_plan_text()) self.assertIsNotNone(self.planner.planner_search_box()) self.assertIsNotNone(self.planner.planner_search_icon()) # Create new plan and delete it self.planner.planner_create_plan_button() self.planner.planner_delete_plan_button() self.planner.planner_popup_yes_button()
def test_positive_rules_filter(self): """ This test asserts all rule filters available i.e. Availability, Scalability, Performance and Security functionality. """ with Session(self.browser): Navigator(self.browser).go_to_rules() for rule_filter in self.rules_filters: self.rules.go_to_filter(rule_filter) LOGGER.info("Get %s rules card" % rule_filter) all_rules_title = self.rules.get_rule_card_title() LOGGER.info("Assering rule filter " + rule_filter) self.assertTrue(all(rule_filter + " >" in string for string in all_rules_title), msg="Filter %s is not applied correctly" % rule_filter)
def test_positive_navigation_from_overview(self): with Session(self.browser): #Check view actions Navigator(self.browser).go_to_overview() self.overview.go_to_overview_view_actions() self.assertEqual('Actions', self.actions.actions_title()) #Check view Inventory Navigator(self.browser).go_to_overview() self.assertEqual('Overview', self.overview.overview_title()) self.overview.go_to_overview_view_inventory() #Check view Planner Navigator(self.browser).go_to_overview() self.overview.go_to_overview_planner()
def test_positive_impacted_systems_info(self): """ This test verifies impacted system modal Navigates from Action page till impacted system modal """ with Session(self.browser): Navigator(self.browser).go_to_actions() for section_name in self.actions_sections: self.actions.go_to_section(section_name) self.actions.click_first_row_on_sections() system_host = self.actions.get_impacted_system_hostname() system_modal_host = self.actions.click_first_impacted_system() self.assertEqual(system_host, system_modal_host, msg="Hostname is not matching") self.actions.close_system_modal() self.actions.click_on_actions()
def test_positive_header_elements(self): """ This test verifies all the elements available on Header tab """ with Session(self.browser): Navigator(self.browser).go_to_help_tab() # # Elements present on dropdown self.assertEqual("Help", self.header.header_text()) self.assertEqual("Getting Started", self.header.header_getting_started()) self.assertEqual("More Info", self.header.header_more_info()) self.assertEqual("Security", self.header.header_security_text()) self.assertEqual("Browser Support", self.header.header_browser_support()) self.assertEqual("Insights API Documentation", self.header.header_insights_api()) # # Click on More info tab self.header.header_more_info_click() self.assertEqual("Introduction to Red Hat Insights", self.header.header_info_title()) Navigator(self.browser).go_to_insights_url() # # Click on Security tab Navigator(self.browser).go_to_help_tab() self.header.header_security_click() self.assertEqual("Security", self.header.header_security_title()) Navigator(self.browser).go_to_insights_url() # Click on browser support Navigator(self.browser).go_to_help_tab() self.header.header_browser_support_click() self.assertEqual("Browser Support Policy", self.header.header_browser_support_title()) self.header.header_switch_from_browser_tab() # Click on api documentation Navigator(self.browser).go_to_help_tab() self.header.header_insights_api_documentation_click() self.assertEqual("Red Hat Insights API Documentation", self.header.header_api_documentation_title()) self.header.header_switch_from_api_documentation() # Elements present on notification icon self.assertIsNotNone(self.header.header_notification_icon()) Navigator(self.browser).go_to_overview()
def test_positive_actions_elements(self): """ This test verifies all the elements available on Actions page """ filename = 'all_actions.csv' with Session(self.browser): Navigator(self.browser).go_to_actions() self.assertEqual('Actions', self.actions.actions_title()) self.assertEqual( "Use this chart to drill down and discover problems within your organization.", self.actions.actions_chart_description()) self.assertIsNotNone(self.actions.actions_pie_count()) self.assertIsNotNone(self.actions.actions_desc_count()) self.actions.click_on_actions_filter() #Download CSV for all Actions self.actions.download_actions_csv() time.sleep(5) #Wait for file to download #Read CSV file downloaded downloads_path = os.path.join(get_project_root(), 'downloads') filename = max([f for f in os.listdir(downloads_path)]) self.assertIsNotNone(filename) #Assert CSV file count and web chart count self.assertEqual( self.actions.actions_pie_count(), str( len( open(os.path.join(downloads_path, filename)).readlines()) - 1)) #Assert all sections self.assertEqual(4, self.actions.actions_section_size()) self.assertItemsEqual(self.actions_sections, self.actions.all_sections_name())