コード例 #1
0
ファイル: testcase.py プロジェクト: jb5881/TestDevlopProject
class TestCase:
    def setup(self):
        self.main = MainPage()
        ran_util = RandomUtil()
        self.str_name = ran_util.get_random_str_num(4, 2)
        self.acct_num = ran_util.get_random_num(9)
        self.mail = ran_util.get_random_num(9)
        self.path = GetPath().get_path('../test.xls')

    def test_add_member(self):
        assert self.str_name in self.main.goto_add_member([
            '添加成员'
        ]).add_memeber(['姓名', '帐号', '邮箱', '保存'],
                       [self.str_name, self.acct_num, f'{self.mail}@qq.com'
                        ]).get_member(['姓名'], ['title'])

    def test_upload_file(self):
        assert 'test.xls' == self.main.goto_import_contact(
            ['导入通讯录']).upload_file(['上传文件', '获取文件名'], [self.path])

    def test_delete_member(self):
        before_names = self.main.goto_contacts(['通讯录']).get_member(['姓名'],
                                                                   ['title'])
        before_names.pop()  # 去除微信的本人,避免删除失败
        after_names = self.main.goto_contacts(['通讯录']).delete_member(
            ['勾选框', '删除', '删除确认'],
            [choice(before_names)]).get_member(['姓名'], ['title'])
        assert 0 == len([i for i in [after_names] if i in before_names])
コード例 #2
0
class TestAddMember:
    def setup(self):
        self.main = MainPage()

    def test_add_member(self):
        result = self.main.goto_add_member().add_member(
            'Usopu', '*****@*****.**', '15900000004').get_tips()
        assert "保存成功" == result

    def test_add_member_fail(self):
        """
        不能用username是否在列表里断言,username是可以重复的
        :return:
        """
        result = self.main.goto_add_member().add_member_fail(
            'Nami', '*****@*****.**', '15900000003').get_input_with_tips()
        print(result)
        assert result > 0
コード例 #3
0
class TestAddMember:
    def setup_class(self):
        self.main = MainPage()

    def test_add_member(self):
        # 1 添加成员,跳转至成员添加页面
        # 2 填写成员信息
        # 3 点击保存
        # 4 断言是否添加成功
        assert '李四' in self.main.goto_add_member().add_member().get_member()

    def test_add_member01(self):
        self.main = MainPage()
        # 1 添加成员,跳转至成员添加页面
        # 2 填写成员信息
        # 3 点击保存
        # 4 断言是否添加成功
        assert '李四' not in self.main.goto_add_member().add_member01(
        ).get_member()
        self.main.quit()
コード例 #4
0
class TestAddMember:
    def setup_class(self):
        self.main_page = MainPage()

    # 测试数据和页面对象分离
    @pytest.mark.parametrize("username,accid,phone",
                             [("Tesla", "00001", "13513935688")])
    def test_add_member(self, username, accid, phone):
        # 1.跳转到添加成员页面 2.添加成员 3.获取成员列表
        name_list = self.main_page.goto_add_member().add_member(
            username, accid, phone).get_contact_list()
        assert username in name_list

    @pytest.mark.parametrize("username,accid,phone",
                             [("Tesla", "00002", "13513935687")])
    def test_add_member_fail(self, username, accid, phone):
        # 1.跳转到添加成员页面 2.添加成员 3.获取成员列表
        data_list = self.main_page.goto_add_member().add_member_fail(
            username, accid, phone)
        err = [i for i in data_list if i != " "]
        assert "Tesla" in err[0]