Ejemplo n.º 1
0
class TestSearch:
    def setup(self):
        self.main = App().start().main()

    def test_search(self):
        print(self.main)
        # assert self.main.goto_search_page("alibaba").get_price("BABA") > 200
        assert self.main.goto_search_page().search("alibaba").get_price(
            "BABA") > 200

    def test_select(self):
        assert "已添加" in self.main.goto_search_page().search(
            "jd").add_select().get_msg()

    # @pytest.mark.parametrize("key, stock_type, price", [
    #     ("alibaba", "BABA", 200),
    #     ("JD", "JD", 20)
    # ])

    # @pytest.mark.parametrize("key, stock_type, price", yaml.load(r"D:\PycharmProjects\pythonTest\test_appium\testcase\data.yaml"))

    @pytest.mark.parametrize("key, stock_type, price",
                             yaml.safe_load(open("data.yaml")))
    def test_search_data(self, key, stock_type, price):
        assert self.main.goto_search_page().search(key).get_price(
            stock_type) > price
Ejemplo n.º 2
0
class TestSearch:
    def setup(self):
        self.main = App().start().main()

    def test_search(self):
        assert self.main.goto_search_page().search("alibaba").get_price("BABA") > 200

    def test_select(self):
        assert "已添加" in self.main.goto_search_page().search("jd").add_select().get_msg()

    # @pytest.mark.parametrize("key, stock_type, price", [
    #     ("alibaba", "BABA", 200),
    #     ("JD", "JD", 20)
    # ])

    @pytest.mark.parametrize("key, stock_type, price", yaml.safe_load(open("data.yaml")))
    def test_search_data(self, key, stock_type, price):
        assert self.main.goto_search_page().search(key).get_price(stock_type) > price

    @pytest.mark.parametrize("code, name", [
        ("jd", "京东"),
        ("alibaba", "阿里巴巴")
    ])
    def test_stocks(self, code: str, name: str):
        """
        作业一:进入行情页,搜索股票并添加自选,然后重新回到行情页。
        """
        text = self.main.goto_stocks().goto_search_page_from_stocks().search(code).add_select().cancel().get_name()
        assert name in text
Ejemplo n.º 3
0
class TestMarket:
    def setup(self):
        self.market = App().start().main().goto_market_quotations_page()

    def test_market_quotations_add_follow(self):
        # 进入行情-点击搜索-添加自选-返回
        self.market.goto_search_page().search('阿里').add_follow(
            '09988').search_close()

    def teardown(self):
        pass
Ejemplo n.º 4
0
class TestSearch:
    def setup(self):
        self.main = App().start().main()

    def test_search(self):
        assert self.main.goto_search_page().search("alibaba").get_price("BABA") > 200

    def test_select(self):
        assert "已添加" in self.main.goto_search_page().search("jd").add_select().get_msg()

    @pytest.mark.parametrize("key, stock_type, price", yaml.safe_load(open('data.yaml')))
    def test_search_data(self, key, stock_type, price):
        assert self.main.goto_search_page().search(key).get_price(stock_type) > price
Ejemplo n.º 5
0
class TestSearch:
    def setup(self):
        self.main = App().start().wait_load_main()

    def test_search(self):
        self.main.goto_search_page().search("jd")

    def test_get_price(self):
        self.main.goto_search_page().search("alibaba").get_price("BABA")

    def test_add_selected(self):
        assert "已添加" in self.main.goto_search_page().search(
            "maotai").add_select().add_selected()

    # @pytest.mark.parametrize("key, stock_key, price", [
    #     ("alibaba", "BABA", 200),
    #     ("JD", "JD", 20)
    # ])
    # 基于外部yaml文件的数据驱动
    @pytest.mark.parametrize(
        "key, stock_key, price",
        yaml.safe_load(
            open(r"D:\MyProjects\test_appium\testcase\test_search.yaml")))
    def test_search_price(self, key, stock_key, price):
        assert self.main.goto_search_page().search(key).get_price(
            stock_key) > price

    def teardown(self):
        pass
Ejemplo n.º 6
0
class TestSearch:
    def setup(self):
        self.main = App().start().main()

    def test_search(self):
        assert self.main.goto_search_page().search("alibaba").get_price(
            "BABA") > 187

    def test_add_select(self):
        assert "已添加" in self.main.goto_search_page().search(
            "JD").add_select().get_msg()

    # @pytest.mark.parametrize("key, stock_type, price", [
    #     ("alibaba", "BABA", 170),
    #     ("JD", "JD", 30)
    # ])

    @pytest.mark.parametrize("key, stock_type, price",
                             yaml.safe_load(open("data.yaml")))
    def test_search_data(self, key, stock_type, price):
        assert self.main.goto_search_page().search(key).get_price(
            stock_type) > price