Exemplo n.º 1
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def to_login_page(self):
        time.sleep(2)
        self.page.home.click_mine()
        time.sleep(2)
        self.page.mine.click_login_or_register()
        self.page.no_pwd_login.click_login_type()

    @pytest.mark.parametrize("args",
                             analyze_with_file("login_data", "test_login"))
    def test_login(self, args):
        user_name = args["username"]
        password = args["password"]
        expect = args["expect"]
        self.to_login_page()
        self.page.login.input_user_name(user_name)
        self.page.login.input_pass_word(password)
        # self.page.login.click_login_btn()

    @pytest.mark.parametrize("args",
                             analyze_with_file("login_data", "test_logout"))
    def test_logout(self, args):
        username = args["username"]
        password = args["password"]
        self.to_login_page()
        self.page.login.input_user_name(username)
        self.page.login.input_pass_word(password)
        assert not self.page.login.is_button_enabled()
Exemplo n.º 2
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    @pytest.mark.parametrize("args",
                             analyze_with_file('login_data', 'test_login'))
    def test_login(self, args):

        self.page.home.click_mine_btn()
        self.page.mine.click_login_sign_up_btn()
        self.page.login.input_username(args['username'])
        self.page.login.input_pwd(args['password'])
        self.page.login.click_login_btn()
        assert self.page.login.is_toast_text(args['expect'])

    @pytest.mark.parametrize("args",
                             analyze_with_file('login_data',
                                               'test_login_miss_part'))
    def test_login_miss_part(self, args):

        self.page.home.click_mine_btn()
        self.page.mine.click_login_sign_up_btn()
        self.page.login.input_username(args['username'])
        self.page.login.input_pwd(args['password'])
        assert not self.page.login.is_login_btn_enabled()
Exemplo n.º 3
0
class TestMms:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    def teardown(self):
        self.driver.quit()

    @pytest.mark.parametrize("args", analyze_with_file("mms_data",
                                                       "test_mms1"))
    @allure.severity('critical')
    def test_mms1(self, args):
        # receive = "13718701752"
        # input = "hello"
        receive = args["receive"]
        msg = args["msg"]
        self.page.show_mms.new_mms_button()
        self.page.send_mms.receive_msg(receive)
        self.page.send_mms.input_msg(msg)
        self.page.send_mms.send_button()
        assert self.page.success_mms.find_msg() == msg

    @pytest.mark.parametrize("args", analyze_with_file("mms_data",
                                                       "test_mms2"))
    @allure.severity('blocker')
    def test_mms2(self, args):
        # receive = "13718701752"
        # input = "hello"
        receive = args["receive"]
        msg = args["msg"]
        self.page.show_mms.new_mms_button()
        self.page.send_mms.receive_msg(receive)
        self.page.send_mms.input_msg(msg)
        self.page.send_mms.send_button()
        assert self.page.success_mms.find_msg() == msg
Exemplo n.º 4
0
class TestLogin:

    @pytest.mark.parametrize("args", analyze_with_file("login_data", "test_login1"))
    def test_login1(self,args):
        username = args["username"]
        password = args["password"]
        print(username)
        print(password)

    @pytest.mark.parametrize("args", analyze_with_file("login_data", "test_login2"))
    def test_login2(self, args):
        username = args["username"]
        password = args["password"]
        print(username)
        print(password)
Exemplo n.º 5
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)
    @pytest.mark.parametrize("args",analyze_with_file("login_data","test_login"))
    def test_login(self,args):
        username = args["username"]
        password = args["password"]
        expect = args["expect"]
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login()
        assert self.page.login.is_toast_exist(expect)


    # 为了以防止这密码与页面上的某些内容重合,所以使用随机生成密码,并且随机使用1个以上
    @pytest.mark.parametrize("password",show_password_data())
    def test_show_password(self,password):
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_password(password)
        # 再点击眼镜之前,没有找到输入的密码
        password_location = (By.XPATH,"//*[text='%s']"% password)
        assert not self.page.login.is_location_exit(password_location)
        self.page.login.click_view_pwd()

        # file_page = "./screen/TestLogin-test_show_password-%s.png" % password
        # self.driver.get_screenshot_as_file(file_page)
        time.sleep(2)
        allure.attach("显示密码:",self.driver.get_screenshot_as_png(),AttachmentType.PNG)
        assert self.page.login.is_location_exit(password_location)
Exemplo n.º 6
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    # @pytest.mark.parametrize("argsname", analyze_with_file("login_data", "test_login"))
    # def test_login(self, argsname):
    #     username = argsname["username"]
    #     password = argsname["password"]
    #     expect = argsname["expect"]
    #
    #     self.page.home_page.click_my()
    #     self.page.mine_page.click_login_sign_up()
    #     self.page.login_page.input_username(username)
    #     self.page.login_page.input_password(password)
    #     self.page.login_page.click_login()
    #     assert self.page.login_page.is_toast_exist(expect)

    @pytest.mark.parametrize("argsname", analyze_with_file("login_data", "test_login_miss_part"))
    def test_login_miss_part(self, argsname):
        username = argsname["username"]
        password = argsname["password"]

        self.page.home_page.click_my()
        self.page.mine_page.click_login_sign_up()
        self.page.login_page.input_username(username)
        self.page.login_page.input_password(password)
        assert not self.page.login_page.is_longin_enabled()
Exemplo n.º 7
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    @pytest.mark.parametrize('args',
                             analyze_with_file("login_data", "test_login"))
    def test_login(self, args):
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_username(args["username"])
        self.page.login.input_password(args["password"])
        self.page.login.click_login()
        assert self.page.login.is_toast_exist(args["expect"])

    @pytest.mark.parametrize('args',
                             analyze_with_file("login_data",
                                               "test_login_miss"))
    def test_login_miss(self, args):
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_username(args["username"])
        # sleep(2)
        self.page.login.input_password(args["password"])
        sleep(3)
        assert not self.page.login.is_login_button_enabled()

    @pytest.mark.parametrize('password', show_password_random())
    def test_show_password(self, password):
        # password = "******"
        password_location = (By.XPATH, "//*[@text='%s']" % password)
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_password(password)

        # if self.page.login.is_location_exist(password_location):
        #     assert False
        # 断言为真 继续运行 断言为假 结束运行
        assert not self.page.login.is_location_exist(password_location)
        # 点击显示密码按钮
        self.page.login.click_view_password()
        sleep(2)
        # 向报告里添加截图
        allure.attach("显示密码: ", self.driver.get_screenshot_as_png(),
                      AttachmentType.PNG)

        assert self.page.login.is_location_exist(password_location)
Exemplo n.º 8
0
class TestContacts:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    @pytest.mark.parametrize("name,phone", analyze_with_file("contacts_data", "test_new_contacts", "name", "phone"))
    def test_new_contacts(self, name, phone):
        self.page.contact_list.click_new_contact()
        self.page.new_contact.click_local_save()
        self.page.new_contact.input_name(name)
        self.page.new_contact.input_phone(phone)
        self.page.new_contact.click_back()
        sleep(10)
        self.page.new_contact.press_back()
        sleep(2)
        assert self.page.contact_list.is_name_in_contacts_name_feature(name)
Exemplo n.º 9
0
class TestLogin:

    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    @pytest.mark.parametrize("argnames", analyze_with_file("login_data", "test_login"))
    def test_login(self, argnames):
        username = argnames["username"]
        password = argnames["password"]
        expect = argnames["expect"]
        self.page.home.click_mine()
        self.page.mine.click_login_sign_up()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login()
        assert self.page.login.is_toast_exist(expect)
Exemplo n.º 10
0
class TestLogin:
    def setup(self):
        self.driver = init_driver()
        self.page = Page(self.driver)

    @pytest.mark.parametrize('args',
                             analyze_with_file("login_data", "test_login"))
    def test_login(self, args):
        username = args['username']
        password = args['password']
        expect = args['expect']

        self.page.home.click_mine()
        self.page.home.click_login_sign_up()
        self.page.login.input_username(username)
        self.page.login.input_password(password)
        self.page.login.click_login()
        self.page.login.is_toast_exists(expect)
        sleep(2)
Exemplo n.º 11
0
from base.base_analyze import analyze_with_file

analyze_with_file("login_data", "test_login")