Esempio n. 1
0
class importWallet_class(unittest.TestCase):
    def setUp(self):
        self.driver = login.login()

    def tearDown(self):
        if self.driver:
            self.driver.quit()

    @ddt.unpack
    @ddt.data(*read_execl.read_excel_list('test_data/walletAddress.xlsx'))
    def test_importWallet(self, wallet, walletName, private_key):
        driver = self.driver
        passwd = int(url['passwd'])
        passwd1 = int(url['passwd1'])

        # print('wallet:',wallet)
        # print('walletName:', walletNane)
        # print(passwd)
        driver = self.driver

        # 管理
        driver.find_element_by_id(url['manage']).click()
        # 钱包管理
        driver.find_element_by_xpath(url['wallet_manage']).click()
        # +钱包
        driver.find_element_by_id(url['add_wallet']).click()
        time.sleep(2)
        # 导入钱包
        driver.find_element_by_id(url['btnImportWallet']).click()
        # 跳过
        driver.find_element_by_id(url['menuSkip']).click()
        nan = '//*[@text="{}"]'.format(wallet)
        try:
            driver.find_element_by_xpath(nan).click()
        except:
            try:
                driver.swipe(0.5, 0.9, 0.5, 0.2, 1000)
            except:
                pass
            driver.find_element_by_xpath(nan).click()

        driver.find_element_by_xpath(url['show_passwd']).click()
        # 输入私钥
        driver.find_element_by_id(url['etWords']).send_keys(private_key)
        if wallet == 'NEO' or wallet == 'NEO(Test)':
            driver.find_element_by_id(url['etPwd']).send_keys(passwd1)
        # 同意协议
        driver.find_element_by_id(url['cbAgreement']).click()
        # 开始导入
        driver.find_element_by_id(url['btnLoad']).click()
        # 热钱包名称
        WebDriverWait(driver,
                      300).until(lambda x: x.find_element_by_id(url['etName']))

        driver.find_element_by_id(url['etName']).send_keys(walletName)
        # 交易密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 复核密码
        driver.find_element_by_id(url['etPwdSure']).send_keys(passwd)

        # 创建完成
        driver.find_element_by_id(url['btnCreateWallet']).click()
        #time.sleep(4)
        # 进入钱包,开始使用
        WebDriverWait(
            driver,
            300).until(lambda x: x.find_element_by_id(url['btnStartUse']))
        driver.find_element_by_id(url['btnStartUse']).click()
        #删除钱包
        delete_wallet.delete_wallet(driver, url, nan, passwd)
class creatWallet_class(unittest.TestCase):
    def setUp(self):
        self.driver=login.login()
    def tearDown(self):
        if self.driver:
            self.driver.quit()
    @ddt.unpack
    @ddt.data(*read_execl.read_excel_list('test_data/createWallet.xlsx'))
    def test_creatWallet(self,wallet,walletName):
        passwd=int(url['passwd'])
        passwd1 = int(url['passwd1'])

        #print('wallet:',wallet)
        #print('walletName:', walletNane)
        #print(passwd)
        driver=self.driver

        #管理
        driver.find_element_by_id(url['manage']).click()
        # 钱包管理
        driver.find_element_by_xpath(url['wallet_manage']).click()
        # +钱包
        driver.find_element_by_id(url['add_wallet']).click()
        # 开始使用
        # driver.find_element_by_id('com.machain.mybitt:id/btnIn').click()
        # 创建钱包
        driver.find_element_by_id(url['CreateWallet']).click()
        # 跳过
        driver.find_element_by_id(url['menuSkip']).click()
        # 创建ETH
        nan='//*[@text="{}"]'.format(wallet)
        #print(nan,wallet,walletNane)
        try:
            driver.find_element_by_xpath(nan).click()
        except:
            try:
                driver.swipe(0.5, 0.9, 0.5, 0.2, 1000)
            except:
                pass
            driver.find_element_by_xpath(nan).click()
        #driver.find_element_by_xpath(nan).click()

        if wallet =='NEO'or wallet=='NEO(Test)':
            WebDriverWait(driver,300).until(lambda x:x.find_element_by_id(url['etPwd']))
            driver.find_element_by_id(url['etPwd']).send_keys(passwd1)
            driver.find_element_by_id(url['btnNext']).click()
        # 热钱包名称
        WebDriverWait(driver, 300).until(lambda x: x.find_element_by_id(url['etName']))

        driver.find_element_by_id(url['etName']).send_keys(walletName)
        # 交易密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 复核密码
        driver.find_element_by_id(url['etPwdSure']).send_keys(passwd)
        # 同意协议
        driver.find_element_by_id(url['cbAgreement']).click()
        # 创建完成
        driver.find_element_by_id(url['btnCreateWallet']).click()
        #time.sleep(5)
        # 暂不备份,先用用看
        #driver.find_element_by_id(url['btnContinueAddAddress']).click()
        WebDriverWait(driver,300).until(lambda x:x.find_element_by_id(url['btnContinueAddAddress']))
        driver.find_element_by_id(url['btnContinueAddAddress']).click()
        time.sleep(1)
        # 我就不
        driver.find_element_by_id(url['btnCancel']).click()
        time.sleep(1)
        # 我不在乎
        # driver.find_element_by_id('com.machain.mybitt:id/btnCancel').click()
        # time.sleep(2)
        delete_wallet.delete_wallet(driver,url,nan,passwd)
Esempio n. 3
0
class creatWallet_class(unittest.TestCase):
    def setUp(self):
        self.driver = login.login()

    def tearDown(self):
        if self.driver:
            self.driver.quit()

    @ddt.unpack
    @ddt.data(*read_execl.read_excel_list('test_data/createWallet.xlsx'))
    def test_creatWallet(self, wallet, walletName):
        passwd = int(url['passwd'])
        passwd1 = int(url['passwd1'])

        #print('wallet:',wallet)
        #print('walletName:', walletNane)
        #print(passwd)
        driver = self.driver

        #管理
        driver.find_element_by_id(url['manage']).click()
        # 钱包管理
        driver.find_element_by_xpath(url['wallet_manage']).click()
        # +钱包
        driver.find_element_by_id(url['add_wallet']).click()
        # 开始使用
        # driver.find_element_by_id('com.machain.mybitt:id/btnIn').click()
        # 创建钱包
        driver.find_element_by_id(url['CreateWallet']).click()
        # 跳过
        driver.find_element_by_id(url['menuSkip']).click()
        # 创建ETH
        nan = '//*[@text="{}"]'.format(wallet)
        #print(nan,wallet,walletNane)
        try:
            driver.find_element_by_xpath(nan).click()
        except:
            try:
                driver.swipe(0.5, 0.9, 0.5, 0.2, 1000)
            except:
                pass
            driver.find_element_by_xpath(nan).click()
        #driver.find_element_by_xpath(nan).click()

        if wallet == 'NEO' or wallet == 'NEO(Test)':
            WebDriverWait(
                driver,
                300).until(lambda x: x.find_element_by_id(url['etPwd']))
            driver.find_element_by_id(url['etPwd']).send_keys(passwd1)
            driver.find_element_by_id(url['btnNext']).click()
        # 热钱包名称
        WebDriverWait(driver,
                      300).until(lambda x: x.find_element_by_id(url['etName']))

        driver.find_element_by_id(url['etName']).send_keys(walletName)
        # 交易密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 复核密码
        driver.find_element_by_id(url['etPwdSure']).send_keys(passwd)
        # 同意协议
        driver.find_element_by_id(url['cbAgreement']).click()
        # 创建完成
        driver.find_element_by_id(url['btnCreateWallet']).click()
        #time.sleep(5)
        # 暂不备份,先用用看
        #driver.find_element_by_id(url['btnContinueAddAddress']).click()
        WebDriverWait(driver, 300).until(
            lambda x: x.find_element_by_id(url['btnContinueAddAddress']))
        driver.find_element_by_id(url['btnContinueAddAddress']).click()
        time.sleep(1)
        # 我就不
        driver.find_element_by_id(url['btnCancel']).click()
        time.sleep(1)
        # 我不在乎
        # driver.find_element_by_id('com.machain.mybitt:id/btnCancel').click()
        # time.sleep(2)
        try:
            driver.find_element_by_id(url['btnCancel']).click()
        except:
            pass
        # 判定钱是否是0
        ele = driver.find_element_by_id(url['tvTotalMoney'])
        money = ele.text
        money1 = 0
        if money == '0' or money == '-':

            print('没钱')
        else:
            money1 = 8
            print('有钱:%s'.format(money))

        # 管理
        driver.find_element_by_id(url['manage']).click()
        # 钱包管理
        driver.find_element_by_xpath(url['wallet_manage']).click()
        # 点击1111钱包
        try:
            driver.find_element_by_xpath(nan).click()
        except:
            try:
                driver.swipe(0.5, 0.9, 0.5, 0.2, 1000)
            except:
                pass
            driver.find_element_by_xpath(nan).click()
        # 删除钱包
        driver.find_element_by_id(url['btnDelete']).click()
        # 输入密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 确认
        driver.find_element_by_id(url['tvSure']).click()
        WebDriverWait(
            driver,
            300).until(lambda x: x.find_element_by_id(url['btnDelete']))
        # 钱不为0时,截图和打印

        if money1 == 8:
            driver.save_screenshot(str(time.time()) + '.png')
            if wallet == 'XMC':
                a1 = driver.find_element_by_id(url['tvAddress'])
                a2 = driver.find_element_by_id(url['tvViewKey'])
                a3 = driver.find_element_by_id(url['tvSpendKey'])
                print('XMC钱包地址:', a1.text)
                print('XMC只读私钥:', a2.text)
                print('XMC花费私钥:', a3.text)
            else:
                ele1 = driver.find_element_by_id(url['tvKey'])
                print(wallet, ':', ele1.text)

            print(
                '一共有钱:', money,
                '___________________________________________________________________________________________________________________________________________'
            )

        #time.sleep(18)
        #try:
        #    ele1 = driver.find_element_by_id(url['tvKey'])
        #    print(wallet,': ',ele1.text)
        #except:
        #    pass
        # 删除钱包1

        time.sleep(3)
        driver.find_element_by_id(url['btnDelete']).click()
        time.sleep(1)
        # 确定
        driver.find_element_by_id(url['btnSure']).click()
Esempio n. 4
0
class sendMoney_class(unittest.TestCase):
    def setUp(self):
        self.driver=login.login()
    def tearDown(self):
        if self.driver:
            self.driver.quit()
    @ddt.unpack
    @ddt.data(*read_execl.read_excel_list('test_data/send_money.xlsx'))
    def test_sendMoney(self,phone,coinType,coin,coin_amount,people_num,red_pocket_large_or_samall):
        driver=self.driver
        passwd = int(url['passwd'])
        coin_amount=str(coin_amount)
        phone=int(phone)
        people_num=int(people_num)

        driver.find_element_by_id(url['manage']).click()
        # 点击MyBitt
        driver.find_element_by_id(url['manage_user_center']).click()
        try:
            # 手机号
            driver.find_element_by_id(url['login_phone']).send_keys(phone)
            ##下一步
            driver.find_element_by_id(url['login_next']).click()
            ##发送验证码
            driver.find_element_by_id(url['send_code']).click()
            ##登录
            driver.find_element_by_id(url['login_or_register']).click()
        except:
            pass
        # 返回
        driver.find_element_by_class_name(url['ImageButton']).click()
        # 交易
        driver.find_element_by_id(url['llTabMarket']).click()
        # 发红包
        driver.find_element_by_id(url['llRedPocket']).click()
        if red_pocket_large_or_samall=='small':
             #点小白发红包
             driver.find_element_by_id('com.machain.mybitt:id/tvSmall').click()

        # 选币种
        #driver.find_element_by_id(url['trSelectToken']).click()
        ##time.sleep(2)
        ## 选ETH(Test)
        #WebDriverWait(driver,10).until(lambda x:x.find_elements_by_id(url['tvTokenName']))
        #ele = driver.find_elements_by_id(url['tvTokenName'])
        #ele[coin].click()
        red_chose_coin.red_chose_coin(driver,url,coinType,coin)
        # 金额
        driver.find_element_by_id(url['etAmount']).send_keys(coin_amount)
        # 人数
        driver.find_element_by_id(url['etPeopleNum']).send_keys(people_num)
        # 下一步
        driver.find_element_by_id(url['btnNext']).click()
        #time.sleep(4)

        # 立即支付
        WebDriverWait(driver, 10).until(lambda x: x.find_element_by_id(url['btnPay']))
        driver.find_element_by_id(url['btnPay']).click()
        # 选钱包
        driver.find_element_by_id(url['tvWalletName']).click()
        driver.find_element_by_id(url['ivSelect']).click()

        # 输入密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 按回车
        driver.press_keycode('66')
        WebDriverWait(driver, 120).until(lambda x: x.find_element_by_id(url['tvTip']))
        ele1 = driver.find_element_by_id(url['tvTip'])
        textLast = ele1.text
        self.assertIn('尽快分享哦~',textLast)
       #if textLast == '大红包已生成,尽快分享哦~':
       #    print('发红包成功:', textLast)
Esempio n. 5
0
class tractionMoney_class(unittest.TestCase):
    def setUp(self):
        self.driver = login.login()

    def tearDown(self):
        if self.driver:
            self.driver.quit()

    @ddt.unpack
    @ddt.data(*read_execl.read_excel_list('test_data/tractionAddress.xlsx'))
    def test_tractionMoney(self, name, mainCoinType, asset, receiveAddress,
                           amout):
        mainCoinType = int(mainCoinType)
        asset = int(asset)
        amout = str(amout)
        passwd = int(url['passwd'])
        driver = self.driver
        # 交易
        driver.find_element_by_id(url['llTabMarket']).click()
        # 普通转帐
        driver.find_element_by_id(url['llTransCommon']).click()
        # 选资金类型
        driver.find_element_by_id(url['trMainCoinType']).click()
        # x=driver.get_window_size()['width']
        # y=driver.get_window_size()['height']
        # print(x,y)
        # size=driver.get_window_size()
        # print(size)
        time.sleep(2)
        if mainCoinType != 0:
            for i in range(mainCoinType):
                try:
                    time.sleep(1)
                    driver.swipe(0.5, 0.94, 0.5, 0.9)
                    #time.sleep(1)
                except:
                    pass
                # 确定

            driver.find_element_by_id(url['tvSure']).click()
        if asset != 0:
            #选资产
            driver.find_element_by_id(url['tvAsset']).click()
            for i in range(asset):
                try:
                    time.sleep(1)
                    driver.swipe(0.5, 0.94, 0.5, 0.9)
                    #time.sleep(1)
                except:
                    pass
        # 确定
        try:
            driver.find_element_by_id(url['tvSure']).click()

        except:
            pass
        # 选将资金类型中的币种
        driver.find_element_by_id(url['tvAsset']).click()
        driver.find_element_by_id(url['tvSure']).click()

        # 选择付款钱包
        driver.find_element_by_id(url['tvPayWallet']).click()
        driver.find_element_by_id(url['tvSure']).click()
        # 收款地址
        driver.find_element_by_id(
            url['etReceiveAddress']).send_keys(receiveAddress)
        #time.sleep(2)
        # 下一步
        WebDriverWait(driver,
                      20).until(lambda x: x.find_element_by_id(url['btnNext']))
        driver.find_element_by_id(url['btnNext']).click()
        #time.sleep(4)
        # 转帐金额
        WebDriverWait(
            driver, 20).until(lambda x: x.find_element_by_id(url['etAmount']))
        driver.find_element_by_id(url['etAmount']).send_keys(amout)
        # 备注
        ele2 = '转了{}{}'.format(amout, name)
        driver.find_element_by_id(url['etNote']).send_keys(ele2)
        # 点击核对转账信息
        driver.find_element_by_id(url['btnCheck']).click()
        # 确认转账
        WebDriverWait(driver,
                      30).until(lambda x: x.find_element_by_id(url['btnSure']))
        driver.find_element_by_id(url['btnSure']).click()
        # 输入密码
        driver.find_element_by_id(url['etPwd']).send_keys(passwd)
        # 确定
        driver.find_element_by_id(url['tvSure']).click()
        #time.sleep(30)
        WebDriverWait(driver,
                      60).until(lambda x: x.find_element_by_id(url['tvState']))
        last_text = driver.find_element_by_id(url['tvState']).text
        self.assertEqual('交易等待中', last_text)