コード例 #1
0
ファイル: test_market.py プロジェクト: 16yun/HogwartsSED11
class TestMarket():
    def setup(self):

        self.main = App().start().market()

    def test_get_price(self):

        assert self.main.goto_search().search('jd').switch_label(
            '股票').get_price() > 40

    def test_by_stockCode_price(self):

        assert self.main.goto_search().search('jd').switch_label(
            '股票').get_stockCode_price('SZ000725') > 1

    def test_add_select_stock(self):

        toast = self.main.goto_search().search('jd').switch_label(
            '股票').select_stockCode_stock('SZ000725').get_toast()

        assert toast in '添加成功'

    def test_un_select_stock(self):

        toast = self.main.goto_search().search('jd').switch_label(
            '股票').select_stockCode_stock('SZ000725').un_select_stock(
                'SZ000725').get_toast()

        assert '删除' in toast
コード例 #2
0
ファイル: test_search.py プロジェクト: Sean-bot-lab/appium_ct
class TestSearch:
    def setup(self):
        self.main = App().start().main()

    # todo: 参数化,可结合yaml文件做数据驱动 done
    # @pytest.mark.parametrize("key, stock_type, price", [
    #     # ("albb", "BABA", 100),
    #     ("JD", "JD", 20),
    # ])

    @pytest.mark.parametrize("key, stock_type, price",
                             yaml.safe_load(open("/home/chent/PycharmProjects/mmj/test_appium/yaml/search_data.yaml")))
    def test_search(self, key, stock_type, price):
        assert self.main.goto_search().search(key).get_price(stock_type) > price
    # 测试步骤的数据驱动
    def test_search_dd(self):
        App().start().main().goto_search().search2("jd")

    def test_zixuan(self):
        assert "已添加" in self.main.goto_search().search("JD").get_cho().get_msg()