Ejemplo n.º 1
0
 def test_web_element_is_evaluated_every_time_without_caching(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theid'])
     self.driver.set_dom_element([By.ID, 'theid'])
     element_first_time = component.locate()
     ##
     self.driver.reset_dom_elements()
     self.driver.set_dom_element([By.ID, 'theid'])
     element_second_time = component.locate()
     ##
     assert_that(element_first_time, is_not(equal_to(element_second_time)),
                 "when cached web_element() should return always the same WebElement object")
Ejemplo n.º 2
0
 def test_web_element_is_evaluated_every_time_without_caching(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theid'])
     self.driver.set_dom_element([By.ID, 'theid'])
     element_first_time = component.locate()
     ##
     self.driver.reset_dom_elements()
     self.driver.set_dom_element([By.ID, 'theid'])
     element_second_time = component.locate()
     ##
     assert_that(
         element_first_time, is_not(equal_to(element_second_time)),
         "when cached web_element() should return always the same WebElement object"
     )
Ejemplo n.º 3
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))
Ejemplo n.º 4
0
 def test_component_can_be_created_from_web_element(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theId'])
     a_web_element = WebElement(None, '')
     ##
     component.from_web_element(a_web_element)
     ##
     assert_that(component.locate(), equal_to(a_web_element),
                 "fromWebElement should store a reference to passed WebElement")
Ejemplo n.º 5
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))
Ejemplo n.º 6
0
 def test_component_can_be_created_from_web_element(self):
     component = UIComponent(self.driver, 'a component', [By.ID, 'theId'])
     a_web_element = WebElement(None, '')
     ##
     component.from_web_element(a_web_element)
     ##
     assert_that(
         component.locate(), equal_to(a_web_element),
         "fromWebElement should store a reference to passed WebElement")