Beispiel #1
0
 def perform_as(self, actor):
   actor.attempts_to(WaitUntil(AppearanceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   element = driver.find_element(*self.loc())
   if self.clear:
     element.clear()
   element.send_keys(self._get_keys())
def test_waiting_failure(actor, mocker):
    mocker.patch('time.sleep')
    with pytest.raises(WaitingException):
        actor.attempts_to(
            WaitUntil(NextCount(), IsLessThan(0), timeout=0.1, interval=0.01))

    global COUNTER
    assert COUNTER > 0
def test_waiting_successfully_with_explicit_interval(actor, mocker):
    mocker.patch('time.sleep')
    answer = actor.attempts_to(
        WaitUntil(NextCount(), IsEqualTo(5), timeout=1, interval=0.01))
    time.sleep.assert_called_with(0.01)  # pylint: disable=no-member

    global COUNTER
    assert COUNTER == 5
    assert answer == 5
def test_waiting_successfully(actor, mocker):
    mocker.patch('time.sleep')
    answer = actor.attempts_to(WaitUntil(NextCount(), IsEqualTo(10),
                                         timeout=1))
    time.sleep.assert_called_with(0)  # pylint: disable=no-member

    global COUNTER
    assert COUNTER == 10
    assert answer == 10
def test_waiting_with_no_need_to_wait(actor, mocker):
    mocker.patch('time.sleep')
    answer = actor.attempts_to(
        WaitUntil(NextCount(), IsGreaterThan(0), timeout=1))
    time.sleep.assert_not_called()  # pylint: disable=no-member

    global COUNTER
    assert COUNTER == 1
    assert answer == 1
Beispiel #6
0
 def perform_as(self, actor):
   actor.attempts_to(WaitUntil(AppearanceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   driver.find_element(*self.loc()).clear()
Beispiel #7
0
 def request_as(self, actor):
   actor.attempts_to(WaitUntil(ExistenceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   return driver.find_element(*self.loc()).text
Beispiel #8
0
 def get_select(self, actor):
   actor.attempts_to(WaitUntil(ExistenceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   select = Select(driver.find_element(*self.loc()))
   return select
Beispiel #9
0
 def perform_as(self, actor):
   actor.attempts_to(WaitUntil(ExistenceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   driver.find_element(*self.loc()).submit()
Beispiel #10
0
 def perform_as(self, actor):
   actor.attempts_to(WaitUntil(AppearanceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   element = driver.find_element(*self.loc())
   ActionChains(driver).move_to_element(element).perform()
Beispiel #11
0
 def request_as(self, actor):
   actor.attempts_to(WaitUntil(ExistenceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   return driver.find_element(*self.loc()).value_of_css_property(self.prop_name)
Beispiel #12
0
 def request_as(self, actor):
   actor.attempts_to(WaitUntil(ExistenceOf(self.locator), IsTrue()))
   driver = actor.using('webdriver')
   classes = driver.find_element(*self.loc()).get_attribute('class')
   return classes.split()