Example #1
0
    def test_deposit_cny(self):
        open_url(get_url("deposit_cny"))
        sleep(2)
        self.get_element("deposit", "select_bank").click()
        sleep(1)
        self.get_element("deposit", "first_bank").click()
        sleep(1)
        self.get_element("deposit", "amount").send_keys(self.get_random())
        amount = self.get_element("deposit", "amount").get_attribute("value")
        amount_decimal = self.get_element("deposit", "amount-decimal").text
        value = amount+amount_decimal
        print("========> "+value)
        self.get_element("deposit", "create_request").click()
        while self.get_element("deposit", "create_request_loading") is not None:
            sleep(1)
        sleep(2)
        with my_assert(u"充值 cny"):
            value2 = self.get_element("deposit", "transfer_info_amount").text
            self.assertEqual(value, value2.replace(",", ""))
        print(self.get_element("deposit", "close"))

        while self.get_element("deposit", "close").is_displayed():

            self.get_element("deposit", "close").click()
            sleep(2)
        while self.get_element("deposit", "cancel").is_displayed():
            self.get_element("deposit", "cancel").click()
            sleep(2)
            if self.get_element("deposit", "confirm_cancel").is_displayed():
                self.get_element("deposit", "confirm_cancel").click()
                sleep(2)
                break
Example #2
0
    def test_deposit_btc(self):
        open_url(get_url("deposit_btc"))
        sleep(3)
        with my_assert(u"充值 btc 检查二维码显示"):
            self.assertIsNotNone(self.get_element("deposit", "btc_qrcode"))

        with my_assert(u"充值 btc 检查地址显示"):
            self.assertIsNotNone(self.get_element("deposit", "btc_address"))
Example #3
0
 def test_trade_ltc(self):
     self.driver.get(get_url("trade_ltc"))
     sleep(3)
     before_orders = self.get_open_orders()
     self.buy()
     after_orders = self.get_open_orders()
     self.check_result(before_orders, after_orders, "购买ltc")
     before_orders = self.get_open_orders()
     self.sell()
     after_orders = self.get_open_orders()
     self.check_result(before_orders, after_orders, "出售ltc")
Example #4
0
    def test_trade_btc(self):
        self.driver.get(get_url("trade"))
        sleep(3)
        before_orders = self.get_open_orders()

        print("======>before_orders :%s" %before_orders)
        self.buy()
        after_orders = self.get_open_orders()
        print("======>after_orders :%s" % after_orders)
        self.check_result(before_orders, after_orders, "购买btc")
        before_orders = self.get_open_orders()
        self.sell()
        after_orders = self.get_open_orders()
        print("======>after_orders :%s" % after_orders)
        self.check_result(before_orders, after_orders, "出售btc")
Example #5
0
    def test_cny_trading(self):
        self.get_element("propage", "cny_trading").click()

        sleep(3)
        # handels = self.driver.window_handles
        # self.driver.switch_to_window(handels[1])
        # sleep(2)
        url = self.driver.current_url

        with my_assert("点击cny_trading 进入trading 页面"):
            self.assertEqual(url, get_url("propage_cny_trading"))

        # 关闭导航
        self.get_element("propage_cny_trade", "note_confirm_btn").click()
        sleep(1)
        self.get_element("propage_cny_trade", "guide_colse_btn").click()
        sleep(1)

        # 检查语言切换
        self.get_element("propage_cny_trade", "trade_current_language_div").click()

        # 切换英文
        self.get_element("propage_cny_trade", "trade_en_language").click()
        sleep(1)
        value = self.get_element("propage_cny_trade", "order_book").text

        with my_assert("cny_trading 切换英文"):
            self.assertEqual(value, "ORDER BOOK")

        self.get_element("propage_cny_trade", "trade_current_language_div").click()

        # 切换中文
        self.get_element("propage_cny_trade", "trade_ch_language").click()

        sleep(1)
        value = self.get_element("propage_cny_trade", "order_book").text

        with my_assert("cny_trading 切换中文"):
            self.assertEqual(value, "盘口")
    def test_withdraw_btc(self):
        open_url(get_url("withdraw_btc"))
        sleep(2)
        self.get_element("withdraw", "withdraw_amount").send_keys("0.001")
        self.get_element("withdraw", "withdraw_trans_password").send_keys(self.user.get("trans_password"))
        sleep(1)
        self.get_element("withdraw", "withdraw_btn").click()
        sleep(0.1)
        while self.get_element("withdraw", "withdraw_btn_loading") is not None:
            sleep(1)

        sleep(3)

        with my_assert("提现 btc"):
            self.assertTrue(self.get_element("withdraw", "success_msg").is_displayed())
        self.get_element("withdraw", "cancel").click()
        sleep(1)

        self.get_element("withdraw", "confirm").click()

        while self.get_element("withdraw", "confirm_loading") is not None:
            sleep(1)
Example #7
0
 def setUp(self):
     BaseTest.setUp(self)
     open_url(get_url("propage"))
 def setUp(self):
     BaseTest.setUp(self)
     # self.driver.get(get_url("contact"))
     open_url(get_url("contact"))
Example #9
0
 def tearDown(self):
     self.driver.get(get_url("homepage"))
     bcomm.logout()
Example #10
0
 def setUp(self):
     BaseTest.setUp(self)
     open_url(get_url("homepage"))
     bcomm.login(self.user.get("email"), self.user.get("password"))
Example #11
0
    def check_result(self):

        sleep(2)

        # 检查登陆后的账户 显示是否正确
        value = self.get_element("homepage", "email_text").text
        # value = 'ken***@gmail.com'

        with my_assert("登陆成功"):
            self.assertEqual('ken***@gmail.com', value)

        # 检查页面跳转是否正常
        self.get_element("homepage", "trade").click()
        sleep(1)
        url = self.driver.current_url
        with my_assert("点击trade链接跳转"):
            self.assertEqual(url, get_url("trade"))
        self.driver.back()
        sleep(2)
        self.get_element("homepage", "market_trend").click()
        sleep(1)
        url = self.driver.current_url
        with my_assert("点击market Trend 链接跳转"):
            self.assertEqual(url, get_url("market_trend"))
        self.driver.back()

        sleep(2)
        # self.get_element("homepage", "help_center").click()
        # handels = self.driver.window_handles
        # self.driver.switch_to_window(handels[1])
        # sleep(2)
        # url = self.driver.current_url
        # with my_assert("点击help center 链接跳转"):
        #     self.assertEqual(url, get_url("help_center"))
        #
        # self.driver.close()
        # self.driver.switch_to_window(handels[0])
        # sleep(2)
        #
        # self.driver.refresh()
        # sleep(2)
        self.get_element("homepage", "deposit_withdraw").click()

        url = self.driver.current_url
        with my_assert("点击withdraw deposit链接跳转"):
            self.assertEqual(url, get_url("deposit_cny"))
        self.driver.back()

        sleep(2)
        # 检查账户信息是否显示出来
        total_assets = self.get_element("homepage", "total_assets").text
        with my_assert("total assets 显示"):
            self.assertNotEqual(total_assets, "")

        available = self.get_element("homepage", "available").text
        with my_assert("available 显示"):
            self.assertNotEqual(available, "")

        balance_btc = self.get_element("homepage", "balance_btc").text
        with my_assert("balance btc 显示"):
            self.assertNotEqual(balance_btc, "")

        balance_ltc = self.get_element("homepage", "balance_ltc").text
        with my_assert("balance ltc 显示"):
            self.assertNotEqual(balance_ltc, "")

        # 检查btc/cny 和 ltc/cny的价格是否正常的显示出来
        self.get_element("homepage", "BTC/CNY").click()

        last_price = self.get_element("homepage", "last_price").text
        with my_assert("btc/cny last_price 显示"):
            self.assertNotEqual(last_price, "")

        daily_high = self.get_element("homepage", "daily_high").text
        with my_assert("btc/cny daily_high 显示"):
            self.assertNotEqual(daily_high, "")

        daily_low = self.get_element("homepage", "daily_low").text
        with my_assert("btc/cny daily_low 显示"):
            self.assertNotEqual(daily_low, "")

        self.get_element("homepage", "LTC/CNY").click()

        last_price = self.get_element("homepage", "last_price").text
        with my_assert("ltc/cny last_price 显示"):
            self.assertNotEqual(last_price, "")

        daily_high = self.get_element("homepage", "daily_high").text
        with my_assert("ltc/cny daily_high 显示"):
            self.assertNotEqual(daily_high, "")

        daily_low = self.get_element("homepage", "daily_low").text
        with my_assert("ltc/cny daily_low 显示"):
            self.assertNotEqual(daily_low, "")
Example #12
0
 def setUp(self):
     BaseTest.setUp(self)
     self.driver.get(get_url("homepage"))