本文整理汇总了Python中unit.ewslib_testcase.LIB类的典型用法代码示例。如果您正苦于以下问题:Python LIB类的具体用法?Python LIB怎么用?Python LIB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LIB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_widget_by_name_and_verify_caching_is_faster_than_initial_get
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_euh_select_drop_down_field_value_logs_warning_if_value_not_displayed
def test_euh_select_drop_down_field_value_logs_warning_if_value_not_displayed(self):
self.was_called = False
old_warn = LIB._warn
LIB._warn = self.mock_warn
LIB.euh_select_drop_down_field_value("Language","not a language",widget_name="Personal Data")
LIB._warn = old_warn
self.assertTrue(self.was_called)
示例3: test_set_unique_text_value
def test_set_unique_text_value(self):
self.navigate(data.PD_URL)
val1 = LIB.euh_set_unique_text_value("Last name", "test",widget_name="Personal Data")
val2 = LIB.euh_set_unique_text_value("Last name", "test", widget_name="Personal Data")
val3 = LIB.euh_set_unique_text_value("Last name", "test",widget_name="Personal Data")
val4 = LIB.euh_set_unique_text_value("Last name", "test", widget_name="Personal Data")
self.assertTrue(val1 != val2 != val3 != val4)
示例4: test_euh_select_drop_down_field_value
def test_euh_select_drop_down_field_value(self):
langs = [u'Afrikaans', u'Espa\xf1ol',u'Ukrainian',u'\u05e2\u05d1\u05e8\u05d9\u05ea']
for lang in langs:
LIB.euh_select_drop_down_field_value("Language",lang,widget_name="Personal Data")
#make sure we click somethign else to ensure that the drop down is really set
self.set_and_check_date_value("Date of birth", "10.10.1975","Personal Data")
LIB.euh_check_default_drop_down_field_value("Language", lang, widget_name="Personal Data")
示例5: test_euh_check_button_existence_by_index
def test_euh_check_button_existence_by_index(self):
self.navigate(data.PD_URL)
btn = LIB.euh_check_button_existence(button_name="Save",index=0)
self.assertEquals("Save", btn.text)
self.assertEquals("my_fake_button", btn.get_attribute("id"))
btn = LIB.euh_check_button_existence(button_name="Save",index=1)
self.assertEquals("Save", btn.text)
self.assertEquals("centerRoundedButton test_button", btn.get_attribute("class"))
示例6: test_verify_widget_caching_behavior
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))
示例7: test_find_euh_dropdown_returns_appropriate_type_of_dropdown
def test_find_euh_dropdown_returns_appropriate_type_of_dropdown(self):
dropdown = LIB._find_euh_dropdown("Language", "Personal Data")
self.assertEquals(DC.Dropdown, dropdown[1])
self.assertEquals("select", dropdown[0].tag_name)
auto_dropdown = LIB._find_euh_dropdown("Nationality", "Personal Data")
self.assertEquals(DC.AutocompleteDropDown, auto_dropdown[1])
self.assertEquals("input", auto_dropdown[0].tag_name)
nota_dropdown = LIB._find_euh_dropdown("Last name", "Personal Data")
self.assertIsNone(nota_dropdown[1])
self.assertEquals("div", nota_dropdown[0].tag_name)
示例8: test_euh_click_ee_bubble_option_list
def test_euh_click_ee_bubble_option_list(self):
self.navigate(data.EE_URL)
LIB.euh_click_ee_bubble_option_list("Clock IN / OUT")
LIB.euh_click_ee_bubble_option_list("Clock IN / OUT", "30000290", "My Details")
LIB.euh_click_ee_bubble_option_list("Clock IN / OUT", "30000290_Time Error_Correct Time_Emp", "My Details")
LIB.euh_click_ee_bubble_option_list("Clock IN / OUT", "30000290_Time Error_Correct", "my details")
self.assertRaisesRegexp(RuntimeError, "you must specify widget_name if you specify button_name for _get_ee_button",
LIB.euh_click_ee_bubble_option_list,"Clock IN / OUT", "30000290")
示例9: test_find_button_by_name_inside_of_a_widget
def test_find_button_by_name_inside_of_a_widget(self):
self.navigate(data.PD_URL)
expected_button_names= ["Save", "Cancel"]
for name in expected_button_names:
my_button = LIB._get_button_by_name(name,'Personal Data')
self.assertEquals(name, my_button.text)
示例10: verify_elements_in_widget
def verify_elements_in_widget(self, widget_name,dummy_class,expected_link_names,expected_ids):
links = LIB._get_via_dummy_class(dummy_class, widget_name=widget_name)
#verify link names
link_names = [link.text for link in links]
self.assertItemsEqual(expected_link_names, link_names)
#verify link IDs
link_ids = [link.get_attribute('id') for link in links]
self.assertItemsEqual(expected_ids, link_ids)
示例11: test_get_elements_via_dummy_class_with_no_widget_still_finds_elements_inside_widget
def test_get_elements_via_dummy_class_with_no_widget_still_finds_elements_inside_widget(self):
self.navigate(data.PD_URL)
labels = LIB._get_via_dummy_class(DC.Label)
#list of labels that don't implmenet the for_ ID pattern to identify the associated control
#print "\n".join([lbl.text for lbl in labels if not lbl.get_attribute("id").startswith("for_")])
self.assertEquals(39, len(labels))
#ensure we find stuff like Title, Last name, first name that are in the Personal Data widget
from sets import Set
expected_Label_Names=Set(["Title","Last name","First name"])
actual_Label_Names =Set([lbl.text for lbl in labels])
self.assertTrue(expected_Label_Names.issubset(actual_Label_Names))
示例12: test_find_euh_top_menu_buttons
def test_find_euh_top_menu_buttons(self):
data = ("employee data", "time management", "Payroll Data", "BENEFITS", "WorKFORce administration", "TaLeNt MaNaGeMeNt",
"Strategy & Communication","Service Center")
for topmenu_name in data:
button = LIB._get_euh_top_menu_button(topmenu_name)
self.assertEquals("button", button.tag_name)
locator = OR["topmenu_%s" % (topmenu_name.lower())][5:]
button_id = locator.split(" > ")[0]
#print "name = %s button_id = %s button class = %s" % (topmenu_name, button_id, button.get_attribute("class"))
self.assertTrue(button.get_attribute("class").find(button_id) > -1)
示例13: test_get_widget_by_name
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'))
示例14: test_get_element_by_label
def test_get_element_by_label(self):
self.navigate(data.PD_URL)
expected_data = {"PD_DATA_1_1_ANRED": "Title",
"PD_DATA_1_1_NACHN": "Last name",
"PD_DATA_1_1_VORNA": "First name",
"PD_DATA_1_1_GBDAT": "Date of birth",
"PD_DATA_1_1_NATIO": "Nationality",
"PD_DATA_1_1_SPRSL":"Language",
"PD_DATA_1_1_BEGDA": "Start Date",
"PD_DATA_1_1_ENDDA": "End Date"}
for (id,name) in expected_data.iteritems():
element = LIB._get_element_by_label(name,widget_name="Personal Data")
self.assertEquals(id,element.get_attribute("id"))
示例15: test_check_time_uses_belgium_time_zone
def test_check_time_uses_belgium_time_zone(self):
self.navigate(data.TIME_URL)
from datetime import datetime, timedelta
time_value = datetime.now().strftime("%I:%M:%S")
LIB.euh_set_time_value("From",time_value)
self.assertRaises(ValidationFailedError,LIB.euh_check_time_value,"From", "<<current min>>")
belgium_time_value = (datetime.utcnow() + timedelta(hours=1)).strftime("%I:%M:%S")
LIB.euh_set_time_value("From",belgium_time_value)
LIB.euh_check_time_value("From", "<<current min>>")