Example #1
0
 def wait(self, element_index, checked, timeout = None):
     """Waits until the specified element is in the specified state.
        If the element is not in the specified state after the timeout,
        raises Exception.
        If no timeout is specified, uses the default timeout of this list.
     """
     if timeout is None:
         timeout = self.timeout
     if checked:
         oldstate = 'unchecked'
         newstate = 'checked'
     else:
         oldstate = 'checked'
         newstate = 'unchecked'
     if timeout is None:
         _LOGGER.info('waiting for %s %d to become %s',
                 self.element_type, element_index, newstate)
     else:
         _LOGGER.info('waiting for %s %d to become %s, timeout set to %f seconds',
                 self.element_type, element_index, newstate, timeout)
     self.update_element(element_index)
     message = '%s %d still %s after %f seconds' % (
             self.element_type, element_index, oldstate, timeout)
     waiting = Wait(timeout, exception_message = message)
     while bool(self.is_checked(element_index)) != bool(checked):
         waiting.wait()
         self.update_element(element_index)
Example #2
0
 def wait(self, element_index, checked, timeout=None):
     """Waits until the specified element is in the specified state.
        If the element is not in the specified state after the timeout,
        raises Exception.
        If no timeout is specified, uses the default timeout of this list.
     """
     if timeout is None:
         timeout = self.timeout
     if checked:
         oldstate = 'unchecked'
         newstate = 'checked'
     else:
         oldstate = 'checked'
         newstate = 'unchecked'
     if timeout is None:
         _LOGGER.info('waiting for %s %d to become %s', self.element_type,
                      element_index, newstate)
     else:
         _LOGGER.info(
             'waiting for %s %d to become %s, timeout set to %f seconds',
             self.element_type, element_index, newstate, timeout)
     self.update_element(element_index)
     message = '%s %d still %s after %f seconds' % (
         self.element_type, element_index, oldstate, timeout)
     waiting = Wait(timeout, exception_message=message)
     while bool(self.is_checked(element_index)) != bool(checked):
         waiting.wait()
         self.update_element(element_index)
Example #3
0
 def wait_until_finished(self, timeout = INSTALL_TIME_MAX_SECONDS):
     """Waits until the installer finishes installing.
        Checks every 3 seconds if the Finish button exists.
        Raises Exception if the installer is not finished after the
        specified timeout.
     """
     self._ensure(running = True, installing = True)
     waiting = Wait(timeout, interval = 3,
             exception_message = 'installer not finished after %f seconds' %
             timeout)
     while not self.is_finished():
         waiting.wait()
     _LOGGER.info('finished')
Example #4
0
 def wait_until_finished(self, timeout=INSTALL_TIME_MAX_SECONDS):
     """Waits until the installer finishes installing.
        Checks every 3 seconds if the Finish button exists.
        Raises Exception if the installer is not finished after the
        specified timeout.
     """
     self._ensure(running=True, installing=True)
     waiting = Wait(
         timeout,
         interval=3,
         exception_message='installer not finished after %f seconds' %
         timeout)
     while not self.is_finished():
         waiting.wait()
     _LOGGER.info('finished')
Example #5
0
 def waitUntilAllButtonsEnabled(self, timeout):
     """Waits until none of the buttons is disabled.
        Raises Exception if some button is still disabled after the
        specified timeout.
     """
     if timeout is None:
         _LOGGER.info('%swaiting until all buttons are enabled',
                 self._debugprefix)
     else:
         _LOGGER.info('%swaiting until all buttons are enabled, timeout set to %f seconds',
                 self._debugprefix, timeout)
     waiting = Wait(timeout,
             exception_message =
             'some button still disabled after %f seconds' % timeout)
     while not self.all_buttons_enabled():
         waiting.wait()
         self.update_buttons()
Example #6
0
 def waitUntilButtonIsEnabled(self, name, timeout):
     """Waits until the specified button is no longer disabled.
        Raises Exception if the button is still disabled after the specified
        timeout.
     """
     if timeout is None:
         _LOGGER.info("%swaiting for '%s' button to be enabled",
                 self._debugprefix, name)
     else:
         _LOGGER.info("%swaiting for '%s' button to be enabled, timeout set to %f seconds",
                 self._debugprefix, name, timeout)
     waiting = Wait(timeout,
             exception_message =
             "'%s' button still disabled after %f seconds" %
             (name, timeout))
     while not self.is_button_enabled(name):
         waiting.wait()
         self.update_button(name)
Example #7
0
 def waitUntilAllButtonsEnabled(self, timeout):
     """Waits until none of the buttons is disabled.
        Raises Exception if some button is still disabled after the
        specified timeout.
     """
     if timeout is None:
         _LOGGER.info('%swaiting until all buttons are enabled',
                      self._debugprefix)
     else:
         _LOGGER.info(
             '%swaiting until all buttons are enabled, timeout set to %f seconds',
             self._debugprefix, timeout)
     waiting = Wait(
         timeout,
         exception_message='some button still disabled after %f seconds' %
         timeout)
     while not self.all_buttons_enabled():
         waiting.wait()
         self.update_buttons()
Example #8
0
 def waitUntilButtonIsEnabled(self, name, timeout):
     """Waits until the specified button is no longer disabled.
        Raises Exception if the button is still disabled after the specified
        timeout.
     """
     if timeout is None:
         _LOGGER.info("%swaiting for '%s' button to be enabled",
                      self._debugprefix, name)
     else:
         _LOGGER.info(
             "%swaiting for '%s' button to be enabled, timeout set to %f seconds",
             self._debugprefix, name, timeout)
     waiting = Wait(
         timeout,
         exception_message="'%s' button still disabled after %f seconds" %
         (name, timeout))
     while not self.is_button_enabled(name):
         waiting.wait()
         self.update_button(name)