def test_systems_page(self, mozwebqa): """ Randomly select a system from the systems page and verify that key elements are present. """ home_page = Home(mozwebqa) home_page.login() home_page.click(*login_org_dropdown) home_page.click_by_text(login_org_name_selector_css, home_page.org) api = ApiTasks(mozwebqa) current_org = home_page.header.get_text_from_switcher api.create_envs(current_org) new_system_name = "system%s" % home_page.random_string() api.create_new_system(new_system_name, current_org) home_page.click_tab("systems_tab") systems = SystemsTab(mozwebqa) system_object = systems.select_random systems.system(system_object).click() Assert.true(systems.is_system_details_tab_present) Assert.true(systems.is_system_facts_tab_present) Assert.true(systems.is_system_subscriptions_tab_present)
def test_NumberFormatException_forInputString(self, mozwebqa): """ Regression Test for bz786963 """ home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) new_org_name = "manifest-%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(new_org_name) home_page.header.click_filtered_result(new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(os.path.realpath(self._bz786963_manifest)) Assert.true(home_page.is_successful) Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
def test_load_same_manifest_to_same_org_w_force(self, mozwebqa): ''' Scenario 2: Re-import same manifest into same org. Result: Pass ''' home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) new_org_name = "manifest-%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(new_org_name) home_page.header.click_filtered_result(new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") ''' Need to clean this up a bit ''' if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(os.path.realpath(self._org4_m1_manifest)) cm.click_force() cm.enter_manifest(os.path.realpath(self._org4_m1_manifest)) Assert.true(home_page.is_successful)
def test_load_new_manifest_into_same_org_wo_force(self, mozwebqa): ''' Scenario 5: Load updated (new) manifest into org where a manifest already exists. Result: Pass ''' sysapi = ApiTasks(mozwebqa) home_page = Home(mozwebqa) new_org_name = "manifest-%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(new_org_name) home_page.header.click_filtered_result(new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(os.path.realpath(self._scenario5_o1_m1_manifest)) cm.enter_manifest(os.path.realpath(self._scenario5_o1_m2_manifest)) Assert.true(home_page.is_successful) Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
def test_hello_link_works(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() hello = Hello(mozwebqa) hello.click_hello_link() Assert.true(hello.is_username_present)
def test_load_manifest(self, mozwebqa): ''' Scenario 1: Import Manifest (M1) from Distributor (D1) input Org1 Result: Pass ''' sysapi = ApiTasks(mozwebqa) home_page = Home(mozwebqa) new_org_name = "manifest%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(new_org_name) home_page.header.click_filtered_result(new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(os.path.realpath(self._org1_m1_manifest)) Assert.true(home_page.is_successful) Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
def test_load_same_manifest_to_same_org_wo_force(self, mozwebqa): ''' Scenario 2 with a twist. Import Manifest (M1) from Distributor (D1) into Org1 w/o useing force. Result: Expect Fail ''' sysapi = ApiTasks(mozwebqa) home_page = Home(mozwebqa) new_org_name = "manifest%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(new_org_name) home_page.header.click_filtered_result(new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(os.path.realpath(self._scenario2_m1_d1_manifest)) cm.enter_manifest(os.path.realpath(self._scenario2_m1_d1_manifest)) Assert.true(home_page.is_failed)
def test_create_new_org_w_env(self, mozwebqa): ''' Test to create a new org, with environment. ''' home_page = Home(mozwebqa) home_page.login() Assert.true(home_page.is_successful) Assert.true(home_page.header.is_user_logged_in) home_page.tabs.click_tab("organizations_tab") Assert.true(home_page.is_the_current_page) ENVIRONMENTS = ["DEV", "TEST", "STAGE", "PROD"] randenv = random.choice(ENVIRONMENTS) organizations = OrganizationsTab(mozwebqa) new_org_name = home_page.random_string() new_org_name = "Org%s" % home_page.random_string() organizations.create_new_org(new_org_name, randenv) Assert.true(home_page.is_successful) Assert.true(organizations.organization(new_org_name).is_displayed) Assert.true(organizations.is_org_details_tab_present) Assert.true(organizations.is_org_history_tab_present)
def test_helptips_enabled_default(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() hello = Hello(mozwebqa) hello.click_hello_link() Assert.true(hello.is_helptips_enabled_present)
def test_admin_login_logout(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() home_page.select_org(home_page.org).click() home_page.header.click_logout() Assert.true(home_page.is_username_field_present) Assert.true(home_page.is_password_field_present)
def test_update_email_addr(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() hello = Hello(mozwebqa) hello.click_hello_link() new_user_email = "*****@*****.**" % home_page.random_string() hello.update_email_addr(new_user_email) Assert.true(home_page.is_successful)
def test_login_non_admin(self, mozwebqa): sysapi = ApiTasks(mozwebqa) home_page= Home(mozwebqa) new_user_name = "random%s" % home_page.random_string() password = "******" % home_page.random_string() email_addr = new_user_name + "@example.com" sysapi.create_user(new_user_name, password, email_addr) home_page.login(new_user_name, password) Assert.true(home_page.is_successful)
def test_duplicate_org_disallowed(self, mozwebqa): """ Returns PASS if trying to create a org that exists fails. """ home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) organizations = OrganizationsTab(mozwebqa) new_org_name = "duporg%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() home_page.tabs.click_tab("organizations_tab") organizations.create_new_org(new_org_name) Assert.true(home_page.is_failed)
def test_create_new_org(self, mozwebqa): """ Returns Pass if creating a new org is successfull """ home_page = Home(mozwebqa) home_page.login() home_page.tabs.click_tab("organizations_tab") organizations = OrganizationsTab(mozwebqa) new_org_name = "Org%s" % home_page.random_string() organizations.create_new_org(new_org_name) Assert.true(home_page.is_successful) Assert.true(organizations.organization(new_org_name).is_displayed) Assert.true(organizations.is_org_details_tab_present) Assert.true(organizations.is_org_history_tab_present)
def test_create_tdl(self, mozwebqa): ''' Create TDL name and description, then remove ''' home_page = Home(mozwebqa) home_page.login() page = SystemsTab(mozwebqa) #page.click(*login_org_selector) #page.click_by_text('a', 'redhat') page.go_to_page_view("system_templates") template_name = 'My System ' + str(time.time()) template_description = 'My template description' page.create_system_template(template_name, template_description) page.click_by_text('span', template_name) page.remove_sys_template()
def test_switch_org(self, mozwebqa): """ Return True if switching to a random org in the org switcher is successful. """ sysapi = ApiTasks(mozwebqa) home_page = Home(mozwebqa) new_org_name = "someorg%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() active_org = home_page.header.get_text_from_switcher home_page.header.click_switcher() home_page.header.select_a_random_switcher_org() Assert.true(home_page.header.is_dashboard_selected)
def test_duplicate_user_disallowed(self, mozwebqa): """ Returns Pass if creating a existing user fails. """ home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) new_user_name = "dupuser%s" % home_page.random_string() password = "******" % home_page.random_string() email_addr = new_user_name + "@example.com" sysapi.create_user(new_user_name, password, email_addr) home_page.login() home_page.tabs.click_tab("administration_tab") administration = AdministrationTab(mozwebqa) administration.create_new_user(new_user_name, password, password, email_addr) Assert.true(home_page.is_failed)
def test_create_tdl(self, mozwebqa): ''' Create TDL name and description, then remove ''' home_page = Home(mozwebqa) home_page.login() page = SystemsTab(mozwebqa) page.go_to_page_view("system_templates") template_name = 'My System ' + str(time.time()) template_description = 'My template description' page.create_system_template(template_name, template_description) time.sleep(1) page.click_by_text('span', template_name) time.sleep(1) page.remove_element() time.sleep(1)
def test_update_helptips(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() hello = Hello(mozwebqa) hello.click_hello_link() hello.click_helptips() # Need to ensure this gets pushed to the DB time.sleep(2) home_page.tabs.click_tab("dashboard_tab") hello.click_hello_link() # Reset the value for future tests. hello.click_hello_link() hello.click_helptips() # Need to ensure this gets pushed to the DB time.sleep(2) home_page.tabs.click_tab("dashboard_tab") hello.click_hello_link() Assert.true(hello.is_helptips_enabled)
def test_recreate_previously_deleted_org(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() Assert.true(home_page.is_successful) home_page.tabs.click_tab("organizations_tab") organizations = OrganizationsTab(mozwebqa) sysapi = ApiTasks(mozwebqa) _new_org_name = "recreateorg%s" % home_page.random_string() sysapi.create_org(_new_org_name) home_page.tabs.click_tab("organizations_tab") Assert.true(home_page.is_the_current_page) home_page.enter_search_criteria("recreateorg*") organizations.organization(_new_org_name).click() Assert.true(organizations.is_block_active) organizations.remove_a_org() Assert.true(home_page.is_successful) time.sleep(15) home_page.tabs.click_tab("organizations_tab") Assert.true(home_page.is_the_current_page) organizations.create_new_org(_new_org_name) Assert.true(home_page.is_successful)
def test_create_new_role(self, mozwebqa): home_page = Home(mozwebqa) rolestab = RolesTab(mozwebqa) home_page.login() home_page.select_org(home_page.org).click() home_page.tabs.click_tab("administration_tab") home_page.jquery_wait(30) home_page.tabs.click_tab("roles_administration") role_name = "newrole%s" % home_page.random_string() rolestab.create_new_role(role_name) Assert.true(home_page.is_successful)
def test_duplicate_rolename_disallowed(self, mozwebqa): home_page = Home(mozwebqa) rolestab = RolesTab(mozwebqa) home_page.login() home_page.select_org(home_page.org).click() home_page.tabs.click_tab("administration_tab") home_page.jquery_wait(30) home_page.tabs.click_tab("roles_administration") role_name = "duprole%s" % home_page.random_string() rolestab.create_new_role(role_name) time.sleep(4) rolestab.create_new_role(role_name) Assert.true(home_page.is_failed)
def test_change_user_password_does_not_match_as_admin(self, mozwebqa): home_page = Home(mozwebqa) home_page.login() administration = AdministrationTab(mozwebqa) sysapi = ApiTasks(mozwebqa) new_user_name = "chgpasswd-%s" % home_page.random_string() password = "******" % home_page.random_string() email_addr = new_user_name + "@example.com" sysapi.create_user(new_user_name, password, email_addr) home_page.tabs.click_tab("administration_tab") home_page.enter_search_criteria(new_user_name) administration.user(new_user_name).click() new_password = "******" % home_page.random_string() confirm_password = "******" % home_page.random_string() administration.change_password(new_password, confirm_password) Assert.true(administration.passwords_do_not_match_visible)
def test_add_user_to_readeverything_role(self, mozwebqa): home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) rolestab = RolesTab(mozwebqa) username = "******" % home_page.random_string() email = username + "@example.com" password = home_page.random_string() sysapi.create_user(username, password, email) home_page.login() home_page.select_org(home_page.org).click() home_page.tabs.click_tab("administration_tab") home_page.jquery_wait(30) home_page.tabs.click_tab("roles_administration") rolestab.role("Read Everything").click() rolestab.click_role_users() rolestab.role_user(username).add_user() Assert.true(rolestab.is_remove_visible)
def test_dashboard_present(self, mozwebqa): """ Verify dashboard page contains key elements. """ home_page = Home(mozwebqa) home_page.login() home_page.click(*login_org_dropdown) home_page.click_by_text(login_org_name_selector_css, home_page.org) dashboard = Dashboard(mozwebqa) Assert.true(dashboard.is_dashboard_dropbutton_present) Assert.true(dashboard.is_dashboard_subscriptions_present) Assert.true(dashboard.is_dashboard_notificaitons_present)
def test_confirm_default_roles(self, mozwebqa): roles = ["Administrator", "Read Everything"] home_page = Home(mozwebqa) home_page.login() home_page.select_org(home_page.org).click() rolestab = RolesTab(mozwebqa) # home_page.tabs.click_tab("administer_tab") print admin_drop_down home_page.mouse_to_element(*admin_drop_down) home_page.tabs.click_tab("roles_tab") for role in roles: rolestab.role(role).click() Assert.true(rolestab.is_permissions_visible) Assert.true(rolestab.is_users_visible) home_page.jquery_wait() displayed_role = rolestab.get_breadcrumb_role_name Assert.equal(displayed_role, role, "Expected role was not found")
def test_activation_key_workflow(self, mozwebqa): """ Return True of a activation key can be created and a single subscription from a multi subscription manifest can be added. """ home_page = Home(mozwebqa) api = ApiTasks(mozwebqa) _new_org_name = "activationkeyorg%s" % home_page.random_string() api.create_org(_new_org_name) api.create_envs(_new_org_name) home_page.login() home_page.header.click_switcher() home_page.header.filter_org_in_switcher(_new_org_name) home_page.header.click_filtered_result(_new_org_name) cm = ContentManagementTab(mozwebqa) home_page.tabs.click_tab("content_management_tab") if home_page.project == "katello" or home_page.project == "cfse": cm.click_content_providers() cm.select_redhat_content_provider() cm.enter_manifest(self._activationkey_manifest) home_page.is_dialog_cleared activationkeys = ActivationKeysTab(mozwebqa) home_page.tabs.click_tab("systems_tab") home_page.jquery_wait(30) home_page.tabs.click_tab("activation_keys") _new_activationkey_name = "%s" % home_page.random_string() activationkeys.click_new() activationkeys.enter_activation_key_name(_new_activationkey_name) activationkeys.enter_activation_key_description(_new_activationkey_name) activationkeys.click_save() activationkeys.click_available_subscriptions() rand_sub_id = activationkeys.select_a_random_sub() activationkeys.click_add_sub() activationkeys.click_applied_subscriptions() Assert.true(activationkeys.find_sub_by_id(rand_sub_id))
def test_search_systems(self, mozwebqa): home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) home_page.login() current_org = home_page.header.get_text_from_switcher # Some bad results for i in range(1,5): new_system_name = "%s" % home_page.random_string() sysapi.create_new_system(new_system_name, current_org) # The actual systems to search for for i in range(1,5): new_sys_name = "SearchSys%s" % home_page.random_string() sysapi.create_new_system(new_sys_name, current_org) home_page.tabs.click_tab("systems_tab") systems = SystemsTab(mozwebqa) home_page.enter_search_criteria("SearchSys*") Assert.true(systems.is_search_correct("SearchSys"))
def test_search_orgs(self,mozwebqa): home_page = Home(mozwebqa) sysapi = ApiTasks(mozwebqa) for i in range(1,5): new_org_name = "%s" % home_page.random_string() sysapi.create_org(new_org_name) for i in range(1,5): new_org_name = "SearchOrg%s" % home_page.random_string() sysapi.create_org(new_org_name) home_page.login() Assert.true(home_page.is_successful) home_page.tabs.click_tab("organizations_tab") organizations = OrganizationsTab(mozwebqa) home_page.enter_search_criteria("SearchOrg*") Assert.true(organizations.is_search_correct("SearchOrg"))
def test_create_new_user(self, mozwebqa): ''' Test to create a new User, no org, no environment. ''' home_page = Home(mozwebqa) home_page.login() home_page.tabs.click_tab("administration_tab") administration = AdministrationTab(mozwebqa) new_user_name = home_page.random_string() new_user_name = "newuser-%s" % home_page.random_string() password = "******" % home_page.random_string() email_addr = new_user_name + "@example.com" administration.create_new_user(new_user_name, password, password, email_addr) Assert.true(home_page.is_successful) Assert.true(administration.user(new_user_name).is_displayed)