def test_actual_paid_empty_valid(self): """测试 实缴金额为空,保存成功""" page = PartnersetPage(self.driver) alertPage = AlertPage(self.driver) readExcel = ReadExcel(self.partnerset_test_data_dir) partnerset_test_data = readExcel.get_value_by_row(0, 2) page.add_partnerset(partnerset_test_data) page.submit('save') time.sleep(1) result = alertPage.get_alert_msg() self.assertEqual(result, partnerset_test_data[3])
def test_edit_partnerset_valid(self): """测试 编辑股东,编辑成功,提示‘编辑股东成功!'""" page = PartnersetPage(self.driver) alertPage = AlertPage(self.driver) readExcel = ReadExcel(self.partnerset_test_data_dir) partnerset_edit_test_data = readExcel.get_value_by_row(1, 1) page.eidt_partnerset(partnerset_edit_test_data) page.edit_item('//*[@id="departmentName"]') page.submit('save') time.sleep(1) result = alertPage.get_alert_msg() self.assertEqual(result, partnerset_edit_test_data[3])
def test_name_repeat(self): """8.往来信息-测试往来名称重复,保存失败""" settingPage = SettingPage(self.driver, CompInfo.BASE_URL) page = ContactPage(self.driver) readExcel = ReadExcel(self.add_contact_data_dir) alertPage = AlertPage(self.driver) settingPage.go_to_contact_page() add_contact_data = readExcel.get_value_by_row(0, 7) page.add_contact(add_contact_data) page.submit('save') result = alertPage.get_alert_msg() self.assertEqual(result, add_contact_data[7]) print('result=>', result)
def test_contact_property_is_personal(self): """6.往来信息-测试 添加一个性质为个人的往来,添加成功""" settingPage = SettingPage(self.driver, CompInfo.BASE_URL) page = ContactPage(self.driver) alertPage = AlertPage(self.driver) readExcel = ReadExcel(self.add_contact_data_dir) settingPage.go_to_contact_page() add_contact_data = readExcel.get_value_by_row(0, 5) page.add_contact(add_contact_data) page.submit('save') result = alertPage.get_alert_msg() self.assertEqual(result, add_contact_data[7]) print('result=>', result)
def test_add_a_partner_valid(self): """测试 添加一名股东,添加成功,提示‘新增股东成功!’""" page = PartnersetPage(self.driver) alertPage = AlertPage(self.driver) readExcel = ReadExcel(self.partnerset_test_data_dir) settingPage = SettingPage(self.driver, CompInfo.BASE_URL) settingPage.go_to_partnerset_page() time.sleep(2) partnerset_test_data = readExcel.get_value_by_row(0, 4) page.add_partnerset(partnerset_test_data) page.submit('save') time.sleep(1) result = alertPage.get_alert_msg() self.assertEqual(result, partnerset_test_data[3])
def test_record_income(self): """测试记多条收入""" read_excel = ReadExcel(self.revenue_and_expenditure_data_dir) danger_page = DangerPage(self.driver) alert_page = AlertPage(self.driver) page = RecordTransactionPage(self.driver, CompInfo.BASE_URL, 'Income') page.go_to_record_transaction_page() excel_data = read_excel.get_value_in_order('记所有类别收入') try: for income_test_data in excel_data: page.record_income_and_outcome(income_test_data) print('income_test_data=>', income_test_data) alert_msg = alert_page.get_alert_msg() self.assertIn('保存成功', alert_msg) except Exception as e: danger_msg = danger_page.get_alert_danger_msg() if danger_msg == '请填写完整!': print(income_test_data[6] + '------记收入失败------') else: print('[RecordTransactionSpec]--记收入失败--错误原因', str(e)) self.driver.quit()
def test_record_outcome_cash(self): """测试记多条支出--现金流量表""" readExcel = ReadExcel(self.revenue_and_expenditure_data_dir) dangerPage = DangerPage(self.driver) alertPage = AlertPage(self.driver) page = RecordTransactionPage(self.driver, CompInfo.BASE_URL, 'Outcome') page.go_to_record_transaction_page() excel_data = readExcel.get_value_in_order(5) try: for outcome_test_data in excel_data: page.record_income_and_outcome(outcome_test_data) print('outcome_test_data=>', outcome_test_data) alert_msg = alertPage.get_alert_msg() self.assertIn('保存成功', alert_msg) except Exception as e: danger_msg = dangerPage.get_alert_danger_msg() if danger_msg == '请填写完整!': print('--记 ' + income_test_data[6] + '失败--' + ',错误原因=>', danger_msg) self.driver.quit() else: print('[RecordTransactionSpec]--记支出失败--错误原因', str(e)) self.driver.quit()
def test_record_transfer(self): """测试记多条互转""" readExcel = ReadExcel(self.revenue_and_expenditure_data_dir) dangerPage = DangerPage(self.driver) alertPage = AlertPage(self.driver) page = RecordTransactionPage(self.driver, CompInfo.BASE_URL, 'accountTransfers') excel_data = readExcel.get_value_in_order(4) page.go_to_record_transaction_page() try: for transfer_test_data in excel_data: page.record_transfer(transfer_test_data) print('transfer_test_data=>', transfer_test_data) alert_msg = alertPage.get_alert_msg() self.assertIn('保存成功', alert_msg) except Exception as e: danger_msg = dangerPage.get_alert_danger_msg() if danger_msg == '金额不能为0' or danger_msg == '账户不能为空' or danger_msg == '账户不能相同': print('--记 ' + income_test_data[5] + '失败--' + ',错误原因=>', danger_msg) self.driver.quit() else: print('[RecordTransactionSpec]--记互转失败--错误原因', str(e)) self.driver.quit()