def test_07_DBA_new(self): u"""new a DBA""" BasePage(self.driver).refresh_page() CustomerRecordPage(self.driver).entity_operator( "Doing Business As (DBA)", "New", "") self.assertTrue( CustomerRecordPage(self.driver).input_DBA_Website("alias"))
def test_11_Identifier_edit(self): u"""edit identifier""" type = dbConnect().getdata('MCDH', 'identifierNameWithoutBan', '') CustomerRecordPage(self.driver).entity_operator( "Business Identifiers", "Edit", "1") self.assertTrue( CustomerRecordPage(self.driver).operator_identifier("edit", type))
def test_10_Identifier_new(self): u"""new identifier""" type = dbConnect().getdata('MCDH', 'identifierName', '') CustomerRecordPage(self.driver).entity_operator( "Business Identifiers", "New", "") self.assertTrue( CustomerRecordPage(self.driver).operator_identifier("new", type))
def test_01_Address_new(self): u"""new address""" addressType = dbConnect().getdata('MCDH', 'addressType', '') CustomerRecordPage(self.driver).switch_tab("Entity") stateCode = dbConnect().getdata('ALAMO', 'stateCode', '') CustomerRecordPage(self.driver).entity_operator("Addresses", "New", "") self.assertTrue( CustomerRecordPage(self.driver).operator_address( addressType, stateCode))
def test_02_Address_edit(self): u"""edit address""" CustomerRecordPage(self.driver).entity_operator( "Addresses", "Edit", "1") addressType = dbConnect().getdata('MCDH', 'addressType', '') stateCode = dbConnect().getdata('ALAMO', 'stateCode', '') self.assertTrue( CustomerRecordPage(self.driver).operator_address( addressType, stateCode))
def test_01_contacts_new(self): u"""new a contact""" salutation = dbConnect().getdata('MCDH', 'salutation', '') CustomerRecordPage(self.driver).switch_tab("Contacts") suffix = dbConnect().getdata('MCDH', 'suffix', '') CustomerRecordPage(self.driver).contact_operator("Contacts", "New", "") role = dbConnect().getdata('MCDH', 'roleType', '') self.assertTrue( CustomerRecordPage(self.driver).operator_contact( salutation, suffix, role))
def test_updateCustomer(self, data): u"""New Customer""" entityType = data['entityType'] entityClass = data['entityClass'] salutation = data['salutation'] suffix = data['suffix'] typeOfBusiness = data['typeOfBusiness'] stateOfIncorporation = data['stateOfIncorporation'] CustomerRecordPage(self.driver).top_operate("Actions ", "Edit") CustomerRecordPage(self.driver).edit_entity(entityType, entityClass, salutation, suffix, typeOfBusiness, stateOfIncorporation) self.assertTrue(NewCustomerPage(self.driver).save()) self.assertTrue(NewCustomerPage(self.driver).validation_data())
def test_01_usm(self): u"""validate have no access for user management""" BasePage(self.driver).refresh_page() TopMenuPage(self.driver).is_homepage() SystemLogin(self.driver).switch_account('*****@*****.**', 'Abc1234%') TopMenuPage(self.driver).select_multiple_menu( 2, "manage", "Authorization Management", "", "") self.assertTrue(CustomerRecordPage(self.driver).validate_permission())
def save(self): """ #Save validation :param :return: """ self.click(NewCustomerEntity.save) self.sleep(1) if "successfully" in CustomerRecordPage(self.driver).get_tips_msg(): return True else: return False
def test_04_customer_address(self): u"""validate have no access for new/edit/delete entity""" SystemLogin(self.driver).switch_account('*****@*****.**', 'Abc1234%') HomePage(self.driver).quick_entrance("Customers", "C000048473", 2) BasePage(self.driver).switch_to_handle(1) CustomerRecordPage(self.driver).switch_tab("Entity") CustomerRecordPage(self.driver).entity_operator("Addresses", "New", "") self.assertTrue(CustomerRecordPage(self.driver).validate_permission()) CustomerRecordPage(self.driver).entity_operator( "Addresses", "Edit", "1") self.assertTrue(CustomerRecordPage(self.driver).validate_permission()) CustomerRecordPage(self.driver).entity_operator( "Addresses", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).validate_permission()) BasePage(self.driver).close_current_window()
def validation_data(self): """ #validate the data accuracy :param :return: """ if CustomerRecordPage(self.driver).is_customer_record_page(): customerId = self.find_element(NewCustomerEntity().get_field_input("customer-id")).get_attribute('value') organizationName = self.find_element(NewCustomerEntity().get_field_input("organization-name")).get_attribute( 'value') entityType = self.find_element(NewCustomerEntity().get_field_input("entity-type")).get_attribute('value') if entityType == "Person": CustomerId = dbConnect().getdata('MCDH', 'CustomerId_Person', organizationName) elif entityType == "Organization": CustomerId = dbConnect().getdata('MCDH', 'CustomerId_Organization', organizationName) if customerId == CustomerId: return True else: logger.info("customerId %s new customer failed!" % customerId) return False
def test_09_contacts_delete(self): u"""delete contacts""" CustomerRecordPage(self.driver).contact_operator( "Contacts", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_10_customer_delete(self): u"""delete customer""" CustomerRecordPage(self.driver).top_operate("Actions ", "Delete") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_07_phone_edit(self): u"""edit contact phone""" phoneType = dbConnect().getdata('MCDH', 'phoneType', '') CustomerRecordPage(self.driver).contact_operator("Phone", "Edit", "1") self.assertTrue( CustomerRecordPage(self.driver).operator_phone(phoneType))
def test_08_phone_delete(self): u"""delete contact phone""" CustomerRecordPage(self.driver).contact_operator( "Phone", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_05_email_delete(self): u"""delete contact email""" CustomerRecordPage(self.driver).contact_operator( "Email", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_06_phone_new(self): u"""new contact phone""" phoneType = dbConnect().getdata('MCDH', 'phoneType', '') CustomerRecordPage(self.driver).contact_operator("Phone", "New", "") self.assertTrue( CustomerRecordPage(self.driver).operator_phone(phoneType))
def test_04_Websites_new(self): u"""new Websites""" CustomerRecordPage(self.driver).entity_operator("Web Sites", "New", "") self.assertTrue( CustomerRecordPage(self.driver).input_DBA_Website("url"))
def test_04_email_edit(self): u"""edit contact email""" emailType = dbConnect().getdata('MCDH', 'emailType', '') CustomerRecordPage(self.driver).contact_operator("Email", "Edit", "1") self.assertTrue( CustomerRecordPage(self.driver).operator_email(emailType, "true"))
def test_05_Websites_edit(self): u"""edit Websites""" CustomerRecordPage(self.driver).entity_operator( "Web Sites", "Edit", "1") self.assertTrue( CustomerRecordPage(self.driver).input_DBA_Website("url"))
def test_02_customer_new(self): u"""validate have no access for new customer page""" TopMenuPage(self.driver).select_multiple_menu(2, "customers", "New", "", "") self.assertTrue(CustomerRecordPage(self.driver).validate_permission())
def operation(self, flag, index, section, buttonName, capabilityNamelist=[]): """ :param flag,index,section,buttonName,capabilityNamelist=[] :return: """ if self.is_usm_page() == True: if buttonName == "New" or (section == "Roles" and buttonName == "Edit"): self.ctrl_all(UsmEntity().get_input_textbox("name")) self.type(UsmEntity().get_input_textbox("name"), "UI automation" + nowTime) self.ctrl_all(UsmEntity().get_input_textbox("description")) self.type(UsmEntity().get_input_textbox("description"), BasePage(self.driver).randomData("string", 6)) self.sleep(2) permission_list = [ "Read", "Update", "Create", "Delete", "MassUpdate" ] # capability_list = self.find_elements(UsmEntity.capabilitity_list) capability_item = None capability_index = [] for i in capabilityNamelist: self.ctrl_all(UsmEntity.filter) self.type(UsmEntity.filter, i) capability_list = self.find_elements( UsmEntity.capabilitity_list) for j, item in enumerate(capability_list): if i == item.text: capability_item = j capability_index.append(capability_item) for b in permission_list: self.click(UsmEntity().get_capability( b, capability_index[0])) if capability_item is None: logger.info(msg="capabilityName %s not found!" % i) # for a in capability_index: # for b in permission_list: # self.click(UsmEntity().get_capability(b, a)) elif section == "Users": self.ctrl_all(UsmEntity().get_input_textbox("userName")) self.type(UsmEntity().get_input_textbox("userName"), BasePage(self.driver).randomData("string", 6)) self.ctrl_all(UsmEntity().get_input_textbox("firstName")) self.type(UsmEntity().get_input_textbox("firstName"), BasePage(self.driver).randomData("string", 6)) self.ctrl_all(UsmEntity().get_input_textbox("lastName")) self.type(UsmEntity().get_input_textbox("lastName"), BasePage(self.driver).randomData("string", 6)) elif buttonName == "Inactivate": self.click(UsmEntity.confirm_delete) if buttonName == "New" or buttonName == "Edit": if index == 1: if section == "Roles": self.click(UsmEntity().get_button("Next")) list = "Users" else: list = "Roles" if flag == "add": self.type( UsmEntity.filter, self.find_element(UsmEntity().get_list_value( "available" + list + "Selected", "1")).text) Select( self.find_element(UsmEntity().get_two_list( "available" + list + "Selected"))).select_by_index(0) self.sleep(1) self.click(UsmEntity().get_button("Add")) elif flag == "remove": Select( self.find_element(UsmEntity().get_two_list( "assigned" + list + "Selected"))).select_by_index(0) self.sleep(1) self.click(UsmEntity().get_button("Remove")) else: if section == "Roles": self.click(UsmEntity().get_switch_tab("Users")) list = "Users" else: list = "Roles" if flag == "add": self.ctrl_multiSelect( UsmEntity().get_list_value( "available" + list + "Selected", "1"), UsmEntity().get_list_value( "available" + list + "Selected", "2")) self.sleep(1) self.click(UsmEntity().get_button("Add")) elif flag == "remove": self.ctrl_multiSelect( UsmEntity().get_list_value( "assigned" + list + "Selected", "1"), UsmEntity().get_list_value( "assigned" + list + "Selected", "2")) self.sleep(1) self.click(UsmEntity().get_button("Remove")) self.click(UsmEntity().get_button("Finish")) self.sleep(2) if "successfully" in CustomerRecordPage( self.driver).get_tips_msg(): return True else: return False
def test_09_DBA_delete(self): u"""delete DBA""" CustomerRecordPage(self.driver).entity_operator( "Doing Business As (DBA)", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_08_DBA_edit(self): u"""edit DBA""" CustomerRecordPage(self.driver).entity_operator( "Doing Business As (DBA)", "Edit", "1") self.assertTrue( CustomerRecordPage(self.driver).input_DBA_Website("alias"))
def test_12_Identifier_delete(self): u"""delete identifier""" CustomerRecordPage(self.driver).entity_operator( "Business Identifiers", "Delete", "1") self.assertTrue( CustomerRecordPage(self.driver).operator_identifier("Delete", ""))
def test_06_Websites_delete(self): u"""delete Websites""" CustomerRecordPage(self.driver).entity_operator( "Web Sites", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())
def test_03_email_new(self): u"""new contact email""" emailType = dbConnect().getdata('MCDH', 'emailType', '') CustomerRecordPage(self.driver).contact_operator("Email", "New", "") self.assertTrue( CustomerRecordPage(self.driver).operator_email(emailType, "false"))
def test_03_Address_delete(self): u"""delete address""" CustomerRecordPage(self.driver).entity_operator( "Addresses", "Delete", "1") self.assertTrue(CustomerRecordPage(self.driver).delete())