def add_resource(self, base_config_path, add_resource_data): driver = self.driver Service.miss_login(driver, base_config_path) self.tranin() self.new_button() self.input_name(add_resource_data['name']) self.input_tel(add_resource_data['phone']) self.select_new_status() self.select_channel() self.select_save()
def abandon_resource(self, base_config_path): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() self.tranin() self.click_abandon_query() self.select_abandon_info() self.click_abandon_button() self.click_sure_abandon() time.sleep(3)
def claim_resource(self, base_config_path): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() self.click_common() self.click_claim_query_button() self.click_claim_info() self.click_claim_button() self.click_sure_claim() time.sleep(3)
def look_resume(self, base_config_path): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() time.sleep(2) self.transfer() time.sleep(2) self.click_look_query() self.click_look_button() time.sleep(3)
def query_resource(self, base_config_path, query_resource_data): driver = self.driver Service.miss_login(driver, base_config_path) self.tranin() self.resource_store() self.select_status() self.select_region() self.select_department() self.select_consultant() self.select_begin(query_resource_data['stime']) self.select_end(query_resource_data['etime']) self.select_name(query_resource_data['name']) self.select_search()
def test_common_query(self, info, expect): common_query_data = {'info': info} self.resource.common_query('..\\config\\base.conf', common_query_data) if Service.is_element_present( self.driver, By.CSS_SELECTOR, '#public-pool-table > thead:nth-child(1) > tr:nth-child(1) > th:nth-child(2) > div:nth-child(1)' ) or Service.is_element_present(self.driver, By.CSS_SELECTOR, '.no-records-found > td:nth-child(1)'): actual = 'query_successful' else: actual = 'query_failed' # 断言 self.assertEqual(actual, expect)
def test_query_resource(self, stime, etime, name, expect): query_resource_data = {'stime': stime, 'etime': etime, 'name': name} self.resource.query_resource('..\\config\\base.conf', query_resource_data) if Service.is_element_present( self.driver, By.CSS_SELECTOR, '#personal-table > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(15) > button:nth-child(2)' ) or Service.is_element_present(self.driver, By.CSS_SELECTOR, '.no-records-found > td:nth-child(1)'): actual = 'query_successful' else: actual = 'query_failed' # 断言 self.assertEqual(actual, expect)
def transfer_query(self, base_config_path, transfer_query_data): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() time.sleep(3) self.transfer() self.select_transfer_region() self.select_dept() self.select_emp() self.select_transfer_source() self.input_transfer_info(transfer_query_data['info']) self.click_transfer_query_button() time.sleep(5)
def common_query(self, base_config_path, common_query_data): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() self.click_common() self.select_common_region() self.select_common_department() self.select_common_emp() self.select_common_status() self.select_common_source() self.select_common_education() self.input_common_info(common_query_data['info']) self.click_common_search_button() time.sleep(3)
def turn_resource(self, base_config_path): driver = self.driver Service.miss_login(driver, base_config_path) self.decode() self.resource_management() time.sleep(2) self.transfer() time.sleep(2) self.click_turn_query_button() self.select_info() self.select_turn_region() self.select_turn_dept() self.select_turn_emp() self.click_commit() self.click_sure_button() time.sleep(3)
def test_claim_resource(self): self.resource.claim_resource('..\\config\\base.conf') if Service.is_element_present(self.driver, By.CSS_SELECTOR, '.bootbox-body'): actual = 'claim_successful' else: actual = 'claim_failed' # 断言 self.assertEqual(actual, 'claim_successful')
def test_query_resource(self, name, phone, expect): add_resource_data = {'name': name, 'phone': phone} self.resource.add_resource('..\\config\\base.conf', add_resource_data) if Service.is_element_present(self.driver, By.CSS_SELECTOR, '.bootbox-body'): actual = 'add_successful' else: actual = 'add_failed' # 断言 self.assertEqual(actual, expect)
def test_look_resume(self): self.resource.look_resume('..\\config\\base.conf') if Service.is_element_present( self.driver, By.CSS_SELECTOR, '.modal-lg > form:nth-child(1) > div:nth-child(1) > div:nth-child(1) > h4:nth-child(2)' ): actual = 'query_successful' else: actual = 'query_failed' # 断言 self.assertEqual(actual, 'query_successful')
def test_abandon_resource(self): self.resource.abandon_resource('..\\config\\base.conf') if Service.is_element_present( self.driver, By.CSS_SELECTOR, '#personal-table > thead:nth-child(1) > tr:nth-child(1) > th:nth-child(2) > div:nth-child(1)' ): actual = 'abandon_successful' else: actual = 'abandon_failed' # 断言 self.assertEqual(actual, 'abandon_successful')
def resource_store(self): Resource_bank = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(1) > select:nth-child(1)') Service.select_random(Resource_bank)
def select_common_region(self): area = self.driver.find_element_by_name('region') Service.select_random(area)
def setUp(cls): cls.driver = Service.get_driver('..\\config\\base.conf') from woniuboss4.lib.resource import Resource cls.resource = Resource(cls.driver)
def select_common_department(self): department = self.driver.find_element_by_name('dept') Service.select_random(department)
def select_common_emp(self): emp = self.driver.find_element_by_name('empName') Service.select_random(emp)
def select_name(self, name): input_name = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(1) > input:nth-child(6)') Service.send_input(input_name, name)
def input_common_info(self, info): input_info = self.driver.find_element_by_name('cusInfo') Service.send_input(input_info, info)
def select_begin(self, stime): Service.remove_readonly(self.driver, 'date1') stime_ele = self.driver.find_element_by_id('date1') Service.send_input(stime_ele, stime)
def select_consultant(self): counselor = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(8) > select:nth-child(3)') Service.select_random(counselor)
def select_department(self): department = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(8) > select:nth-child(2)') Service.select_random(department)
def select_region(self): area = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(8) > select:nth-child(1)') Service.select_random(area)
def select_common_source(self): source = self.driver.find_element_by_name('source') Service.select_random(source)
def select_common_education(self): education = self.driver.find_element_by_name('education') Service.select_random(education)
def select_end(self, etime): Service.remove_readonly(self.driver, 'date2') etime_ele = self.driver.find_element_by_id('date2') Service.send_input(etime_ele, etime)
def select_source(self): source = self.driver.find_element_by_css_selector( 'div.col-lg-12:nth-child(1) > select:nth-child(3)') Service.select_random(source)
def select_status(self): state = self.driver.find_element_by_name('last_status') Service.select_random(state)