예제 #1
0
 def test_setting_0001(self, driver, start_stop_app, data, cancel_account2):
     setting_flow = SettingFlow(driver)
     # setting_flow.goto_setting_page()
     setting_flow.real_name_verification(scene=2,
                                         **data["test_setting_0001"])
예제 #2
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("我的资产")
예제 #3
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("待录入")