import logging
import unittest

from plat.deepcoin.point_collection import PointCollection

logging.basicConfig(level=logging.INFO, force=True)  # 设置日志级别


class MyTestCase(unittest.TestCase):
    def setUp(self):
        self.pc = PointCollection('127.0.0.1:6555')

    def test_to_top_swipe(self):
        """
        滑动到顶部
        """
        self.pc.to_top_swipe()

    def test_to_next_swipe(self):
        """
        滑动到下一屏
        """
        self.pc.to_next_swipe()

    def test_save_point(self):
        """
        保存坐标
        """
        self.pc.save_point()

    def test_slider_baozhengjin(self):
        """
        保证金滑块
        """
        self.pc.slider_baozhengjin()

    def test_click_kaicang(self):
        """
        开仓
        """
        self.pc.click_kaicang()

    def test_click_pingchang(self):
        """
        平仓
        """
        self.pc.click_pingchang()

    def test_select_weituo_xianjia(self):
        """
        选择限价委托
        """
        self.pc.select_weituo_xianjia()

    def test_click_price(self):
        """
        点击价格
        """
        self.pc.click_price_red()

    def test_f1(self):
        """
        f1 开仓界面，仓位滑竿百分比(30-60)
        """
        self.pc.click_kaicang()
        self.pc.slider_baozhengjin()

    def test_f2(self):
        """
        f2 确认开仓，限价职中间数值
        检查撤销限价委托单
        """

    def test_f3(self):
        """
        F3 开仓界面，仓位滑竿百分比(30-60)确认开仓，限价职中间数值
        """

    def test_f4(self):
        """
        F4   确认开仓限价职中间数值 检查撤销限价委托单
        """

    def test_f5(self):
        """
        F5 开仓界面胂仓位滑竿百分比(30-60)
        """

    def test_f6(self):
        """
        F6 确认开仓，限价职中间数值
        检查撤销限价委托单
        """

    def test_f7(self):
        """
        F7    平仓界面二仓位滑竿百分比(90-100)
        """

    def test_f8(self):
        """
        F8 确认平仓，限价职中间数值
        检查撤销限价委托单
        """

    def test_jiao_yi(self):
        x, y = self.pc.btn_jiao_yi()
        logging.info(f"交易坐标: （{x},{y}）")

    def test_mairu_kaiduo(self):
        x, y = self.pc.btn_mairu_kaiduo()
        logging.info(f"买入开多: （{x},{y}）")

    def test_chichang(self):
        self.pc.d.xpath()


if __name__ == '__main__':
    unittest.main()
