Exemple #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")
Exemple #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"
     )
Exemple #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))
Exemple #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")
Exemple #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))
Exemple #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")