Example #1
0
class Test_(object):
    def setup_class(self):
        self.driver=Initdriver()
        self.page=Page(self.driver).page_改变处()
        print("开始了!!!")

    def teardown_class(self):
        time.sleep(6)
        self.driver.quit()
        print("结束了")
Example #2
0
class Test_address(object):
    def setup_class(self):
        self.driver = Initdriver()
        self.page = Page(self.driver).page_address()
        print("开始了!!!")

    def teardown_class(self):
        time.sleep(6)
        self.driver.quit()
        print("结束了!!!")

    @pytest.fixture(scope="function")
    def start_address(self):
        self.page.click_address()

    @pytest.fixture(scope="class")
    def click_bdbc(self):
        self.page.click_bdbc()

    @pytest.mark.parametrize("expect", ["新增联系人"])
    def test_001(self, expect):
        self.page.click_address()
        self.page.click_bdbc()
        time.sleep(1)
        text_list = self.driver.page_source
        assert expect in text_list

    @pytest.mark.parametrize("expect", ["所有联系人"])
    def test_002(self, expect):
        self.page.out_address()
        time.sleep(1)
        text_list = self.driver.page_source
        assert expect in text_list

    @pytest.mark.usefixtures("start_address")
    @pytest.mark.parametrize("test_no,name,phone,expect", read_test_data())
    @allure.step(title="添加联系人测试")
    def test_003(self, test_no, name, phone, expect):
        print(test_no, name, phone, expect)
        self.page.send_message(name, phone)
        self.page.out_address()
        time.sleep(5)
        if name == "" and phone == "":
            pass
        else:
            self.page.out_keyevent()
        time.sleep(0.1)
        text_list = self.driver.page_source
        assert expect in text_list, self.page.save_screen()
Example #3
0
class Test_(object):
    def setup_class(self):
        self.driver = Initdriver()
        self.page = Page(self.driver).page_delmsm()
        print("开始了!!!")

    def teardown_class(self):
        time.sleep(6)
        self.driver.quit()
        print("结束了")

    # @pytest.fixture(scope="class")
    # def start_search(self):
    #     self.page.click_search()
    #
    # @pytest.mark.usefixtures("start_search")
    # @pytest.mark.parametrize("text",["f**k","f**k you","shit"])
    def test_001(self):
        self.page.delete_msm()
Example #4
0
class Test_search(object):
    def setup_class(self):
        self.driver = Initdriver()
        self.page = Page(self.driver).page_search()
        print("开始了!!!")

    def teardown_class(self):
        self.page.out_search()
        time.sleep(6)
        self.driver.quit()
        print("结束了")

    @pytest.fixture(scope="class")
    def start_search(self):
        self.page.click_search()

    @pytest.mark.usefixtures("start_search")
    @pytest.mark.parametrize("test_no,text,expect", read_test_data())
    def test_001(self, test_no, text, expect):
        self.page.input_search(text)
        self.driver.get_screenshot_as_file('../picture/%s.png' % test_no)
        time.sleep(1)
        text_ml = self.driver.page_source
        assert expect in text_ml