本文整理匯總了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"))