def test_technical_interview(self, q_content, e_content, expect): technical_interview_data = { 'question_content': q_content, 'evalute_content': e_content } # 执行技术面试的操作 self.employ.technical_interview(path, technical_interview_data) if Service.is_element_present( self.driver, By.CSS_SELECTOR, '.bootbox > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > h4:nth-child(2)' ): time.sleep(2) content = self.driver.find_element_by_css_selector( '.bootbox-body').text if '不能为空' in content: actual = 'interview_fail' self.driver.find_element_by_xpath( '/html/body/div[11]/div/div/div[3]/button').click() else: actual = 'interview_success' self.driver.find_element_by_xpath( '/html/body/div[11]/div/div/div[3]/button').click() else: contents = self.driver.find_element_by_css_selector( '#skill_table > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(1)' ).text if '无符合条件' in contents: actual = 'interview_fail' else: actual = 'interview_success' self.assertEqual(actual, expect)
def test_mock_interview(self, money, remark, expect): mock_interview_data = {'salary': money, 'mremark': remark} # 执行技术面试的操作 self.employ.mock_interview(path, mock_interview_data) if Service.is_element_present( self.driver, By.CSS_SELECTOR, '#stuInfo_table1 > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(9) > button:nth-child(1)' ): actual = 'mock_success' else: actual = 'mock_fail' self.assertEqual(actual, expect)
def test_login(self, login_userName, login_userPASS, login_checkcode, login_expect): contents = { 'username': login_userName, 'password': login_userPASS, 'checkcode': login_checkcode } self.login.excute_login(contents) # 断言 if Service.is_element_present(self.driver, By.LINK_TEXT, '注销'): actual = 'success' elif self.driver.find_element_by_id('pwMsg').text == '用户名或密码错误': actual = 'error' elif self.driver.find_element_by_id('checkcodeMsg').text == '用户名或密码错误': actual = 'error' else: actual = 'error' self.assertEqual(actual, login_expect)