class TestAddressBook: data = BasePage.yaml_load('../data/member_manage.data.yaml') step = BasePage.yaml_load('../data/member_manage.step.yaml') def setup_class(self): self.dx = Index() # self.dx.driver.implicitly_wait(3) def teardown_class(self): self.dx.driver.close() @pytest.mark.parametrize('name, acct_id, phone, mail, expect', data['test_add_member']) def test_add_member(self, name, acct_id, phone, mail, expect): res = self.dx.address_book().member_manage().add_member( name, acct_id, phone, mail) assert res == expect @pytest.mark.parametrize('name, expect', data['test_delete_member']) def test_delete_member(self, name, expect): res = self.dx.address_book().member_manage().delete_member('杜宁') assert res == expect @pytest.mark.parametrize('name, acct_id, phone, mail, expect', data['test_add_member']) def test_add_member_step(self, name, acct_id, phone, mail, expect): BasePage.params = { 'name': name, 'acct_id': acct_id, 'phone': phone, 'mail': mail } self.dx.address_book().member_manage().steps(self.step['add_member'])
def test_haha(self): """搜索龙珠超""" main = Index(self.driver) main.search_dragonball_super() # 断言 self.assertEqual("龙珠超2 - 国内版 Bing", self.driver.title, "bing搜索'龙珠超'后页面标题与预期不符")
class Testlo: def setup(self): self.a1 = Index() def testlog(self): self.a1.go_link() def teardown(self): self.a1.clo()
def test_true_login(self): TestPage(self.selenium).console_login(self.login_name, self.password) NewStaff(self.selenium).staff_flow(self.new_login_name, self.password).if_login( '1').click_save_button() Index(self.selenium).click_user_list().click_user_quit() url = TestPage(self.selenium).console_login(self.new_login_name, self.password).get_current_page_url() self.assertEqual(url, self.url)
def back_to_index(self): ''' 在其他應用回到首頁 :return: ''' self.step(main1_dir, "back_to_index") return Index(self._driver)
class TestDepartmentManage: data = BasePage.yaml_load('../data/department_manage.data.yaml') def setup_class(self): self.dx = Index() def teardown_class(self): self.dx.driver.close() @pytest.mark.parametrize('name, p_name, expect', data['test_add_dept']) def test_add_dept(self, name, p_name, expect): res = self.dx.address_book().department_manager().add_dept( name, p_name) assert res == expect @pytest.mark.skip(reason="不执行该用例") @pytest.mark.parametrize('name, expect', data['test_delete_dept']) def test_delete_dept(self, name, expect): res = self.dx.address_book().department_manager().delete_dept(name) assert res == expect
def test_loan_status(self): """总流程""" for i in range(20): customer_name = u'流程' + str(i + 6) card_no = str(340101198108210301 + i) mobile = str(18689242831 + i) # 新建客户 TotalFlow(self.selenium).risk_management_new_customer( self.risk_management, customer_name, card_no, mobile) Index(self.selenium).click_user_list().click_user_quit() # 风控专员审核 TotalFlow(self.selenium).risk_management_submit( self.risk_management, customer_name) time.sleep(2) # status = LoanList(self.selenium).get_loan_status(self.customer_name) # self.assertEqual(status, u'审批中') Index(self.selenium).click_user_list().click_user_quit() print(i)
def test_new_customer_url(self): """测试url跳转""" TestPage(self.selenium).console_login(self.user_name, self.password) Index(self.selenium).click_customer_manage() # 校验跳转成功后url跳转 CustomerList(self.selenium).click_new_customer() handles = CustomerList(self.selenium).get_window_handles() url = CustomerList(self.selenium).choose_window_handle( handles[2]).get_current_page_url() self.assertEqual(url, settings.WEB_TEST_BASE_URL + '/customer/form')
def save(self): self.step(loginpage_dir, "save") return Index(self._driver)
def test_loan_status(self): '''信审专员拒绝''' # 新建客户 TotalFlow(self.selenium).risk_management_new_customer( self.risk_management, self.customer_name, self.card_no, self.mobile) Index(self.selenium).click_user_list().click_user_quit() # 风控专员审核 TotalFlow(self.selenium).risk_management_submit( self.risk_management, self.customer_name) Index(self.selenium).click_user_list().click_user_quit() # # 信审经理审核 # TotalFlow(self.selenium).judge_manager_allocation_role(self.judge_manager, self.customer_name) # status1 = CreditAuditLoanList(self.selenium).get_loan_status(self.customer_name, self.judge_manager) # self.assertEqual(status1, u'审批中') # Index(self.selenium).click_user_list().click_user_quit() # 信审专员审核 get_customer_id = select_customer(self.customer_name)['id'] time.sleep(2) credit_person_login_name = get_credit_person_login_name( get_customer_id)['login_name'] TotalFlow(self.selenium).risk_management_other( credit_person_login_name, self.customer_name) Index(self.selenium).click_user_list().click_user_quit() TotalFlow(self.selenium).risk_management_submit_audit( credit_person_login_name, self.customer_name, self.repulse_status) status2 = HistoricalList(self.selenium).get_loan_status( self.customer_name, self.credit_person) self.assertEqual(status2, u'拒绝') Index(self.selenium).click_user_list().click_user_quit() # 风控经理复议 TotalFlow(self.selenium).certificates_flow(self.review_manager, self.customer_name) status3 = LoanList(self.selenium).get_loan_status(self.customer_name) self.assertEqual(status3, u'审批中') Index(self.selenium).click_user_list().click_user_quit() # 信审专员审核 TotalFlow(self.selenium).risk_management_submit_audit( credit_person_login_name, self.customer_name, self.pass_status) Index(self.selenium).click_user_list().click_user_quit() # 信审主管审核 TotalFlow(self.selenium).manager_contract_form(self.manager_login_name, self.customer_name, self.approved_product, self.pass_status) status2 = HistoricalList(self.selenium).get_loan_status( self.customer_name, self.manager_login_name) self.assertEqual(status2, u'待签约') approved_product = HistoricalList(self.selenium).get_approved_product( self.customer_name, self.manager_login_name) self.assertEqual(approved_product, u'公积金类') Index(self.selenium).click_user_list().click_user_quit() # 风控专员提交合同 TotalFlow(self.selenium).submit_sign_page(self.risk_management, self.customer_name, self.bank_number) status3 = LoanList(self.selenium).get_loan_status(self.customer_name) self.assertEqual(status3, u'合同审核中') approved_product1 = LoanList(self.selenium).get_approved_product( self.customer_name) self.assertEqual(approved_product1, u'公积金类') Index(self.selenium).click_user_list().click_user_quit() # 合同专员审核 TotalFlow(self.selenium).loan_sign_page(self.loan_manager, self.customer_name) status4 = ContractList(self.selenium).get_loan_status( self.customer_name) self.assertEqual(status4, u'放款中') Index(self.selenium).click_user_list().click_user_quit() # 上标专员审核 TotalFlow(self.selenium).super_script_flow(self.super_script_manager, self.customer_name, self.project_number) Index(self.selenium).click_user_list().click_user_quit() # 合同专员放款 TotalFlow(self.selenium).make_loan_sign_page(self.loan_manager, self.customer_name) status6 = ContractList(self.selenium).get_loan_status( self.customer_name) self.assertEqual(status6, u'已放款') Index(self.selenium).click_user_list().click_user_quit()
def setup_class(self): self.dx = Index()
def test_loan_status(self): '''信审专员拒绝''' # 新建客户 TotalFlow(self.selenium).risk_management_new_customer(self.risk_management, self.customer_name, self.card_no, self.mobile) Index(self.selenium).click_user_list().click_user_quit() # 风控专员审核 TotalFlow(self.selenium).risk_management_submit(self.risk_management, self.customer_name) Index(self.selenium).click_user_list().click_user_quit() # 信审经理审核 TotalFlow(self.selenium).judge_manager_allocation_role(self.judge_manager, self.customer_name) status1 = CreditAuditLoanList(self.selenium).get_loan_status(self.customer_name, self.judge_manager) self.assertEqual(status1, u'审批中') Index(self.selenium).click_user_list().click_user_quit() # 信审专员审核驳回 TotalFlow(self.selenium).risk_management_other(self.credit_person, self.customer_name) Index(self.selenium).click_user_list().click_user_quit() TotalFlow(self.selenium).risk_management_submit_audit(self.credit_person, self.customer_name, self.reject_status) status2 = HistoricalList(self.selenium).get_loan_status(self.customer_name, self.credit_person) self.assertEqual(status2, u'补充资料') Index(self.selenium).click_user_list().click_user_quit() # 风控专员审核 TotalFlow(self.selenium).risk_management_submit(self.risk_management, self.customer_name) Index(self.selenium).click_user_list().click_user_quit() # 信审专员审核通过 TotalFlow(self.selenium).risk_management_submit_audit(self.credit_person, self.customer_name, self.pass_status) status2 = HistoricalList(self.selenium).get_loan_status(self.customer_name, self.credit_person) self.assertEqual(status2, u'复核中') Index(self.selenium).click_user_list().click_user_quit() # 信审主管审核驳回到信审专员 TotalFlow(self.selenium).manager_contract_form(self.manager_login_name, self.customer_name, self.approved_product, self.pass_status) status2 = HistoricalList(self.selenium).get_loan_status(self.customer_name, self.manager_login_name) self.assertEqual(status2, u'待签约') approved_product = HistoricalList(self.selenium).get_approved_product(self.customer_name, self.manager_login_name) self.assertEqual(approved_product, u'公积金类') Index(self.selenium).click_user_list().click_user_quit() # 风控专员提交合同 TotalFlow(self.selenium).submit_sign_page(self.risk_management, self.customer_name, self.bank_number) status3 = LoanList(self.selenium).get_loan_status(self.customer_name) self.assertEqual(status3, u'合同审核中') approved_product1 = LoanList(self.selenium).get_approved_product(self.customer_name) self.assertEqual(approved_product1, u'公积金类') Index(self.selenium).click_user_list().click_user_quit() # 合同专员审核 TotalFlow(self.selenium).loan_sign_page(self.loan_manager, self.customer_name) status4 = ContractList(self.selenium).get_loan_status(self.customer_name) self.assertEqual(status4, u'放款中') Index(self.selenium).click_user_list().click_user_quit() # 上标专员审核 TotalFlow(self.selenium).super_script_flow(self.super_script_manager, self.customer_name, self.project_number) Index(self.selenium).click_user_list().click_user_quit() # 合同专员放款 TotalFlow(self.selenium).make_loan_sign_page(self.loan_manager, self.customer_name) status6 = ContractList(self.selenium).get_loan_status(self.customer_name) self.assertEqual(status6, u'已放款') Index(self.selenium).click_user_list().click_user_quit()
def goto_index(self): ''' 打開首頁 :return: ''' return Index(self._driver)
def test(self): """这是一个测试xmind的用例""" Index(self.driver).search_dragonball_super() self.assertEqual("龙珠超 - 国内版 Bing", self.driver.title, "bing搜索'龙珠超'后页面标题与预期不符")
def test_if_login(self): TestPage(self.selenium).console_login(self.login_name, self.password) NewStaff(self.selenium).staff_flow(self.new_login_name, self.password).if_login('0').click_save_button() Index(self.selenium).click_user_list().click_user_quit() message = TestPage(self.selenium).console_login(self.new_login_name, self.password).get_login_error() self.assertEqual(message, u'该已帐号禁止登录.')
def test_login_quit(self): TestPage(self.selenium).console_login(self.user_name, self.password) Index(self.selenium).click_user_list().click_user_quit()
def setup(self): self.a1 = Index()
def login(self): self.driver.get("https://work.weixin.qq.com/wework_admin/frame#index") return Index()