本文整理汇总了Python中unit.ewslib_testcase.LIB._get_widget_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python LIB._get_widget_by_name方法的具体用法?Python LIB._get_widget_by_name怎么用?Python LIB._get_widget_by_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit.ewslib_testcase.LIB
的用法示例。
在下文中一共展示了LIB._get_widget_by_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_widget_by_name_and_verify_caching_is_faster_than_initial_get
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_get_widget_by_name_and_verify_caching_is_faster_than_initial_get(self):
widgets = {"widget_0" : "Personal Data",
"widget_1" : "Family Details",
"widget_2" : "Communication",
"widget_3" : "Bank Details",
"widget_4" : "Address",
"widget_5" : "Pending Requests",
"fwk_menu_1" : "My Details",
"fwk_menu_3" : "My Selections"}
testTime = time.clock()
#first time through we should have the dev suplied ids
for (id, name) in widgets.iteritems():
returned_widget = LIB._get_widget_by_name(name)
#by default id with be changed to chached name first time widget is found
self.assertEquals("%s_widget" % (name), returned_widget.get_attribute('id'))
firstRunTime = time.clock() - testTime
print "get widget by name without caching time is %f" % (firstRunTime)
cachedRunStart = time.clock()
#after which everything should be cached
for (id, name) in widgets.iteritems():
returned_widget = LIB._get_widget_by_name(name)
self.assertEquals("%s_widget" % (name), returned_widget.get_attribute('id'))
cachedRunStop = time.clock() - cachedRunStart
print "Time for cached run was %f" % (cachedRunStop)
self.assertTrue(cachedRunStop < firstRunTime)
fullTestTime = time.clock() - testTime
print "Total time for test was %f" % (fullTestTime)
示例2: test_verify_widget_caching_behavior
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_verify_widget_caching_behavior(self):
self.navigate(data.PD_URL)
widget_id = "fwk_menu_16"
widget_name = "Related Links"
#initially widget is uncached
self.assertIsNone(LIB._is_widget_cached(widget_name))
#call with cache_widget = False and widget is Not cached
t0 = time.clock()
LIB._get_widget_by_name(widget_name, False)
uncached_retrival_time = time.clock() - t0
self.assertIsNone(LIB._is_widget_cached(widget_name))
#default - call with cach_widget = True and widget is cached
widget = LIB._get_widget_by_name(widget_name)
t1 = time.clock()
cached_widget = LIB._get_widget_by_name(widget_name)
cached_retrival_time = time.clock() - t1
self.assertEqual(widget.text, cached_widget.text)
self.assertTrue(cached_retrival_time < uncached_retrival_time)
print "Uncached retrival time = %f Cached retrival time = %f" % (uncached_retrival_time, cached_retrival_time)
#and widget id should be set to name_widget
self.assertEqual("%s_widget" % (widget_name), widget.get_attribute('id'))
#and cache should be invalidated after reload
LIB.reload_page()
self.assertIsNone(LIB._is_widget_cached(widget_name))
示例3: test_get_widget_with_limited_widgets_on_the_page_should_be_fast
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_get_widget_with_limited_widgets_on_the_page_should_be_fast(self):
self.navigate(data.LIMITED_WIDGETS_URL)
wait = LIB.get_selenium_implicit_wait()
try:
LIB.set_browser_implicit_wait(2)
t0 = time.clock()
returned_widget = LIB._get_widget_by_name("Personal Data", False)
t1 = time.clock()
self.assertTrue((t1-t0) <2) #we get it faster than the implic_wait time, meaning we aren't using the wait time
self.assertEquals("widget_0",returned_widget.get_attribute("id"))
finally:
LIB.set_browser_implicit_wait(wait)
示例4: test_get_widget_by_name
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_get_widget_by_name(self):
widgets = {"widget_0" : "Personal Data",
"widget_1" : "Family Details",
"widget_2" : "Communication",
"widget_3" : "Bank Details",
"widget_4" : "Address",
"widget_5" : "Pending Requests",
"fwk_menu_1" : "My Details",
"fwk_menu_3" : "My Selections"}
#if no caching we should have the dev suplied ids
for (id, name) in widgets.iteritems():
returned_widget = LIB._get_widget_by_name(name,False)
self.assertEquals(id, returned_widget.get_attribute('id'))
示例5: test_get_via_dummy_class_and_widget
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_get_via_dummy_class_and_widget(self):
self.navigate(data.PD_URL)
widget = LIB._get_widget_by_name("Family Details")
link = widget.find_elements_by_css_selector(".%s" % (DC.Link))
self.assertEquals("Add",link[0].text)
self.assertEquals("screensNavigation_button_1_SCR_FAADDPARTNER", link[0].get_attribute('id'))
示例6: test_get_widget_with_limited_widgets_on_the_page
# 需要导入模块: from unit.ewslib_testcase import LIB [as 别名]
# 或者: from unit.ewslib_testcase.LIB import _get_widget_by_name [as 别名]
def test_get_widget_with_limited_widgets_on_the_page(self):
self.navigate(data.LIMITED_WIDGETS_URL)
returned_widget = LIB._get_widget_by_name("Personal Data", False)
self.assertEquals("widget_0",returned_widget.get_attribute("id"))