예제 #1
0
class TestLogin:
    #在测试函数之前执行
    def setup_class(self):
        #1.初始化driver
        self.driver = get_driver(page.aolai_app_package,
                                 page.aolai_app_activity)
        #2.初始化导航类
        self.navigation_page = NavigationPage(self.driver)

    #最后执行
    def teardown_class(self):
        #关闭driver
        self.driver.quit()

    #测试函数
    def test_login(self):
        #1.点击我的
        self.navigation_page.get_home_page_obj().click_btn_my()
        #2.点击已有账号 去登录
        self.navigation_page.get_regist_page_obj().click_btn_already_account()
        #3 输入账号密码 登录
        self.navigation_page.get_login_page_obj().click_btn_login(
            "13488834010", "159357li")
        #4.跳转到个人中心 点击个人中心的左上角的设置按钮
        time.sleep(2)
        self.navigation_page.get_person_center_obj().click_btn_left_setting()
        #5.实现滑动 点击退出 在点击确认对话框
        self.navigation_page.get_setting_page_obj().click_setting_btn_logout()
예제 #2
0
class TestLogin:
    # 初始化导航类
    def setup_class(self):
        # 1.初始化driver对象
        self.driver = get_driver(
            "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
        # 2.初始化导航对象
        self.navigation_page = NavigationPage(self.driver)

    def teardown_class(self):
        time.sleep(5)
        self.driver.quit()

    # 测试登录正确业务

    def test_login(self):
        # 1.点击我的
        self.navigation_page.get_home_page_obj().click_my_button()
        # 2.点击已有账号
        self.navigation_page.get_sign_in_page_obj().click_exist_accout()
        # 3.输入用户名密码 点击登录
        self.navigation_page.get_login_page_obj().login_in("十里蓝山", "111")
        #.4.获取toast的内容
        toast_message = self.navigation_page.get_setting_page_obj(
        ).find_element(page.toast_test)
        #5.打印toast的消息
        print(toast_message.text)
class TestLogin:
    # 初始化导航类
    def setup_class(self):
        # 1.初始化driver对象
        self.driver = get_driver(
            "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
        # 2.初始化导航对象
        self.navigation_page = NavigationPage(self.driver)

    def teardown_class(self):
        time.sleep(5)
        self.driver.quit()

    # 测试登录业务
    @pytest.mark.parametrize("username,password", get_data())
    def test_login(self, username, password):
        # 1.点击我的
        self.navigation_page.get_home_page_obj().click_my_button()
        # 2.点击已有账号
        self.navigation_page.get_sign_in_page_obj().click_exist_accout()
        # 3.输入用户名密码 点击登录
        self.navigation_page.get_login_page_obj().login_in(username, password)
        # 4.判断是否登录成功 还是失败
        assert True
예제 #4
0
 def setup_class(self):
     # 1.初始化driver对象
     self.driver = get_driver(
         "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
     # 2.初始化导航对象
     self.navigation_page = NavigationPage(self.driver)
예제 #5
0
class TestLogin:
    # 初始化导航类
    def setup_class(self):
        # 1.初始化driver对象
        self.driver = get_driver(
            "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
        # 2.初始化导航对象
        self.navigation_page = NavigationPage(self.driver)

    def teardown_class(self):
        time.sleep(5)
        self.driver.quit()

    # 测试登录正确业务
    @pytest.mark.parametrize("username,password,tag,get_toast_msg,except_msg",
                             get_data())
    def test_login(self, username, password, tag, get_toast_msg, except_msg):
        # 1.点击我的
        self.navigation_page.get_home_page_obj().click_my_button()
        # 2.点击已有账号
        self.navigation_page.get_sign_in_page_obj().click_exist_accout()
        # 3.输入用户名密码 点击登录
        self.navigation_page.get_login_page_obj().login_in(username, password)
        if tag == 1:
            try:
                login_state = self.navigation_page.get_person_center_page_obj(
                ).is_login_sucess()
                # 4.点击个人中心设置按钮
                self.navigation_page.get_person_center_page_obj(
                ).click_person_center_setting()
                # 5.点击退出
                self.navigation_page.get_setting_page_obj().logout_account()
                assert login_state, self.navigation_page.get_person_center_page_obj(
                ).get_screen()
            except:
                #6.截图 在哪一个页面出现的问题
                self.navigation_page.get_person_center_page_obj().get_screen()
                self.navigation_page.get_login_page_obj().close_login_page()
        else:
            try:
                toast_message = self.navigation_page.get_person_center_page_obj(
                ).get_toast_message(get_toast_msg)
                assert toast_message == except_msg, self.navigation_page.get_person_center_page_obj(
                ).get_screen()
            finally:
                # 5.关闭当前登录页面
                self.navigation_page.get_login_page_obj().close_login_page()
예제 #6
0
class TestLogin:
    # 初始化导航类
    def setup_class(self):
        # 1.初始化driver对象
        self.driver = get_driver("com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
        # 2.初始化导航对象
        self.navigation_page = NavigationPage(self.driver)

    def teardown_class(self):
        time.sleep(5)
        self.driver.quit()

    # 测试登录正确业务
    @pytest.mark.parametrize("username,password", get_data())
    def test_login(self, username, password):
        # 1.点击我的
        self.navigation_page.get_home_page_obj().click_my_button()
        # 2.点击已有账号
        self.navigation_page.get_sign_in_page_obj().click_exist_accout()
        # 3.输入用户名密码 点击登录
        self.navigation_page.get_login_page_obj().login_in(username, password)
        # 4.点击个人中心设置按钮
        self.navigation_page.get_person_center_page_obj().click_person_center_setting()
        #5.点击退出
        self.navigation_page.get_setting_page_obj().logout_account()

    #测试登录错误逻辑
    @pytest.mark.parametrize("username,password,get_toast_msg,except_msg", get_data())
    def test_login2(self, username, password,get_toast_msg,except_msg):
        # 1.点击我的
        self.navigation_page.get_home_page_obj().click_my_button()
        # 2.点击已有账号
        self.navigation_page.get_sign_in_page_obj().click_exist_accout()
        # 3.输入用户名密码 点击登录
        self.navigation_page.get_login_page_obj().login_in(username, password)
        #4.获取真正弹出吐司的消息
        toast_msg = self.navigation_page.get_setting_page_obj().get_toast_message(get_toast_msg)
        print(toast_msg)
        assert  toast_msg == except_msg
        #5.关闭当前登录页面
        self.navigation_page.get_login_page_obj().close_login_page()
예제 #7
0
 def setup_class(self):
     #1.初始化driver
     self.driver = get_driver(page.aolai_app_package,
                              page.aolai_app_activity)
     #2.初始化导航类
     self.navigation_page = NavigationPage(self.driver)
예제 #8
0
 def setup_class(self):
     self.driver = init_driver(
         "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
     self.navigation_page = NavigationPage(self.driver)
     self.driver.implicitly_wait(10)
예제 #9
0
class TestLogin:
    def setup_class(self):
        self.driver = init_driver(
            "com.yunmall.lc", "com.yunmall.ymctoc.ui.activity.MainActivity")
        self.navigation_page = NavigationPage(self.driver)
        self.driver.implicitly_wait(10)

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

    @pytest.mark.parametrize('username,password,tag,toast_msg,expect_msg',
                             get_data())
    def test_login(self, username, password, tag, toast_msg, expect_msg):
        self.navigation_page.get_home_page_obj().click_me_btn()
        self.navigation_page.get_sign_in_page_obj().click_exist_account()
        self.navigation_page.get_login_page_obj().login_in(username, password)
        if tag == 1:
            try:
                login_state = self.navigation_page.get_person_center_page_obj(
                ).is_login_success()
                self.navigation_page.get_person_center_page_obj(
                ).click_person_center_setting()
                self.navigation_page.get_person_center_page_obj().swipe_screen(
                    1)
                self.navigation_page.get_setting_page_obj().logout_account()
                assert login_state, self.navigation_page.get_person_center_page_obj(
                ).get_screen()
            except:
                # 截图 在哪一个页面出现的问题
                self.navigation_page.get_person_center_page_obj().get_screen()
                self.navigation_page.get_login_page_obj().log_out()
        else:
            try:
                get_toast_message = self.navigation_page.get_person_center_page_obj(
                ).get_toast_message(toast_msg)
                assert get_toast_message == expect_msg, self.navigation_page.get_person_center_page_obj(
                ).get_screen()
            finally:
                # 5.关闭当前登录页面
                self.navigation_page.get_login_page_obj().log_out()