def daily_checkin(self): """ 每日签到 """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去签到").click() if Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"已完成").exists: self.cloud_account_total += 1
def points_details(): """ 检查交易明细 """ Pointer.devices(resourceId="com.x.wallet.debug:id/tv_details").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def invite_friends(): """ 邀请好友""" Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def upper_chain(): """ ICT上链(提现操作) """ Pointer.devices( resourceId="com.x.wallet.debug:id/btn_withdraw").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def daily_checkin(): """ 每日签到 """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去签到").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def play_dapp_1(): """ 首次玩dapp """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去完成").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def first_login(): """ 首次登录 """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去登录").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def check_agreement(): Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_service_aggrement").click() text = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press("back") print(text) return text
def play_token_cat_10(): """ 每日玩10次通证猫转盘 """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去完成", className="android.widget.Button", instance=1).click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.tokencat_page() assert title == "通证猫专区"
def play_lucky_cat_10(): """ 玩10次luckycat """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去完成", className="android.widget.Button", instance=3).click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def export_private_key(password="******"): """ 导出eos钱包私钥 """ Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_manage_wallet").click() Pointer.devices( resourceId="com.x.wallet.debug:id/tv_wallet_name").click() Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_import_private_key").click() Pointer.devices( resourceId="com.x.wallet.debug:id/password_et").send_keys(password) Pointer.devices(resourceId="com.x.wallet.debug:id/confirm_btn").click()
def __init__(self): """ 检测云账户是否登录,如果已经登录云账户,则退出登录 """ Pointer.me_page() if Pointer.devices(text="请登录").exists: Pointer.devices( resourceId="com.x.wallet.debug:id/tv_user_account").click() Pointer.devices( resourceId="com.x.wallet.debug:id/btn_logout").click() Pointer.tokencat_page()
def recommend_tokencat_to_friends(): """ 推荐tokenCat给好友 """ Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_share_app").click() Pointer.devices(text="文件传输助手").click() Pointer.devices(text="分享").click() Pointer.devices(text="返回通证猫开发版").click()
def delete_wallet(password="******"): """ 删除钱包密码 :param password: :return: """ Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_manage_wallet").click() Pointer.devices( resourceId="com.x.wallet.debug:id/tv_wallet_name").click() Pointer.devices( resourceId="com.x.wallet.debug:id/delete_account_tv").click() Pointer.devices( resourceId="com.x.wallet.debug:id/password_et").send_keys(password) Pointer.devices(resourceId="com.x.wallet.debug:id/confirm_btn").click()
def play_dapp_1(): """每日首次玩dapp""" Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去完成").click() if Pointer.devices( resourceId="com.x.wallet.debug:id/tv_no_account").exists: from scr.common.app.me import WalletManager Pointer.devices(text="招财猫 LuckyCat").click() Pointer.devices( resourceId="com.x.wallet.debug:id/btn_sure").click() WalletManager().import_eos_wallet(private_key="siyao") Pointer.devices(resourceId="com.x.wallet.debug:id/btn_sure").click() # 跳转到luckycat assert Pointer.devices(resourceId="com.x.wallet.debug:id/tv_title" ).get_text() == "招财猫 LuckyCat"
def create_wallets(): """ 导入/创建钱包""" Pointer.devices.click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def sharing_information(): """ 每日分享资讯,此处会上拉屏幕 """ Pointer.devices(scrollable=True).scroll(steps=20) time.sleep(3) Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去分享").click() date = Pointer.devices( resourceId="com.x.wallet.debug:id/news_date_tv").get_text() Pointer.tokencat_page() print(date)
def play_token_cat_10(): """ 玩10次tokenCat """ Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去完成", className="android.widget.Button", instance=1).click() assert Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() == "通证猫专区" Pointer.devices( resourceId="com.x.wallet.debug:id/ll_root", className="android.widget.RelativeLayout").click() # 进入通证猫转盘 Pointer.back_home_pages()
def switch(): """ 切换货币单位 """ country_type = ['CHF', 'CNY', 'EUR', 'GBP', 'HKD', 'INR', 'JPY', 'KRW', 'NZD', 'PLN', 'RUB', 'SGD', 'THB', 'USD'] for i in country_type: Pointer.devices.implicitly_wait(3) Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_change_currency_pref").click() if i in ['SGD', 'THB', 'USD']: time.sleep(1) Pointer.devices(scrollable=True).scroll(steps=80) time.sleep(1) Pointer.devices(text=i).click() Pointer.devices.toast.get_message(5.0, default="ERROR")
def points_details(): Pointer.devices(resourceId="com.x.wallet.debug:id/tv_details").click() title = Pointer.devices( resourceID="com.x.wallet.debug:id/tv_title").get_text() assert title == "积分明细"
def __init__(self): import re """ 检测是否已登录云钱包为""" Pointer.me_page() if Pointer.devices(text="请登录").exists: from scr.common.app.me import CloudWallet cloud = CloudWallet() cloud.login() Pointer.tokencat_page() # 获取云账户ICT cloud_account_total = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_total").get_text() self.cloud_account_total = int( re.findall(r"\d+", cloud_account_total)[0]) Pointer.wallet_page() # 获取云钱包ICT self.cloud_wallet_total = Pointer.devices( resourceId="com.x.wallet.debug:id/balance_tv").get_text() Pointer.tokencat_page()
def purchase_record(): Pointer.devices( resourceId="com.x.wallet.debug:id/ccpv_trading_recording").click() tips = Pointer.devices(text="若未收到邀请码,请加客服微信:axhahaxh").get_text() assert tips == "若未收到邀请码,请加客服微信:axhahaxh"
def upper_chain(self, number=1, password="******"): """ 提现操作,包括全部提现以及自定义数量 """ # 验证是否跳转到提现界面 Pointer.devices( resourceId="com.x.wallet.debug:id/btn_withdraw").click() assert Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() == "提现" # 验证全部提现是否正常 Pointer.devices( resourceId="com.x.wallet.debug:id/tv_all_with_draw").click() upper_all = Pointer.devices( resourceId="com.x.wallet.debug:id/et_num").get_text() print(upper_all, self.cloud_account_total) assert int(self.cloud_account_total) == int(upper_all) handling_fee = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_des").get_text() print(handling_fee) # 自定义提现ICT数量 Pointer.devices(resourceId="com.x.wallet.debug:id/et_num").clear_text() Pointer.devices( resourceId="com.x.wallet.debug:id/et_num").send_keys(number) Pointer.devices(resourceId="com.x.wallet.debug:id/btn_logout").click() Pointer.devices( resourceId="com.x.wallet.debug:id/password_et").send_keys(password) Pointer.devices(resourceId="com.x.wallet.debug:id/confirm_btn").click() toast = Pointer.devices.toast.get_message(5) assert toast == "完成"
def banner_img(): Pointer.devices(resourceId="com.x.wallet.debug:id/img").click() title = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_title").get_text() Pointer.devices.press('back') assert title == "登录"
def login( phone_number=13267122772, verification_code=input("verification_code:"), invitation_code=""): """ 登录云钱包 :param phone_number: 手机号(登录所需的账号) :param verification_code: 短信验证码 :param invitation_code: 邀请码,首次使用邀请码可获得额外积分 """ Pointer.me_page() # 进入到me页才能操作 Pointer.devices( resourceId="com.x.wallet.debug:id/tv_user_account").click() Pointer.devices(text="请输入手机号码").set_text(phone_number) Pointer.devices(text="请输入验证码").set_text(verification_code) if invitation_code: Pointer.devices(text='填写好友邀请码领积分').set_text(invitation_code) Pointer.devices.press('back') # 关闭输入键盘的操作 Pointer.devices(resourceId="com.x.wallet.debug:id/checkbox").click() Pointer.devices(resourceId="com.x.wallet.debug:id/btn_login").click()
def sharing_information(): Pointer.devices(scrollable=True).scroll(steps=20) Pointer.devices(resourceId="com.x.wallet.debug:id/btn_go", text=u"去分享").click() Pointer.devices()
def get_ict(): """ 检查ict数量 """ total = Pointer.devices( resourceId="com.x.wallet.debug:id/tv_total").get_text() assert total == "0 ICT"
def recommend_friends_to_earn_points(xml=u"邀请好友赚积分", select="text"): """ 我的界面右上角分享tokenCat """ mode = [ "com.x.wallet.debug:id/tv_friend_wechat", # 微信好友 "com.x.wallet.debug:id/tv_friend_circle", # 朋友圈 "com.x.wallet.debug:id/tv_save_local" # 保存本地 ] for i in mode: if select == "text": Pointer.devices(text=xml).click() else: Pointer.devices(resourceId=xml).click() Pointer.devices(resourceId=i).click() if i == mode[0]: Pointer.devices( resourceId="com.tencent.mm:id/au7").send_keys("文件传输助手") Pointer.devices(resourceId='com.tencent.mm:id/lp').click() Pointer.devices(resourceId="com.tencent.mm:id/an3").click() Pointer.devices(resourceId="com.tencent.mm:id/an2").click() elif i == mode[1]: Pointer.devices(resourceId="com.tencent.mm:id/hg").click() elif i == mode[2]: toast = Pointer.devices.toast.get_message(10) print(toast)
def __init__(self): if Pointer.devices(text="请登录").exists: Pointer.devices(text="云端钱包").click() # 进入 CloudWallet.login() # 如果没有登录,将进行登录 Pointer.wallet_page() # 登录完成后跳转到Wallet_page
def invite_friends(): # 微信好友 Pointer.devices( resourceId="com.x.wallet.debug:id/tv_friend_wechat").click() Pointer.devices(resourceId="com.tencent.mm:id/au7").send_keys("文件传输助手") Pointer.devices(resourceId="com.tencent.mm:id/lp").click() Pointer.devices(resourceId="com.tencent.mm:id/an3").click() Pointer.devices(resourceId="com.tencent.mm:id/an2").click() # 微信朋友圈 Pointer.devices( resourceId="com.x.wallet.debug:id/tv_friend_circle").click() Pointer.devices(resourceId="com.tencent.mm:id/hg").click() # 保存本地 Pointer.devices( resourceId="com.x.wallet.debug:id/tv_save_local").click() msg = Pointer.toast.get_toast(0.5) print(msg)