示例#1
0
class TestSearch:
    def setup_class(self):
        self.driver = XueqiuDriver()
        self.xueqiu = XueqiuPage(self.driver)
        self.search = SearchPage(self.driver)

    @pytest.fixture(scope='function')
    def pre_search(self):
        self.xueqiu.goto_search()
        yield
        self.search.cancel_search()

    @pytest.mark.parametrize('key, name, stockCode, price',
                             [('alibaba', '阿里巴巴', 'BABA', 160),
                              ('xiaomi', '小米', '01810', 8.0),
                              ('google', '谷歌', 'GOOGL', 1000)])
    def test_search(self, key, name, stockCode, price, pre_search):
        self.search.search(key).press_search()
        assert name in self.search.get_name(stockCode)
        assert price < self.search.get_price(stockCode)
示例#2
0
 def goto_search(self):
     self.driver.find_element_by_id("home_search").click()
     return SearchPage(self.driver)
示例#3
0
 def setup_class(self):
     self.driver = XueqiuDriver()
     self.xueqiu = XueqiuPage(self.driver)
     self.optional = OptionalPage(self.driver)
     self.search = SearchPage(self.driver)
示例#4
0
class TestAddStock:
    def setup_class(self):
        self.driver = XueqiuDriver()
        self.xueqiu = XueqiuPage(self.driver)
        self.optional = OptionalPage(self.driver)
        self.search = SearchPage(self.driver)

    def teardown_class(self):
        self.xueqiu.goto_xueqiu()

    @pytest.fixture(scope="function")
    def pre_01(self):
        self.xueqiu.goto_optional().goto_search()
        yield
        self.search.cancel_search()

    @pytest.fixture(scope="function")
    def pre_02(self):
        self.optional.goto_search()
        yield
        self.search.cancel_search()

    @allure.story("添加股票")
    def test_01_add_stock(self, pre_01):
        self.search.search('pingan').press_search()
        self.search.add_searched_stock('平安银行')
        assert '已添加' == self.search.searched_stock_status('平安银行')

    @allure.story("搜索已添加的股票,显示为'已添加'")
    def test_02_search_again(self, pre_02):
        self.search.search('pingan').press_search()
        assert '已添加' == self.search.searched_stock_status('平安银行')

    @allure.story("删除股票")
    def test_03_delete_stock(self):
        self.optional.delete_stock("平安银行")
        assert '平安银行' not in self.optional.all_stockName_in_selected_list()
示例#5
0
 def goto_search(self):
     ele = self.find(self._search, max_y_per=0.15)
     ele.click()
     return SearchPage(self.driver)
示例#6
0
 def goto_search(self):
     self.find(self._home_search).click()
     #self.driver.find_element(*self._home_search).click()
     return SearchPage(self.driver)
示例#7
0
 def goto_search(self):
     self.find_and_click(self._home_search)
     return SearchPage(self.driver)