def test_02_two_contact(self,data): u"""New Customer with two contact,address,identifier""" entityType = data['entityType'] entityClass = data['entityClass'] salutation = data['salutation'] suffix = data['suffix'] typeOfBusiness = data['typeOfBusiness'] stateOfIncorporation = data['stateOfIncorporation'] role = data['role'] emailType = data['emailType'] phoneType1 = data['type1'] phoneType2 = data['type2'] phoneType3 = data['type3'] # addressType = data['addressType'] # stateCode = data['stateCode'] # type = data['identifierName'] addressType = dbConnect().getdata('MCDH', 'addressType','') stateCode = dbConnect().getdata('ALAMO', 'stateCode','') type = dbConnect().getdata('MCDH', 'identifierNameWithoutBan','') TopMenuPage(self.driver).select_multiple_menu(2, "customers", "New", "", "") # CustomerRecordPage(self.driver).top_operate("Actions ", "New") NewCustomerPage(self.driver).business_entity(entityType, entityClass, salutation, suffix, typeOfBusiness, stateOfIncorporation) NewCustomerPage(self.driver).contact(False, 1, 1, role, emailType, phoneType1) NewCustomerPage(self.driver).add_phone("Phone 2", 1, 3, phoneType2) NewCustomerPage(self.driver).add_phone("Phone 3", 1, 5, phoneType3) NewCustomerPage(self.driver).contact(False, 3, 1, role, emailType, phoneType1) NewCustomerPage(self.driver).add_phone("Phone 2", 3, 3, phoneType2) NewCustomerPage(self.driver).add_phone("Phone 3", 3, 5, phoneType3) NewCustomerPage(self.driver).address("Address", addressType, stateCode) NewCustomerPage(self.driver).identifier("Identifier", type) self.assertTrue(NewCustomerPage(self.driver).save()) self.assertTrue(NewCustomerPage(self.driver).validation_data())
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_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_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_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 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_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_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_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_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 operator_identifier(self, flag, type): """ # Identifier :param : flag,type :return: """ if flag == "edit": if self.find_element(CustomerRecordEntity().get_identifier_name( 1)).text == "BAN": return True elif self.find_element(CustomerRecordEntity().get_identifier_name( 1)).text == "State Tax ID": self.ctrl_all(CustomerRecordEntity.identifier) self.type(CustomerRecordEntity.identifier, BasePage(self.driver).randomData("number", 11)) self.click(CustomerRecordEntity.save) if "successfully" in self.get_tips_msg(): return True else: return False else: self.drop_select(CustomerRecordEntity.identifierName, type) self.ctrl_all(CustomerRecordEntity.identifier) self.identifier_not_BAN_input(type) self.click(CustomerRecordEntity.save) if "successfully" in self.get_tips_msg(): return True else: return False elif flag == "new": self.sleep(1) if type == "BAN": if self.without_BAN() == True: type = dbConnect().getdata('MCDH', 'identifierNameWithoutBan') self.drop_select(CustomerRecordEntity.identifierName, type) self.identifier_not_BAN_input(type) else: self.drop_select(CustomerRecordEntity.identifierName, "State Tax ID") self.type(CustomerRecordEntity.identifier, BasePage(self.driver).randomData("number", 11)) self.click(CustomerRecordEntity.save) self.find_elements_by_wait( "xpath", CustomerRecordEntity().get_section_operator(5, "New")) self.click(CustomerRecordEntity().get_section_operator( 5, "New")) self.drop_select(CustomerRecordEntity.identifierName, type) self.drop_select_index(CustomerRecordEntity.select_tax, 1) else: self.drop_select(CustomerRecordEntity.identifierName, type) self.identifier_not_BAN_input(type) self.click(CustomerRecordEntity.save) if "successfully" in self.get_tips_msg(): return True else: return False elif flag == "Delete": if self.find_element(CustomerRecordEntity().get_identifier_name( 1)).text == "BAN": return True else: self.click(CustomerRecordEntity.delete_confirm) if "successfully" in self.get_tips_msg(): return True else: return False