Example #1
0
class TestAddPerson:
    def setup(self):
        baseDriver = BaseDriver()
        driver = baseDriver.create_driver()
        self.sendMessage = SendMessagePage(driver)
        self.sendMessage.click_add_people()
        self.sendMessage.click_all_button()

    #打电话 allure的pytest
    # @pytest.allure.severity(pytest.allure.severity_level.CRITICAL)
    @pytest.mark.skipif(condition=2 > 1, reason="跳过该函数")
    @allure.step('我是测试步骤001')
    def test_call_person(self):
        self.sendMessage.click_img_button()
        self.sendMessage.click_phone_button()

    # 发短信---pytest
    # @pytest.mark.run(order=2)
    # @pytest.mark.xfail(2 > 1, reason="标注为预期失败")
    # @pytest.mark.parametrize('contents', ['aa', 'bb', 'cc', 'dd'])
    @pytest.mark.parametrize('text', yml_data_with_file()['search_data'])
    def test_send_mes(self):
        self.sendMessage.click_selected_button()
        self.sendMessage.input_text_button('text')
        self.sendMessage.click_send_button()
Example #2
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.login_page = LoginPage(self.driver)

    @pytest.mark.parametrize("args",
                             yml_data_with_file("login_data", 'test_login'))
    def test_login(self, args):
        self.login_page.input_username(args['username'])
        self.login_page.input_password(args['password'])
        self.login_page.click_login()
        time.sleep(5)
        self.login_page.screenshot(args['screen'])
        # 成功就向下执行
        print(self.login_page.is_errorTip())
        if self.login_page.is_errorTip():
            # 登录成功后返回我的主页
            self.driver.keyevent(4)
            # 点击设置页面,再退出
            self.login_page.click_set()
            # 找到退出按钮并点击
            self.login_page.click_back()

        assert self.login_page.is_errorTip()

    def teardown(self):
        print("测试结束hahaha")
Example #3
0
def data_with_key(key):
    return yml_data_with_file("shuju")[key]
Example #4
0
def data_with_key(key):
    # 调用解析文件的方法yml_data_with_file,并且传递search_data的文件名
    # return拿到整个文件的字典,然后通过key去取对应的值
    return yml_data_with_file("search_data")[key]
Example #5
0
def data_with_key(key):
    return yml_data_with_file("search_data")[key]
Example #6
0
def data_with_key(key):
    return yml_data_with_file("login_data", key)
Example #7
0
def data_with_key(key):
    data = yml_data_with_file("search_data")[key]
    return data
Example #8
0
def read_yml(filename,key):
    return yml_data_with_file(filename)[key]
Example #9
0
def data_with_key(key):
    return yml_data_with_file("passenger_mgt", key)
Example #10
0
def data_with_key(key):
    return yml_data_with_file("sales_system_data", key)