Пример #1
0
 def __init__(self, driver):
     self.mine_page = MinePage(driver)
     self.change_page = ChangePage(driver)
     self.common_page = CommonPage(driver)
     self.unionpay_page = UnionPayPage(driver)
     self.common_flow = CommonFlow(driver)
     self.setting_flow = SettingFlow(driver)
Пример #2
0
class MineFlow(object):

    def __init__(self, driver):
        self.mine_page = MinePage(driver)
        self.common_page = CommonPage(driver)

    @allure.story("遍历我的页面入口")
    def traverse_mine_page(self):
        self.mine_page.click_mine_tab()
        self.mine_page.click_account_number()
        self.mine_page.assert_text_exist("信息")
        self.mine_page.press_key("back")
        self.mine_page.click_sign_in()
        if self.mine_page.check_text_existance("签到成功"):
            self.mine_page.click_close()
        self.mine_page.assert_text_exist("已签")
        self.mine_page.swipe_screen("up")
        self.common_page.click_back_arrow()
        self.mine_page.assert_text_exist("已签")
        self.mine_page.click_red_envelope()
        self.mine_page.assert_text_exist("总计")
        self.common_page.click_back_arrow()
        self.mine_page.click_coupon()
        self.mine_page.assert_text_exist("活动")
        self.common_page.click_back_arrow()
        self.mine_page.click_integration()
        self.mine_page.assert_text_exist("积分明细")
        self.common_page.click_back_arrow()
        self.mine_page.click_eye()
        self.mine_page.assert_text_exist("****")
        self.mine_page.click_my_protection()
        # self.mine_page.assert_text_exist("保单")
        self.common_page.click_back_arrow()
        self.mine_page.click_my_loan()
        self.mine_page.assert_text_exist("额度")
        self.common_page.click_back_arrow()
Пример #3
0
 def __init__(self, driver):
     self.mine_page = MinePage(driver)
     self.common_page = CommonPage(driver)
class UnionPayFlow(object):
    def __init__(self, driver):
        self.home_page = HomePage(driver)
        self.unionpay_page = UnionPayPage(driver)
        self.common_page = CommonPage(driver)
        self.common_flow = CommonFlow(driver)

    @allure.story("进入添加银行卡页操作")
    def goto_add_card_page(self, scene):
        if scene == 1:
            # 付款码---立即开通
            self.home_page.click_payment_code()
            self.unionpay_page.click_acticate_now()
        elif scene == 2:
            # OPPO Pay---添加卡
            self.home_page.click_oppo_pay()
            self.common_page.click_add_card()
        elif scene == 3:
            # 卡包---添加卡(+)---添加银行卡
            self.home_page.click_card_package()
            self.home_page.click_add()
            self.home_page.click_add_bank_card()

    @allure.story("借记卡要素填写操作")
    def fill_in_debit_card_info(self, support_nfc, **kwargs):
        """ 填写借记卡信息并进行绑卡 """
        self.unionpay_page.input_bank_card_number(kwargs["bank_card_number"])
        self.unionpay_page.click_next_button()
        if support_nfc is True:
            self.unionpay_page.input_mobile_number(kwargs["mobile_number"])
            self.unionpay_page.input_bank_password(kwargs["bank_password"])
        else:
            # todo 非NFC绑卡流程,姓名、身份证、手机号、验证码
            pass
        self.unionpay_page.click_bind_card_button()
        self.unionpay_page.wait_add_bank_card_process()

    @allure.story("信用卡要素填写操作")
    def fill_in_credit_card_info(self, support_nfc, **kwargs):
        """ 填写信用卡信息并进行绑卡 """
        self.unionpay_page.input_bank_card_number(kwargs["bank_card_number"])
        self.unionpay_page.click_next_button()
        self.unionpay_page.input_mobile_number(kwargs["mobile_number"])
        self.unionpay_page.input_expire_date(kwargs["expire_date"])
        self.unionpay_page.input_cvn2(kwargs["cvn2"])
        if support_nfc is False:
            # todo 非NFC绑卡流程,验证码
            pass
        self.unionpay_page.click_bind_card_button()
        self.unionpay_page.wait_add_bank_card_process()

    @allure.story("安全信息填写操作")
    def fill_in_safety_info(self, scene, support_nfc, **kwargs):
        """ 输入验证码、密码、密保并完成 """
        if support_nfc is True:
            self.common_flow.copy_verification_code_from_notification()
            self.unionpay_page.long_click_verification_code_box()
            self.common_page.click_paste()
            self.unionpay_page.click_next_button()
        if scene == 1:
            # 账户未设置密码时
            self.common_page.input_wallet_password(kwargs["wallet_password"])
            self.common_page.input_wallet_password(kwargs["wallet_password"])
            self.unionpay_page.click_security_question()
            self.unionpay_page.click_specific_security_question(
                kwargs["security_question"])
            self.unionpay_page.input_security_answer(kwargs["security_answer"])
            self.unionpay_page.click_next_button()
        self.unionpay_page.click_next_time()

    @allure.story("遍历卡详情页")
    def traverse_card_detail(self, support_nfc):
        if support_nfc is True:
            self.home_page.click_oppo_pay()
            self.common_page.click_close()
            self.common_page.click_card_detail()
        else:
            # todo 非NFC的进入到卡详情操作
            pass
        self.unionpay_page.click_transaction_record()
        self.common_page.click_back_arrow()
        self.unionpay_page.check_device_card_number()
        self.unionpay_page.click_service_hotline()
        self.unionpay_page.press_key("back")
        self.common_page.click_back_arrow()

    @allure.story("关闭和开启付款码")
    def turn_off_and_on_payment_code(self, **kwargs):
        self.home_page.click_payment_code()
        self.unionpay_page.click_barcode()
        self.unionpay_page.click_big_barcode()
        self.unionpay_page.click_qrcode()
        self.unionpay_page.click_big_qrcode()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("暂停使用")
        self.common_page.click_button1("暂停使用")
        self.unionpay_page.click_turn_on()
        self.common_page.input_wallet_password(kwargs["wallet_password"])
        self.unionpay_page.check_payment_code_state()

    @allure.story("扫一扫支付流程")
    def scan_payment(self, **kwargs):
        self.home_page.click_scan_it()
        self.unionpay_page.click_flashlight()
        self.unionpay_page.click_flashlight()
        self.unionpay_page.click_photo_album()
        self.unionpay_page.click_qrcode_photo()
        self.unionpay_page.input_payment_amount(kwargs["payment_amount"])
        self.oppo_pay_online_payment(**kwargs)

    @allure.story("OPPO Pay线上支付流程")
    def oppo_pay_online_payment(self, **kwargs):
        self.unionpay_page.click_confirm_payment()
        self.common_page.input_wallet_password(kwargs["wallet_password"])
        self.unionpay_page.click_done()

    @allure.story("删除银行卡流程")
    def delete_bank_card(self):
        self.home_page.click_card_package()
        self.home_page.click_first_bank_card()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("删除银行卡")
        self.common_page.click_button3("删除银行卡")
        self.unionpay_page.wait_delete_bank_card_process()
        self.home_page.check_on_card_package_page()
 def __init__(self, driver):
     self.home_page = HomePage(driver)
     self.unionpay_page = UnionPayPage(driver)
     self.common_page = CommonPage(driver)
     self.common_flow = CommonFlow(driver)
Пример #6
0
class EIDFlow(object):
    def __init__(self, driver):
        self.eid_page = EIDPage(driver)
        self.home_page = HomePage(driver)
        self.common_page = CommonPage(driver)
        self.unionpay_page = UnionPayPage(driver)

    @allure.story("添加eID操作")
    def open_eid_card(self, scene, **kwargs):
        self.home_page.click_card_package()
        self.home_page.click_add()
        self.home_page.click_add_eID()
        self.eid_page.click_common_problem()
        self.eid_page.scroll_to_boundary("end")
        self.common_page.click_back_arrow()
        self.eid_page.click_activate_now()
        # self.common_page.click_button1("同意")  # 弹出检测会自动点掉
        self.eid_page.sleep(1.0)
        if scene == 1:
            # 未设置密码密保
            self.common_page.input_wallet_password2(kwargs["wallet_password"])
            self.common_page.input_wallet_password2(kwargs["wallet_password"])
            self.unionpay_page.click_security_question()
            self.unionpay_page.click_specific_security_question(
                kwargs["security_question"])
            self.unionpay_page.input_security_answer(kwargs["security_answer"])
            self.unionpay_page.click_next_button()
        elif scene == 2:
            # 已设置密码密保
            self.common_page.input_wallet_password(kwargs["wallet_password"])
        box('嗨!\n请用身份证靠近测试机NFC区域\n点击准备好了再贴卡哈')
        self.eid_page.IDCard_recognition()
        box('嗨!\n请进行人脸识别\n点击准备好了再让脸进入识别框里哈')
        self.eid_page.face_recognition()
        self.eid_page.wait_verify_identity_information()
        self.eid_page.wait_write_in_eID_card_process()
        if self.eid_page.check_text_existance("开卡成功"):
            self.eid_page.click_finish()
            self.eid_page.assert_text_exist("卡包")
        else:
            self.eid_page.assert_text_exist("姓名:")
            self.eid_page.assert_text_exist("公民身份号码:")

    @allure.story("遍历我的eID页面操作")
    def traverse_my_eid_card(self, **kwargs):
        self.home_page.click_card_package()
        self.home_page.click_eID()
        self.eid_page.click_eye_switch()
        self.common_page.input_wallet_password(kwargs["wallet_password"])
        self.eid_page.assert_text_exist("姓名:")
        self.eid_page.assert_text_exist("公民身份号码:")
        self.eid_page.click_eID_license()
        self.common_page.input_wallet_password(kwargs["wallet_password"])
        self.eid_page.assert_text_exist("点击收起")
        self.unionpay_page.click_qrcode()
        self.unionpay_page.click_big_qrcode()
        self.common_page.click_pack_up()
        self.common_page.click_unfold_qrcode()
        self.common_page.click_card_detail()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("常见问题")
        self.eid_page.scroll_to_boundary("end")
        self.eid_page.scroll_to_boundary("beginning")
        self.common_page.click_back_arrow()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("用户协议")
        self.eid_page.scroll_to_boundary("end")
        self.eid_page.scroll_to_boundary("beginning")
        self.common_page.click_back_arrow()
        assert self.eid_page.check_text_existance(
            "姓名:") is False, "用户二要素敏感信息未遮挡"
        self.common_page.click_back_arrow()
        self.eid_page.assert_text_exist("卡包")

    @allure.story("删除eID操作")
    def delete_eid_card(self):
        self.home_page.click_card_package()
        self.home_page.click_eID()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("注销")
        self.common_page.click_button1("注销")
        self.common_page.wait_loading()
        self.eid_page.assert_text_exist("开通 eID")
Пример #7
0
class ChangeFlow(object):

    def __init__(self, driver):
        self.mine_page = MinePage(driver)
        self.change_page = ChangePage(driver)
        self.common_page = CommonPage(driver)
        self.unionpay_page = UnionPayPage(driver)
        self.common_flow = CommonFlow(driver)
        self.setting_flow = SettingFlow(driver)

    @allure.story("进入零钱")
    def goto_change_page(self):
        self.mine_page.click_mine_tab()
        self.mine_page.click_my_assets()
        self.mine_page.click_change()

    @allure.story("开通三类户操作")
    def open_change_account(self, scene, support_nfc: bool, **kwargs):
        self.change_page.click_acticate_now()
        if self.change_page.assert_text_exist("实名认证"):
            self.setting_flow.real_name_verification(**kwargs)
            self.common_page.input_wallet_password_h5(kwargs["wallet_password"])
            self.common_page.input_wallet_password_h5(kwargs["wallet_password"])
        self.change_page.click_take_photo()
        self.change_page.press_key("back")
        self.change_page.click_supported_bank()
        self.common_page.click_back_arrow()
        self.change_page.input_bank_card_number(kwargs["bank_card_number"])
        self.change_page.click_next_step()
        self.change_page.input_mobile_number(kwargs["mobile_number"])
        self.change_page.click_profession()
        self.change_page.click_profession_group(kwargs["profession_group"])
        self.change_page.click_profession_item(kwargs["profession_item"])
        self.change_page.click_protocol_check_box()
        self.change_page.click_next_step()
        if scene == 1:
            # 生产环境
            self.change_page.click_start_verification()
            box('嗨!\n请进行人脸识别\n点击准备好了再让脸进入识别框里哈')
            self.change_page.face_recognition()
            self.common_flow.copy_verification_code_from_notification()
            self.change_page.long_click_verification_code_box()
            self.common_page.click_paste()
        elif scene == 2:
            # 测试环境
            self.change_page.input_verify_code(kwargs["verify_code"])
        self.change_page.click_next_step()
        if support_nfc is True:
            self.common_page.wait_loading()
            if self.change_page.check_text_existance("重试"):
                self.common_page.click_back_arrow()
            else:
                self.unionpay_page.wait_add_bank_card_process()
        self.change_page.assert_text_exist("充值")

    @allure.story('充值操作')
    def change_recharge(self, **kwargs):
        self.change_page.click_recharge()
        self.change_page.input_amount(kwargs["amount"])
        self.change_page.click_recharge_or_withdraw_now()
        if self.change_page.check_text_existance("首次充值需要填写验证码"):
            verify_code = "123521"  # todo 通过OCR识别获取验证码后输入到这里
            self.common_page.input_wallet_password(verify_code)
        self.common_page.input_wallet_password2(kwargs["wallet_password"])
        self.common_page.wait_loading()
        self.change_page.assert_text_exist("充值成功")
        self.change_page.click_complete()

    @allure.story('提现操作')
    def change_withdraw(self, **kwargs):
        self.change_page.click_withdraw()
        self.change_page.input_amount(kwargs["amount"])
        self.change_page.click_recharge_or_withdraw_now()
        self.common_page.input_wallet_password2(kwargs["wallet_password"])
        self.common_page.wait_loading()
        self.change_page.assert_text_exist("提现成功")
        self.change_page.click_complete()

    @allure.story('遍历零钱信息页面操作')
    def traverse_change_detail(self):
        self.change_page.click_change_details()
        if self.change_page.check_text_existance("提现"):
            self.change_page.click_withdraw_h5()
            self.change_page.assert_text_exist("提现成功")
            self.common_page.click_back_arrow()
        if self.change_page.check_text_existance("充值"):
            self.change_page.click_recharge_h5()
            self.change_page.assert_text_exist("充值成功")
            self.common_page.click_back_arrow()
        self.common_page.click_back_arrow()
        self.change_page.click_change_card_package()
        self.change_page.click_first_bank_card()
        self.change_page.assert_text_exist("每日消费限额")
        self.common_page.click_back_arrow()
        self.common_page.click_back_arrow()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("关于零钱")
        self.change_page.assert_text_exist("电子账户号")
        self.change_page.click_bound_phone_number()
        self.change_page.click_change_phone_number()
        self.change_page.assert_text_exist("添加银行卡")
        self.common_page.click_back_arrow()
        self.common_page.click_back_arrow()
        self.change_page.assert_text_exist("零钱")

    @allure.story('提升限额操作')
    def increase_limit(self, **kwargs):
        self.change_page.click_increase_limit()
        box('嗨!\n请进行身份证扫描\n点击准备好了再扫描哈')
        self.change_page.wait_scan_front_process()
        self.change_page.wait_scan_back_process()
        self.change_page.click_confirmed()
        self.change_page.assert_text_exist("请先编辑住址")
        self.change_page.click_edit_address()
        self.change_page.click_province_city_district()
        self.change_page.click_province(kwargs["province"])
        self.change_page.click_city(kwargs["city"])
        self.change_page.click_district(kwargs["district"])
        self.change_page.input_address(kwargs["address"])
        self.change_page.click_save()
        self.change_page.click_confirmed()
        self.change_page.wait_loading()
        assert self.change_page.check_text_existance("提升限额") is False, "提升限额入口依然存在"
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("关于零钱")
        self.change_page.assert_text_exist("二类户")

    @allure.story("再次绑卡操作")
    def bind_another_bank_card(self, scene, **kwargs):
        self.change_page.click_change_card_package()
        assert self.change_page.bank_card_number() == 1, "零钱卡包绑定了超过1张银行卡"
        self.change_page.click_add_card()
        self.change_page.click_take_photo_h5()
        self.change_page.press_key("back")
        self.change_page.click_supported_bank_h5()
        self.common_page.click_back_arrow()
        self.change_page.input_bank_card_number_h5(kwargs["bank_card_number"])
        self.change_page.click_next_step_h5()
        self.change_page.input_mobile_number_h5(kwargs["mobile_number"])
        self.change_page.click_cgb_account_agreement()
        self.change_page.scroll_to_boundary("end")
        self.change_page.assert_text_exist("其他")
        self.common_page.click_back_arrow()
        self.change_page.click_next_step_h5()
        if scene == 1:
            # 生产环境
            self.common_flow.copy_verification_code_from_notification()
            self.change_page.long_click_verification_code_box_h5()
            self.common_page.click_paste()
        elif scene == 2:
            # 测试环境
            self.change_page.input_verify_code_h5(kwargs["verify_code"])
        self.change_page.click_next_step_h5()
        assert self.change_page.bank_card_number() == 2, "零钱卡包期望有2张银行卡"
        self.common_page.click_back_arrow()
        self.change_page.assert_text_exist("零钱")

    @allure.story('删除绑卡操作')
    def delete_bound_card(self):
        self.change_page.click_change_card_package()
        self.change_page.click_first_bank_card()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("删除")
        self.common_page.click_button3("删除")
        if self.change_page.check_text_existance("卡片详情"):
            self.common_page.click_back_arrow()
        self.change_page.assert_text_exist("零钱绑定卡")
        assert self.change_page.bank_card_number() == 1, "零钱卡包还剩2张绑定卡,期望1张"
        self.common_page.click_back_arrow()
        self.change_page.assert_text_exist("零钱")

    @allure.story('注销零钱操作')
    def cancel_change_account(self, **kwargs):
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("关于")
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("注销")
        if self.change_page.check_text_existance("解绑"):
            self.change_page.click_unbind()
            self.common_page.wait_loading()
        self.change_page.click_next()
        self.common_page.input_wallet_password(kwargs["wallet_password"])
        box('嗨!\n请进行人脸识别\n点击准备好了再让脸进入识别框里哈')
        self.change_page.face_recognition()
        self.change_page.wait_cancel_account_process()
        self.change_page.assert_text_exist("注销完成")
        self.change_page.click_complete()
        self.mine_page.assert_text_exist("我的资产")
Пример #8
0
 def __init__(self, driver):
     self.key_page = KeyPage(driver)
     self.home_page = HomePage(driver)
     self.common_page = CommonPage(driver)
     self.setting_page = SettingPage(driver)
     self.setting_flow = SettingFlow(driver)
Пример #9
0
 def __init__(self, driver):
     self.eid_page = EIDPage(driver)
     self.home_page = HomePage(driver)
     self.common_page = CommonPage(driver)
     self.unionpay_page = UnionPayPage(driver)
Пример #10
0
class KeyFlow(object):
    def __init__(self, driver):
        self.key_page = KeyPage(driver)
        self.home_page = HomePage(driver)
        self.common_page = CommonPage(driver)
        self.setting_page = SettingPage(driver)
        self.setting_flow = SettingFlow(driver)

    @allure.story("进入添加门禁卡页操作")
    def goto_add_card_page(self, scene):
        if scene == 1:
            # 去开门---立即开通
            self.home_page.click_go_open_door()
        elif scene == 2:
            # 去开门---添加卡
            self.home_page.click_go_open_door()
            self.common_page.click_add_card()
        elif scene == 3:
            # 卡包---添加卡(+)---添加门禁卡
            self.home_page.click_card_package()
            self.home_page.click_add()
            self.home_page.click_add_key()

    @allure.story("添加实体门禁卡操作")
    def open_physical_access_card(self, **kwargs):
        self.key_page.click_physical_access_card()

        self.key_page.click_add_access_card()
        box('嗨!\n请用实体门禁卡靠近测试机NFC区域\n点击准备好了再贴卡哈')
        self.key_page.sense_access_card()
        if self.setting_page.check_text_existance("姓名和身份证号码"):
            self.setting_flow.real_name_verification(**kwargs)
            self.setting_page.press_key("back")
            box('嗨!\n请用实体门禁卡靠近测试机NFC区域\n点击准备好了再贴卡哈')
            self.key_page.sense_access_card()
        self.key_page.wait_import_access_card_process()
        self.key_page.click_save()
        self.key_page.assert_text_exist("靠近读卡器")

    @allure.story("生成空白卡操作")
    def open_manual_access_card(self):
        self.key_page.click_manual_access_card()
        self.key_page.click_add_access_card()
        self.key_page.wait_create_white_card_process()
        self.key_page.scroll_to_boundary()
        self.key_page.click_write_in_now()
        self.key_page.sleep(3.0)
        self.key_page.click_unrecognized_device()
        self.key_page.scroll_to_boundary()
        self.key_page.click_finish_on_tips_page()
        self.key_page.sleep(2.0)
        self.common_page.click_back_arrow()
        self.key_page.click_write_in_later()

    @allure.story("编辑门禁卡操作")
    def edit_access_card(self, **kwargs):
        self.home_page.click_go_open_door()
        self.common_page.click_card_detail()
        self.key_page.click_card_name()
        self.key_page.input_card_name(kwargs["card_name"])
        self.key_page.click_save()
        self.key_page.click_display_switch()
        self.key_page.click_card_cover_style()
        self.key_page.click_random_cover()
        self.key_page.scroll_until_element_appear(textContains="自定义")
        self.key_page.click_random_cover()
        self.key_page.click_custom_cover()
        self.key_page.click_first_picture()
        self.key_page.click_save_picture()
        self.key_page.click_save_cover()
        self.key_page.sleep(4.0)
        self.key_page.click_card_tips()
        self.key_page.click_finish_on_tips_page()
        self.key_page.press_key("back")
        self.home_page.assert_text_exist("卡包")

    @allure.story("门禁卡迁卡操作")
    def access_card_transfer_operation(self, **kwargs):
        self.key_page.click_physical_access_card()
        self.key_page.click_Access_card_1()
        self.key_page.click_Move_in_to_this_machine()
        self.key_page.wait_Moving_in_card()
        self.key_page.click_carry_out()

    @allure.story("删除门禁卡操作")
    def delete_access_card(self, **kwargs):
        self.home_page.click_go_open_door()
        self.common_page.click_card_detail()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("删除")
        self.key_page.click_delete_reason_checkbox()
        #   self.key_page.input_delete_card_reason(kwargs["delete_reason"])
        self.key_page.click_confirm_delete()
        self.key_page.wait_delete_process()

    #  self.key_page.assert_text_exist("选择开通类型")

    @allure.story("删除空白卡操作")
    def delete_blank_card(self):
        self.home_page.click_card_package()
        self.home_page.scroll_until_element_appear(textContains="待录入")
        self.home_page.click_write_in_of_blank_card()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("删除")
        self.common_page.click_button1("删除")
        self.key_page.wait_delete_process()
        assert not self.key_page.check_text_existance("待录入")
Пример #11
0
class SettingFlow(object):
    def __init__(self, driver):
        self.setting_page = SettingPage(driver)
        self.common_page = CommonPage(driver)
        self.home_page = HomePage(driver)
        self.mine_page = MinePage(driver)
        self.common_flow = CommonFlow(driver)

    def goto_setting_page(self):
        self.mine_page.click_mine_tab()
        self.mine_page.click_setting()

    @allure.story("实名认证操作")
    def real_name_verification(self, scene=1, **kwargs):
        if scene == 2:
            # 设置入口
            self.setting_page.click_real_name_verification()
        self.setting_page.click_username()
        # self.setting_page.input_username(kwargs["username"])
        # self.setting_page.input_identification_number(kwargs["username"])    # 输入身份证

        self.setting_page.click_next_step()
        self.common_flow.copy_verification_code_from_notification()
        self.setting_page.long_click_verification_code_box()
        self.common_page.click_paste()
        self.setting_page.click_finish()
        # 点完成按钮后会跳转到认证信息页
        self.setting_page.check_on_certification_information_page()

    @allure.story("双击唤醒开关操作")
    def double_tap_power_switch(self):
        self.common_page.double_click_power_key()
        self.common_page.assert_text_exist("靠近读卡器")
        self.common_page.click_exit()
        self.setting_page.click_double_tap_power_switch()
        self.common_page.double_click_power_key()
        self.common_page.swipe_screen("up")
        self.setting_page.assert_text_exist("设置")
        self.setting_page.click_double_tap_power_switch()

    @allure.story("自动切卡操作")
    def auto_switch_card(self):
        self.setting_page.click_auto_switch()
        self.setting_page.click_auto_switch_switch()
        self.setting_page.click_loop_switch()
        self.setting_page.swipe_screen("up")
        self.setting_page.assert_text_exist("选择要切换的")
        self.setting_page.click_smart_switch()
        assert self.setting_page.check_text_existance(
            "选择要切换的") is False, "列表未收起"
        self.setting_page.click_loop_switch()
        self.setting_page.click_door_card()
        self.setting_page.click_specified_card(index=0)
        self.setting_page.click_dont_choose()
        self.setting_page.assert_text_exist("请选择")
        self.setting_page.click_door_card()
        self.setting_page.click_specified_card(index=0)
        self.setting_page.click_done()
        assert self.setting_page.check_text_existance(
            "请选择") is False, "未选择到指定的卡"

    @allure.story("一键修复操作")
    def one_click_repair(self):
        self.setting_page.click_one_click_repair()
        self.setting_page.click_start_repair()
        self.setting_page.assert_text_exist("未发现问题")
        self.setting_page.click_help_feedback()
        if self.setting_page.check_text_existance("加载中"):
            self.setting_page.wait_loading()
        self.setting_page.assert_text_exist("全部问题")
        self.setting_page.press_key("back")
        self.setting_page.click_complete()
        self.setting_page.assert_text_exist("设置")

    @allure.story("更改支付密码操作")
    def change_wallet_password(self, **kwargs):
        self.setting_page.click_password_setting()
        self.setting_page.click_change_password()
        self.common_page.input_wallet_password_h5(kwargs["wallet_password"])
        self.common_page.input_wallet_password_h5(
            kwargs["new_wallet_password"])
        self.common_page.input_wallet_password_h5(
            kwargs["new_wallet_password"])
        assert self.setting_page.get_toast() == "密码修改成功", "密码修改toast提示异常"
        self.setting_page.assert_text_exist("更改支付密码")

    @allure.story("忘记支付密码操作")
    def forget_wallet_password(self, scene, **kwargs):
        self.setting_page.click_password_setting()
        self.setting_page.click_forget_password()
        if scene == 1:
            # 通过身份信息找回
            self.setting_page.click_retrieve_through_id_info()
            self.setting_page.input_bank_card_number(
                kwargs["bank_card_number"])
            self.setting_page.input_username2(kwargs["username"])
            self.setting_page.input_identification_number2(
                kwargs["identification_number"])
            self.setting_page.input_mobile_number(kwargs["mobile_number"])
            self.setting_page.click_next()
        elif scene == 2:
            # 通过密保与手机号找回
            self.setting_page.click_retrieve_through_security()
            self.setting_page.click_security_question()
            self.setting_page.input_security_answer(kwargs["security_answer"])
            self.setting_page.click_next()
            self.common_flow.copy_verification_code_from_notification()
            self.setting_page.long_click_verification_code_box()
            self.common_page.click_paste()
            self.setting_page.click_next_step()
        self.common_page.input_wallet_password_h5(
            kwargs["new_wallet_password"])
        self.common_page.input_wallet_password_h5(
            kwargs["new_wallet_password"])
        assert self.setting_page.get_toast() == "密码重置成功", "密码重置toast提示异常"
        self.setting_page.assert_text_exist("更改支付密码")

    @allure.story("重置密保操作")
    def reset_security(self, **kwargs):
        self.setting_page.click_password_setting()
        self.setting_page.click_reset_security()
        self.common_page.input_wallet_password_h5(kwargs["wallet_password"])
        self.setting_page.click_security_question(
            kwargs["new_security_question"])
        self.setting_page.input_security_answer(kwargs["new_security_answer"])
        self.setting_page.click_next()
        self.common_flow.copy_verification_code_from_notification()
        self.setting_page.long_click_verification_code_box()
        self.common_page.click_paste()
        self.setting_page.click_next_step()
        self.setting_page.assert_text_exist("注销")

    @allure.story("关闭服务入口操作")
    def close_function_entry(self, **kwargs):
        self.setting_page.click_service_management()
        self.setting_page.click_function_item()
        for function_name in kwargs["entry_list"]:
            self.setting_page.click_specific_function_item_switch(
                function_name)
            self.common_page.click_button2("关闭")
        for num in range(3):
            self.common_page.click_back_arrow()
        self.home_page.click_home_tab()
        assert self.home_page.check_text_existance(
            "精选专区") is False, "关闭精选专区后依然存在精选专区"
        self.home_page.scroll_to_boundary("end")
        self.home_page.click_open_more_services()
        self.setting_page.click_open_all()
        self.common_page.click_back_arrow()
        self.home_page.assert_text_exist("精选专区")

    @allure.story("协议、声明、版本核查操作")
    def check_protocol_statement_version(self):
        self.setting_page.swipe_screen("up")
        self.setting_page.assert_text_exist("版本号")
        self.setting_page.click_version()
        self.setting_page.click_service_management()
        self.setting_page.click_service_agreement()
        self.setting_page.scroll_to_boundary("end")
        self.common_page.click_back_arrow()
        self.setting_page.click_privacy_statement()
        self.setting_page.scroll_to_boundary("end")
        self.common_page.click_back_arrow()
        self.common_page.click_back_arrow()
        self.setting_page.assert_text_exist("设置")

    @allure.story("注销操作")
    def cancel_wallet_payment_account(self, scene=1, **kwargs):
        if scene == 2:
            # 实名认证入口
            self.setting_page.click_real_name_verification()
        self.setting_page.click_cancel_account()
        self.setting_page.click_confirm_logout()
        self.common_page.input_wallet_password_h5(kwargs["wallet_password"])
        assert self.setting_page.check_text_existance(
            "注销钱包支付账户") is False, "注销入口依然存在,注销失败"
        self.common_page.click_back_arrow()
        self.home_page.click_home_tab()
Пример #12
0
 def __init__(self, driver):
     self.setting_page = SettingPage(driver)
     self.common_page = CommonPage(driver)
     self.home_page = HomePage(driver)
     self.mine_page = MinePage(driver)
     self.common_flow = CommonFlow(driver)
Пример #13
0
class TrafficFlow(object):
    def __init__(self, driver):
        self.home_page = HomePage(driver)
        self.common_page = CommonPage(driver)
        self.traffic_page = TrafficPage(driver)
        self.unionpay_flow = UnionPayFlow(driver)

    @allure.story("进入添加公交卡页操作")
    def goto_add_card_page(self, scene):
        if scene == 1:
            # 去乘车---立即开通
            self.home_page.click_go_by_bus()
            # self.traffic_page.click_add_transit_card()
        elif scene == 2:
            # 去乘车---添加卡
            self.home_page.click_go_by_bus()
            self.common_page.click_add_card()
        elif scene == 3:
            # 卡包---添加卡(+)---添加公交卡
            self.home_page.click_card_package()
            self.home_page.click_add()
            self.home_page.click_add_transit_card()

    @allure.story("添加公交卡操作(通过搜索)")
    def open_transit_card(self, **kwargs):
        self.traffic_page.click_search_for_city_or_transit_card()
        self.traffic_page.input_search_info(kwargs["search_info"])
        self.traffic_page.click_specified_transit_card_by_search(
            kwargs["transit_card_name"])
        self.traffic_page.click_recharge_amount(kwargs["recharge_amount"])
        self.traffic_page.click_open()
        if kwargs["transit_card_name"] == "京津冀互联互通卡":
            # self.traffic_page.input_mobile_number(kwargs["mobile_number"])  # 这里默认会自动填充会员账号的手机号
            self.traffic_page.click_confirm()
        if kwargs["recharge_amount"] != "0":
            self.payment_channel_recharge(**kwargs)
        self.traffic_page.wait_generate_transit_card_process()
        self.traffic_page.click_finish()
        self.traffic_page.assert_text_exist("靠近读卡器")

    @allure.story("充值公交卡操作")
    def recharge_transit_card(self, **kwargs):
        self.home_page.click_go_by_bus()
        self.common_page.click_recharge()
        self.traffic_page.click_recharge_amount(kwargs["recharge_amount"])
        self.traffic_page.click_pay()
        self.payment_channel_recharge(**kwargs)

    @allure.story("支付渠道充值操作")
    def payment_channel_recharge(self, **kwargs):
        self.traffic_page.click_specified_recharge_channel(
            kwargs["recharge_channel"])
        self.traffic_page.click_recharge_button()
        if kwargs["recharge_channel"] == "OPPO Pay":
            self.unionpay_flow.oppo_pay_online_payment(**kwargs)
        elif kwargs["recharge_channel"] == "支付宝":
            pass
            # todo 使用支付宝支付流程,需要写在ThirdPartyFlow中
        elif kwargs["recharge_channel"] == "微信":
            pass
            # todo 使用微信支付流程,需要写在ThirdPartyFlow中

    @allure.story("遍历卡片详情页")
    def traverse_card_detail(self):
        self.home_page.click_go_by_bus()
        self.common_page.click_card_detail()
        self.traffic_page.click_card_info()
        self.traffic_page.assert_text_exist("卡号")
        self.common_page.click_back_arrow()
        self.traffic_page.click_transaction_record()
        self.traffic_page.assert_text_exist("无消费记录")
        self.traffic_page.swipe_screen("left")
        self.traffic_page.sleep(1.5)
        self.traffic_page.assert_text_exist("无充值记录")
        self.common_page.click_back_arrow()
        self.traffic_page.click_swipe_card()
        self.common_page.click_card_detail()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("问题帮助")
        self.traffic_page.assert_text_exist("公交卡刷卡失败怎么办?")
        self.traffic_page.swipe_screen("left")
        self.traffic_page.swipe_screen("left")
        self.traffic_page.swipe_screen("right")
        self.common_page.click_back_arrow()
        self.traffic_page.click_recharge()
        self.traffic_page.assert_text_exist("选择充值金额")
        self.traffic_page.click_cancel()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("用户协议")
        self.traffic_page.scroll_to_boundary("end")
        self.traffic_page.scroll_to_boundary("beginning")
        self.traffic_page.click_done()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("切卡设置")
        self.traffic_page.assert_text_exist("公交")
        self.common_page.click_back_arrow()
        self.common_page.click_back_arrow()
        self.common_page.click_exit()
        self.home_page.assert_text_exist("去乘车")

    @allure.story("迁出公交卡操作")
    def shift_out_transit_card(self, **kwargs):
        self.home_page.click_go_by_bus()
        self.common_page.click_card_detail()
        self.traffic_page.click_migrate_transit_card()
        self.traffic_page.scroll_to_boundary("end")
        self.traffic_page.click_start_migrate()
        self.traffic_page.input_activate_card_mobile_number(
            kwargs["mobile_number"])
        self.traffic_page.click_submit()
        self.traffic_page.wait_shift_out_transit_card_process()
        self.traffic_page.assert_text_exist("迁出完成")
        self.traffic_page.click_shift_out_finish()

    #   self.traffic_page.assert_text_exist("卡包")

    @allure.story("迁入公交卡操作")
    def shift_in_transit_card(self, scene, **kwargs):
        self.home_page.click_go_by_bus()
        self.traffic_page.click_transferable_transit_card()
        self.traffic_page.click_shift_in_this_device()
        self.traffic_page.input_mobile_number2(kwargs["mobile_number"])
        self.traffic_page.click_open()
        # self.traffic_page.click_continue()  # 弹窗检测会点
        self.traffic_page.wait_shift_in_transit_card_process()
        if scene == 1:
            # 从卡包迁卡
            self.traffic_page.assert_text_exist("迁入成功")
            self.traffic_page.click_shift_in_finish()
            self.traffic_page.assert_text_exist("卡包")
        elif scene == 2:
            # 从去乘车迁卡
            self.traffic_page.assert_text_exist("公交")
            self.common_page.click_exit()
            self.traffic_page.assert_text_exist("首页")

    @allure.story("删除公交卡操作")
    def delete_transit_card(self, **kwargs):
        self.home_page.click_go_by_bus()
        self.common_page.click_card_detail()
        self.common_page.click_more_options()
        self.common_page.click_popup_list_item("删卡")
        self.traffic_page.sleep(10)
        self.traffic_page.click_continue_deleting_card()
        self.common_page.click_button1("继续删除")
        # self.traffic_page.input_delete_card_mobile_number(kwargs["mobile_number"])
        self.traffic_page.click_delete_reason_checkbox()
        self.traffic_page.swipe_screen("up")
        # self.traffic_page.click_other_reason_checkbox()
        # self.traffic_page.input_delete_card_reason(kwargs["delete_reason"])
        self.traffic_page.click_continue_deleting_card()
        self.common_page.click_button1("确认删除")
        self.traffic_page.wait_delete_transit_card_process()
        # assert self.traffic_page.get_toast() == "删除成功", "删除公交卡卡异常"
        self.home_page.assert_text_exist("首页")
Пример #14
0
 def __init__(self, driver):
     self.home_page = HomePage(driver)
     self.common_page = CommonPage(driver)
     self.traffic_page = TrafficPage(driver)
     self.unionpay_flow = UnionPayFlow(driver)