def test_init_with_named_locators(self):
     root = LocatorDict(menu=Locator.XPATH('//div'),
                        logout=(By.ID, 'logout'))
     self.assertTrue('menu' in root)
     self.assertTrue('logout' in root)
 def test_xpath_locator(self):
     self.assertEqual(Locator.XPATH('//div')._strategy, By.XPATH)
 def test_add_new_locator_node_by_key(self):
     self.locators['menu.contact'] = Locator.XPATH('//contact')
     self.assertEqual(self.locators['menu.contact']._strategy, 'xpath')
     self.assertEqual(self.locators['menu.contact']._value, '//contact')
 def test_interpolation(self):
     new_loc = self.locators.xpath_locator % 'wow'
     self.assertEqual(new_loc._value, '//div/wow')
     self.assertEqual(new_loc._value, Locator.XPATH('//div/wow')._value)
 def test_add_new_locator_node_by_attr(self):
     self.locators.menu.home = Locator.XPATH('//nav//home')
     self.assertEqual(self.locators.menu.home._strategy, 'xpath')
     self.assertEqual(self.locators.menu.home._value, '//nav//home')