def test_no_template_power_control(provider, setup_provider_funcscope): """ Ensures that no power button is displayed for templates.""" provider.load_all_provider_templates() toolbar.set_vms_grid_view() try: with error.expected(NoSuchElementException): toolbar.select("Power") except Exception: # try again with error.expected(NoSuchElementException): toolbar.select("Power") # Ensure selecting a template doesn't cause power menu to appear templates = list(get_all_vms(True)) template_name = random.choice(templates) selected_template = Vm(template_name, provider) quadicon = selected_template.find_quadicon(do_not_navigate=True, mark=False, refresh=False) with error.expected(NoSuchElementException): toolbar.select("Power") # Ensure there isn't a power button on the details page pytest.sel.click(quadicon) with error.expected(NoSuchElementException): toolbar.select("Power")
def test_no_template_power_control(provider, soft_assert): """ Ensures that no power button is displayed for templates. Prerequisities: * An infra provider that has some templates. Steps: * Open the view of all templates of the provider * Verify the Power toolbar button is not visible * Select some template using the checkbox * Verify the Power toolbar button is not visible * Click on some template to get into the details page * Verify the Power toolbar button is not visible """ provider.load_all_provider_templates() toolbar.select('Grid View') soft_assert(not toolbar.exists("Power"), "Power displayed in template grid view!") # Ensure selecting a template doesn't cause power menu to appear templates = list(get_all_vms(True)) template_name = random.choice(templates) selected_template = VM.factory(template_name, provider, template=True) # Check the power button with checking the quadicon entity = selected_template.find_quadicon() entity.check() soft_assert(not toolbar.exists("Power"), "Power displayed when template quadicon checked!") # Ensure there isn't a power button on the details page entity.click() soft_assert(not toolbar.exists("Power"), "Power displayed in template details!")
def test_no_template_power_control(provider, setup_provider_funcscope, soft_assert): """ Ensures that no power button is displayed for templates. Prerequisities: * An infra provider that has some templates. Steps: * Open the view of all templates of the provider * Verify the Power toolbar button is not visible * Select some template using the checkbox * Verify the Power toolbar button is not visible * Click on some template to get into the details page * Verify the Power toolbar button is not visible """ provider.load_all_provider_templates() toolbar.select('Grid View') soft_assert(not toolbar.exists("Power"), "Power displayed in template grid view!") # Ensure selecting a template doesn't cause power menu to appear templates = list(get_all_vms(True)) template_name = random.choice(templates) selected_template = VM.factory(template_name, provider, template=True) # Check the power button with checking the quadicon quadicon = selected_template.find_quadicon(do_not_navigate=True, mark=True, refresh=False) soft_assert(not toolbar.exists("Power"), "Power displayed when template quadicon checked!") # Ensure there isn't a power button on the details page pytest.sel.click(quadicon) soft_assert(not toolbar.exists("Power"), "Power displayed in template details!")
def test_no_template_power_control(provider, soft_assert): """ Ensures that no power button is displayed for templates. Prerequisities: * An infra provider that has some templates. Steps: * Open the view of all templates of the provider * Verify the Power toolbar button is not visible * Select some template using the checkbox * Verify the Power toolbar button is not visible * Click on some template to get into the details page * Verify the Power toolbar button is not visible """ view = navigate_to(provider, 'ProviderTemplates') view.toolbar.view_selector.select('Grid View') soft_assert(not view.toolbar.power.is_enabled, "Power displayed in template grid view!") # Ensure selecting a template doesn't cause power menu to appear templates = list(get_all_vms(True)) template_name = random.choice(templates) selected_template = VM.factory(template_name, provider, template=True) # Check the power button with checking the quadicon view = navigate_to(selected_template, 'AllForProvider', use_resetter=False) entity = view.entities.get_entity(name=selected_template.name, surf_pages=True) entity.check() soft_assert(not view.toolbar.power.is_enabled, "Power displayed when template quadicon checked!") # Ensure there isn't a power button on the details page entity.click() soft_assert(not view.toolbar.power.is_enabled, "Power displayed in template details!")
def vms(): """Ensure the infra providers are set up and get list of vms""" sel.force_navigate("infrastructure_providers") for provider in providers.setup_infrastructure_providers(): provider.validate() sel.force_navigate("infra_vms") search.ensure_no_filter_applied() return virtual_machines.get_all_vms()
def test_filter_with_user_input(vms, subset_of_vms, expression_for_vms_subset): pytest.sel.force_navigate("infra_vms") vm = sample(subset_of_vms, 1)[0] # Set up the filter search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm}) assert_no_cfme_exception() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def vms(): """Ensure the infra providers are set up and get list of vms""" try: setup_a_provider(prov_type="infra", required_keys="large") except Exception: pytest.skip("It's not possible to set up any providers, therefore skipping") sel.force_navigate("infra_vms") search.ensure_no_filter_applied() return virtual_machines.get_all_vms()
def test_vm_filter_without_user_input(vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): # Set up the filter vm_advanced_search.entities.search.advanced_search(expression_for_vms_subset) vm_advanced_search.flash.assert_no_error() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) for vm in subset_of_vms: if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_without_user_input(vms, subset_of_vms, expression_for_vms_subset): sel.force_navigate("infra_vms") # Set up the filter search.fill_and_apply_filter(expression_for_vms_subset) assert_no_cfme_exception() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) for vm in subset_of_vms: if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def vms(): """Ensure the infra providers are set up and get list of vms""" try: setup_a_provider(prov_class="infra", required_keys=["large"]) except Exception: pytest.skip("It's not possible to set up any providers, therefore skipping") navigate_to(Vm, 'VMsOnly') search.ensure_no_filter_applied() return virtual_machines.get_all_vms()
def test_vm_filter_with_user_input(appliance, vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): vm = sample(subset_of_vms, 1)[0] # Set up the filter vm_advanced_search.entities.search.advanced_search( "fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm}) vm_advanced_search.flash.assert_no_error() vms_present = virtual_machines.get_all_vms(appliance, do_not_navigate=True) if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_with_user_input(vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): vm = sample(subset_of_vms, 1)[0] # Set up the filter vm_advanced_search.entities.search.advanced_search( "fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm} ) vm_advanced_search.flash.assert_no_error() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_without_user_input(vms, subset_of_vms, expression_for_vms_subset): navigate_to(Vm, 'VMsOnly') # Set up the filter search.fill_and_apply_filter(expression_for_vms_subset) assert_no_cfme_exception() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) for vm in subset_of_vms: if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_filter_with_user_input(vms, subset_of_vms, expression_for_vms_subset): navigate_to(Vm, 'VMsOnly') vm = sample(subset_of_vms, 1)[0] # Set up the filter search.fill_and_apply_filter("fill_field(Virtual Machine : Name, =)", {"Virtual Machine": vm}) assert_no_cfme_exception() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def test_vm_filter_without_user_input(vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): # Set up the filter vm_advanced_search.entities.search.advanced_search( expression_for_vms_subset) vm_advanced_search.flash.assert_no_error() vms_present = virtual_machines.get_all_vms(do_not_navigate=True) for vm in subset_of_vms: if vm not in vms_present: pytest.fail("Could not find VM {} after filtering!".format(vm))
def vms(): """Ensure the infra providers are set up and get list of vms""" try: setup_a_provider(prov_type="infra", required_keys="large") except Exception: pytest.skip( "It's not possible to set up any providers, therefore skipping") pytest.sel.force_navigate("infra_vms") search.ensure_no_filter_applied() return virtual_machines.get_all_vms()
def test_quick_search_without_filter(vms, subset_of_vms): sel.force_navigate("infra_vms") search.ensure_no_filter_applied() assert_no_cfme_exception() vm = pick(subset_of_vms, 1)[0] # Filter this host only search.normal_search(vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_with_filter(vms, subset_of_vms, expression_for_vms_subset): sel.force_navigate("infra_vms") search.fill_and_apply_filter(expression_for_vms_subset) assert_no_cfme_exception() # Filter this host only chosen_vm = pick(subset_of_vms, 1)[0] search.normal_search(chosen_vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_with_vm_filter(vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): vm_advanced_search.entities.search.advanced_search(expression_for_vms_subset) vm_advanced_search.flash.assert_no_error() # Filter this host only chosen_vm = sample(subset_of_vms, 1)[0] vm_advanced_search.entities.search.simple_search(chosen_vm) vm_advanced_search.flash.assert_no_error() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_without_vm_filter(request, vms, subset_of_vms): view = navigate_to(InfraVm, 'VMsOnly') view.flash.assert_no_error() vm = sample(subset_of_vms, 1)[0] # Make sure that we empty the regular view.entities.search field after the test request.addfinalizer(view.entities.search.clear_simple_search()) # Filter this host only view.entities.search.simple_search(vm) view.flash.assert_no_error() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_with_vm_filter(vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): vm_advanced_search.entities.search.advanced_search( expression_for_vms_subset) vm_advanced_search.flash.assert_no_error() # Filter this host only chosen_vm = sample(subset_of_vms, 1)[0] vm_advanced_search.entities.search.simple_search(chosen_vm) vm_advanced_search.flash.assert_no_error() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_quick_search_with_filter(request, vms, subset_of_vms, expression_for_vms_subset): sel.force_navigate("infra_vms") search.fill_and_apply_filter(expression_for_vms_subset) assert_no_cfme_exception() # Make sure that we empty the regular search field after the test request.addfinalizer(search.ensure_normal_search_empty) # Filter this host only chosen_vm = sample(subset_of_vms, 1)[0] search.normal_search(chosen_vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_filter_save_and_load(request, vms, subset_of_vms, expression_for_vms_subset): sel.force_navigate("infra_vms") filter_name = fauxfactory.gen_alphanumeric() vm = sample(subset_of_vms, 1)[0] # Set up the filter search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name) assert_no_cfme_exception() search.reset_filter() search.load_and_apply_filter(filter_name, fill_callback={"Virtual Machine": vm}) assert_no_cfme_exception() request.addfinalizer(search.delete_filter) assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
def test_quick_search_without_filter(request, vms, subset_of_vms): pytest.sel.force_navigate("infra_vms") search.ensure_no_filter_applied() assert_no_cfme_exception() vm = sample(subset_of_vms, 1)[0] # Make sure that we empty the regular search field after the test request.addfinalizer(search.ensure_normal_search_empty) # Filter this host only search.normal_search(vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_without_filter(request, vms, subset_of_vms): navigate_to(Vm, 'VMsOnly') search.ensure_no_filter_applied() assert_no_cfme_exception() vm = sample(subset_of_vms, 1)[0] # Make sure that we empty the regular search field after the test request.addfinalizer(search.ensure_normal_search_empty) # Filter this host only search.normal_search(vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and vm in all_vms_visible
def test_quick_search_with_filter(request, vms, subset_of_vms, expression_for_vms_subset): navigate_to(Vm, 'VMsOnly') search.fill_and_apply_filter(expression_for_vms_subset) assert_no_cfme_exception() # Make sure that we empty the regular search field after the test request.addfinalizer(search.ensure_normal_search_empty) # Filter this host only chosen_vm = sample(subset_of_vms, 1)[0] search.normal_search(chosen_vm) assert_no_cfme_exception() # Check it is there all_vms_visible = virtual_machines.get_all_vms(do_not_navigate=True) assert len(all_vms_visible) == 1 and chosen_vm in all_vms_visible
def test_filter_save_and_load(request, vms, subset_of_vms, expression_for_vms_subset): navigate_to(Vm, 'VMsOnly') filter_name = fauxfactory.gen_alphanumeric() vm = sample(subset_of_vms, 1)[0] # Set up the filter search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name) assert_no_cfme_exception() search.reset_filter() search.load_and_apply_filter(filter_name, fill_callback={"Virtual Machine": vm}) assert_no_cfme_exception() request.addfinalizer(search.delete_filter) assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
def test_filter_save_and_load(request, vms, subset_of_vms, expression_for_vms_subset): sel.force_navigate("infra_vms") filter_name = generate_random_string() vm = pick(subset_of_vms, 1)[0] # Set up the filter search.save_filter("fill_field(Virtual Machine : Name, =)", filter_name) assert_no_cfme_exception() search.reset_filter() search.load_and_apply_filter(filter_name, fill_callback={"Virtual Machine": vm}) assert_no_cfme_exception() request.addfinalizer(search.delete_filter) assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
def test_no_template_power_control(provider_crud, provider_init): """ Ensures that no power button is displayed for templates. """ provider_crud.load_all_provider_templates() with error.expected(NoSuchElementException): toolbar.select("Power") # Ensure selecting a template doesn't cause power menu to appear toolbar.set_vms_grid_view() templates = list(get_all_vms(True)) template_name = random.choice(templates) selected_template = Vm(template_name, provider_crud) quadicon = selected_template.find_quadicon(do_not_navigate=True, mark=False, refresh=False) with error.expected(NoSuchElementException): toolbar.select("Power") # Ensure there isn't a power button on the details page pytest.sel.click(quadicon) with error.expected(NoSuchElementException): toolbar.select("Power")
def test_vm_filter_save_and_load(appliance, request, vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): filter_name = fauxfactory.gen_alphanumeric() vm = sample(subset_of_vms, 1)[0] # Set up the filter vm_advanced_search.entities.search.save_filter( "fill_field(Virtual Machine : Name, =)", filter_name) vm_advanced_search.flash.assert_no_error() vm_advanced_search.entities.search.reset_filter() vm_advanced_search.entities.search.load_filter( filter_name, fill_callback={"Virtual Machine": vm}, apply_filter=True) @request.addfinalizer def cleanup(): vm_advanced_search.entities.search.load_filter(filter_name) vm_advanced_search.entities.search.delete_filter() vm_advanced_search.flash.assert_no_error() assert vm in virtual_machines.get_all_vms(appliance, do_not_navigate=True)
def test_vm_filter_save_and_load(request, vm_advanced_search, vms, subset_of_vms, expression_for_vms_subset): filter_name = fauxfactory.gen_alphanumeric() vm = sample(subset_of_vms, 1)[0] # Set up the filter vm_advanced_search.entities.search.save_filter( "fill_field(Virtual Machine : Name, =)", filter_name) vm_advanced_search.flash.assert_no_error() vm_advanced_search.entities.search.reset_filter() vm_advanced_search.entities.search.load_filter( filter_name, fill_callback={"Virtual Machine": vm}, apply_filter=True) @request.addfinalizer def cleanup(): vm_advanced_search.entities.search.load_filter(filter_name) vm_advanced_search.entities.search.delete_filter() vm_advanced_search.flash.assert_no_error() assert vm in virtual_machines.get_all_vms(do_not_navigate=True)
def vms(appliance, a_provider): """Ensure the infra providers are set up and get list of vms""" view = navigate_to(InfraVm, 'VMsOnly') view.entities.search.remove_search_filters() return virtual_machines.get_all_vms(appliance)
def vms(a_provider): """Ensure the infra providers are set up and get list of vms""" navigate_to(Vm, 'VMsOnly') search.ensure_no_filter_applied() return virtual_machines.get_all_vms()
def vms(a_provider): """Ensure the infra providers are set up and get list of vms""" view = navigate_to(InfraVm, 'VMsOnly') view.entities.search.remove_search_filters() return virtual_machines.get_all_vms()