pytest.sel.force_navigate

Here are the examples of the python api pytest.sel.force_navigate taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

Example 1

Project: integration_tests Source File: test_advanced_search_vms.py
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

Example 2

Project: integration_tests Source File: test_vm_power_control.py
Function: test_power_off
    def test_power_off(self, test_vm, verify_vm_running, soft_assert, register_event):
        """Tests power off

        Metadata:
            test_flag: power_control, provision
        """
        test_vm.wait_for_vm_state_change(desired_state=test_vm.STATE_ON, timeout=720)
        register_event('VmOrTemplate', test_vm.name, ['request_vm_poweroff', 'vm_poweroff'])
        test_vm.power_control_from_cfme(option=test_vm.POWER_OFF, cancel=False)
        flash.assert_message_contain("Stop initiated")
        pytest.sel.force_navigate(
            'infrastructure_provider', context={'provider': test_vm.provider})
        if_scvmm_refresh_provider(test_vm.provider)
        test_vm.wait_for_vm_state_change(desired_state=test_vm.STATE_OFF, timeout=900)
        soft_assert('currentstate-off' in test_vm.find_quadicon().state)
        soft_assert(
            not test_vm.provider.mgmt.is_vm_running(test_vm.name), "vm running")

Example 3

Project: integration_tests Source File: test_default_views_cloud.py
Function: get_default_view
def get_default_view(name):
    bg = ButtonGroup(name)
    pytest.sel.force_navigate("my_settings_default_views")
    default_view = bg.active
    return default_view

Example 4

Project: integration_tests Source File: test_advanced_search_vms.py
def test_can_do_advanced_search():
    pytest.sel.force_navigate("infra_vms")
    assert search.is_advanced_search_possible(), "Cannot do advanced search here!"

Example 5

Project: integration_tests Source File: test_vm_power_control.py
Function: test_power_off
    def test_power_off(self, test_vm, verify_vm_running, soft_assert, register_event, bug):
        """Tests power off

        Metadata:
            test_flag: power_control, provision
        """
        test_vm.wait_for_vm_state_change(
            desired_state=test_vm.STATE_ON, timeout=720, from_details=True)
        last_boot_time = test_vm.get_detail(properties=("Power Management", "Last Boot Time"))
        register_event('VmOrTemplate', test_vm.name, ['request_vm_poweroff', 'vm_poweroff'])
        self._check_power_options_when_on(soft_assert, test_vm, bug, from_details=True)
        test_vm.power_control_from_cfme(option=test_vm.POWER_OFF, cancel=False, from_details=True)
        flash.assert_message_contain("Stop initiated")
        pytest.sel.force_navigate(
            'infrastructure_provider', context={'provider': test_vm.provider})
        if_scvmm_refresh_provider(test_vm.provider)
        test_vm.wait_for_vm_state_change(
            desired_state='off', timeout=720, from_details=True)
        soft_assert(
            not test_vm.provider.mgmt.is_vm_running(test_vm.name), "vm running")
        # BUG - https://bugzilla.redhat.com/show_bug.cgi?id=1101604
        if test_vm.provider.type != "rhevm":
            new_last_boot_time = test_vm.get_detail(
                properties=("Power Management", "Last Boot Time"))
            soft_assert(new_last_boot_time == last_boot_time,
                        "ui: {} should ==  orig: {}".format(new_last_boot_time, last_boot_time))

Example 6

Project: integration_tests Source File: test_vm_power_control.py
Function: test_power_on
    def test_power_on(self, test_vm, verify_vm_stopped, soft_assert, register_event, bug):
        """Tests power on

        Metadata:
            test_flag: power_control, provision
        """
        test_vm.wait_for_vm_state_change(
            desired_state='off', timeout=720, from_details=True)
        register_event('VmOrTemplate', test_vm.name, ['request_vm_start', 'vm_start'])
        last_boot_time = test_vm.get_detail(properties=("Power Management", "Last Boot Time"))
        state_chg_time = test_vm.get_detail(properties=("Power Management", "State Changed On"))
        self._check_power_options_when_off(soft_assert, test_vm, from_details=True)
        test_vm.power_control_from_cfme(option=test_vm.POWER_ON, cancel=False, from_details=True)
        flash.assert_message_contain("Start initiated")
        pytest.sel.force_navigate(
            'infrastructure_provider', context={'provider': test_vm.provider})
        if_scvmm_refresh_provider(test_vm.provider)
        test_vm.wait_for_vm_state_change(
            desired_state=test_vm.STATE_ON, timeout=720, from_details=True)
        self._wait_for_last_boot_timestamp_refresh(test_vm, last_boot_time, timeout=600)
        soft_assert(
            test_vm.provider.mgmt.is_vm_running(test_vm.name), "vm not running")
        new_state_chg_time = test_vm.get_detail(properties=("Power Management", "State Changed On"))
        soft_assert(new_state_chg_time != state_chg_time,
                    "ui: {} ==  orig: {}".format(new_state_chg_time, state_chg_time))
        if test_vm.provider.type != "scvmm":
            new_last_boot_time = test_vm.get_detail(
                properties=("Power Management", "Last Boot Time"))
            soft_assert(new_last_boot_time != last_boot_time,
                        "ui: {} ==  orig: {}".format(new_last_boot_time, last_boot_time))

Example 7

Project: integration_tests Source File: test_vm_power_control.py
Function: test_suspend
    def test_suspend(self, test_vm, verify_vm_running, soft_assert, register_event, bug):
        """Tests suspend

        Metadata:
            test_flag: power_control, provision
        """
        test_vm.wait_for_vm_state_change(
            desired_state=test_vm.STATE_ON, timeout=720, from_details=True)
        last_boot_time = test_vm.get_detail(properties=("Power Management", "Last Boot Time"))
        register_event('VmOrTemplate', test_vm.name, ['request_vm_suspend', 'vm_suspend'])
        test_vm.power_control_from_cfme(option=test_vm.SUSPEND, cancel=False, from_details=True)
        flash.assert_message_contain("Suspend initiated")
        pytest.sel.force_navigate(
            'infrastructure_provider', context={'provider': test_vm.provider})
        if_scvmm_refresh_provider(test_vm.provider)
        try:
            test_vm.wait_for_vm_state_change(
                desired_state=test_vm.STATE_SUSPENDED, timeout=450, from_details=True)
        except TimedOutError as e:
            if test_vm.provider.type == "rhevm":
                logger.warning('working around bz1174858, ignoring timeout')
            else:
                raise e
        soft_assert(
            test_vm.provider.mgmt.is_vm_suspended(
                test_vm.name), "vm not suspended")
        # BUG - https://bugzilla.redhat.com/show_bug.cgi?id=1101604
        if test_vm.provider.type != "rhevm":
            new_last_boot_time = test_vm.get_detail(
                properties=("Power Management", "Last Boot Time"))
            soft_assert(new_last_boot_time == last_boot_time,
                        "ui: {} should ==  orig: {}".format(new_last_boot_time, last_boot_time))

Example 8

Project: integration_tests Source File: test_vm_power_control.py
    def test_start_from_suspend(
            self, test_vm, verify_vm_suspended, soft_assert, register_event, bug):
        """Tests start from suspend

        Metadata:
            test_flag: power_control, provision
        """
        try:
            test_vm.provider.refresh_provider_relationships()
            test_vm.wait_for_vm_state_change(
                desired_state=test_vm.STATE_SUSPENDED, timeout=450, from_details=True)
        except TimedOutError:
            if test_vm.provider.type == "rhevm":
                logger.warning('working around bz1174858, ignoring timeout')
            else:
                raise
        register_event('VmOrTemplate', test_vm.name, ['request_vm_start', 'vm_start'])
        last_boot_time = test_vm.get_detail(properties=("Power Management", "Last Boot Time"))
        state_chg_time = test_vm.get_detail(properties=("Power Management", "State Changed On"))
        self._check_power_options_when_off(soft_assert, test_vm, from_details=True)
        test_vm.power_control_from_cfme(option=test_vm.POWER_ON, cancel=False, from_details=True)
        flash.assert_message_contain("Start initiated")
        pytest.sel.force_navigate(
            'infrastructure_provider', context={'provider': test_vm.provider})
        if_scvmm_refresh_provider(test_vm.provider)
        test_vm.wait_for_vm_state_change(
            desired_state=test_vm.STATE_ON, timeout=720, from_details=True)
        self._wait_for_last_boot_timestamp_refresh(test_vm, last_boot_time, timeout=600)
        soft_assert(
            test_vm.provider.mgmt.is_vm_running(test_vm.name), "vm not running")
        new_state_chg_time = test_vm.get_detail(properties=("Power Management", "State Changed On"))
        soft_assert(new_state_chg_time != state_chg_time,
                    "ui: {} should != orig: {}".format(new_state_chg_time, state_chg_time))
        if test_vm.provider.type != "scvmm":
            new_last_boot_time = test_vm.get_detail(
                properties=("Power Management", "Last Boot Time"))
            soft_assert(new_last_boot_time != last_boot_time,
                        "ui: {} should !=  orig: {}".format(new_last_boot_time, last_boot_time))