Exemple #1
0
 def test_can_cache_element(self):
     component = UIComponent(self.driver, 'a_component', [By.ID, 'an_id'])
     component.cache()
     cached_element = MockedWebElement(self.driver, 'another_id')
     ##
     component._cache_web_element(cached_element)
     ##
     assert_that(component.locate(), equal_to(cached_element))
Exemple #2
0
 def test_can_cache_element(self):
     component = UIComponent(self.driver, 'a_component', [By.ID, 'an_id'])
     component.cache()
     cached_element = MockedWebElement(self.driver, 'another_id')
     ##
     component._cache_web_element(cached_element)
     ##
     assert_that(component.locate(), equal_to(cached_element))
Exemple #3
0
 def test_web_element_is_stored_with_caching(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theid'])
     self.driver.set_dom_element([By.ID, 'theid'])
     element_first_time = component.cache().locate()
     ##
     self.driver.reset_dom_elements()
     self.driver.set_dom_element([By.ID, 'theid'])
     element_second_time = component.locate()
     ##
     assert_that(element_first_time, equal_to(element_second_time),
                 "when cached web_element() should return always the same WebElement object")
Exemple #4
0
 def test_web_element_is_stored_with_caching(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theid'])
     self.driver.set_dom_element([By.ID, 'theid'])
     element_first_time = component.cache().locate()
     ##
     self.driver.reset_dom_elements()
     self.driver.set_dom_element([By.ID, 'theid'])
     element_second_time = component.locate()
     ##
     assert_that(
         element_first_time, equal_to(element_second_time),
         "when cached web_element() should return always the same WebElement object"
     )