Ejemplo n.º 1
0
class Test_getup_sleep():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    def test_sleep(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击起床睡觉'):
            time.sleep(2)
            self.page.more().click_getupAndSleepBtn()
        with allure.step('点击睡觉按钮'):
            self.page.getup_sleep().tapScreen(0.5,0.85)
        with allure.step('判断是否生成睡觉卡片'):
            assert self.page.getup_sleep().check_sleepCard() == True

    def test_getup(self):
        with allure.step('点击起床按钮'):
            self.page.getup_sleep().click_sleepAndGetupBtn()
        with allure.step('判断是否生成起床卡片'):
            assert self.page.getup_sleep().check_getupCard() == True
Ejemplo n.º 2
0
 def setup(self):
     self.driver = Base().init_driver()
     #设定全局等待
     self.driver.implicitly_wait(50)
     self.page = Page(self.driver)
Ejemplo n.º 3
0
class Test_loginByPwd():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))
    #手机号密码登录测试用例
    def test_loginByPwd(self):
        with allure.step('点击同意服务协议'):
            self.page.login().click_agree_login()
        with allure.step('点击手机号登录'):
            self.page.login().click_phone_login()
        with allure.step('点击密码登录'):
            self.page.login_phone().click_loginByPwd()
        with allure.step('输入手机号'):
            self.page.login_phone_pwd().input_phone(str(phone))
        with allure.step('输入密码'):
            self.page.login_phone_pwd().input_pwd(str(pwd))
        with allure.step('关闭小键盘'):
            self.page.login_phone_pwd().back()
        with allure.step('点击登录按钮'):
            self.page.login_phone_pwd().click_loginBtn()
        with allure.step('断言:看到学习圈按钮-->登录成功'):
            assert self.page.shouye().check_friendCircle() == True
Ejemplo n.º 4
0
class Test_loginByWexin():
    # setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    # 放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        # 设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    # tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    # 当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    # 判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))
    # 手机号密码登录测试用例
    def test_loginByWexin(self):
        with allure.step('点击同意服务协议'):
            self.page.login().click_agree_login()
        with allure.step('点击Weixin登录'):
            self.page.login().click_wechat_login()
        with allure.step('断言:看到学习圈按钮-->登录成功'):
            assert self.page.shouye().check_friendCircle() == True

    def test_logout(self):
        with allure.step('点击更多按钮'):
            time.sleep(5)
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击设置按钮'):
            self.page.more().click_settingBtn()
        with allure.step('点击退出登录按钮'):
            self.page.setting().click_logout()
        with allure.step('确定退出'):
            self.page.setting().click_confirmLogout()
            time.sleep(2)
        with allure.step('断言:退出登录成功'):
            assert self.page.login().check_loginByphone() == True
Ejemplo n.º 5
0
class Test_loginByCaptcha():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))                               # 装饰器
    #手机号密码登录测试用例
    def test_loginByCaptcha(self):
        with allure.step('点击同意服务协议'):
            self.page.login().click_agree_login()
        with allure.step('点击手机号登录'):
            self.page.login().click_phone_login()
        with allure.step('输入手机号'):
            self.page.login_phone().input_phone(str(phone))
        with allure.step('点击获取验证码按钮'):
            self.page.login_phone().click_getCaptcha()
            time.sleep(2)
        with allure.step('正式服数据库拿验证码'):
            captcha = pd.read_sql(
                'select captcha FROM t_captcha WHERE phone = "' + str(phone) +
                '" order by postTime desc', engine)
            captcha = captcha.iloc[0, 0]
        with allure.step('输入验证码'):
            self.page.login_phone_captcha().input_captcha(str(captcha))
        with allure.step('点击完成'):
            self.page.login_phone_captcha().click_loginBtn()
        with allure.step('断言:看到学习圈按钮-->登录成功'):
            assert self.page.shouye().check_friendCircle() == True

    def test_logout(self):
        with allure.step('点击更多按钮'):
            time.sleep(5)
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击设置按钮'):
            self.page.more().click_settingBtn()
        with allure.step('点击退出登录按钮'):
            self.page.setting().click_logout()
        with allure.step('确定退出'):
            self.page.setting().click_confirmLogout()
            time.sleep(2)
        with allure.step('断言:退出登录成功'):
            assert self.page.login().check_loginByphone() == True
Ejemplo n.º 6
0
class Test_studyTime():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内

    def test_studyTimeLess(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击普通计时'):
            self.page.timing().click_normalTiming()
        with allure.step('输入学习内容'):
            self.page.timing().input_normalLearningTargetBox(12345)
        with allure.step('点击设置按钮'):
            self.page.timing().click_studySettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_studySettingsuccessBtn()
        with allure.step('点击开始学习'):
            self.page.timing().click_startTimingBtn()
        with allure.step('点击邀请'):
            time.sleep(2)
            self.page.classic_timing().click_studyTogetherBtn()
        with allure.step('点击邀请的人'):
            time.sleep(3)
            self.page.classic_timing().click_selectFriend()
        with allure.step('点击发送'):
            self.page.classic_timing().click_studyTogetherForwardBtn()
            time.sleep(3)
        with allure.step('点击讨论'):
            self.page.classic_timing().click_studyDiscussBtn()
        with allure.step('讨论输入框输入内容'):
            self.page.classic_timing().input_sendWordBox(12345)
        with allure.step('点击发送'):
            self.page.classic_timing().click_studyDiscussSendBtn()
        with allure.step('回退到计时页'):
            time.sleep(1)
            self.page.classic_timing().tapScreen(0.5, 0.2)
            self.page.classic_timing().click_backBtn()
        with allure.step('判断有没有讨论的内容'):
            assert self.page.classic_timing().check_studyDiscussContent(
            ) == True
        with allure.step('点击结束'):
            time.sleep(3)
            self.page.classic_timing().tapScreen(0.913, 0.94)
        with allure.step('确认结束'):
            self.page.classic_timing().click_timingEndYes()
        with allure.step('点击后退'):
            self.page.timing().click_back()
        with allure.step('判断跳到首页'):
            assert self.page.shouye().check_friendCircle() == True

    def test_studyTimeEnough(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击普通计时'):
            self.page.timing().click_normalTiming()
        with allure.step('输入学习内容'):
            self.page.timing().input_normalLearningTargetBox(12345)
        with allure.step('点击设置按钮'):
            self.page.timing().click_studySettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_studySettingsuccessBtn()
        with allure.step('点击开始学习'):
            self.page.timing().click_startTimingBtn()
        with allure.step('暂停学习'):
            time.sleep(2)
            self.page.classic_timing().click_timingPause()
            time.sleep(2)
        with allure.step('点击继续'):
            self.page.classic_timing().click_timingContinue()
        with allure.step('判断时间到了结束弹窗'):
            time.sleep(60)
            assert self.page.classic_timing().check_timingDialog() == True
        with allure.step('点击我知道了'):
            self.page.classic_timing().click_timingDialog()
        with allure.step('点击再学30分钟'):
            time.sleep(1)
            self.page.classic_timing().tapScreen(0.08, 0.966)
            time.sleep(1)
            self.page.classic_timing().tapScreen(0.08, 0.966)
            self.page.classic_timing().click_timingAgain_30()
            time.sleep(2)
            self.page.classic_timing().tapScreen(0.08, 0.966)
            time.sleep(1)
            self.page.classic_timing().tapScreen(0.08, 0.966)
        with allure.step('点击结束'):
            self.page.classic_timing().click_timingEnd()
        with allure.step('确认结束'):
            self.page.classic_timing().click_timingEndYes()
        with allure.step('检查是否有计时结束提示框'):
            time.sleep(5)
            self.page.classic_timing().tapScreen(0.5, 0.63)
            time.sleep(1)
            if self.page.activity().check_backBtn() == True:
                self.page.activity().click_back()
            else:
                self.page.classic_timing().tapScreen(0.5, 0.63)
                if self.page.activity().check_backBtn() == True:
                    self.page.activity().click_back()
                else:
                    self.page.activity().click_closeLive()
            time.sleep(2)
            self.page.classic_timing().tapScreen(0.5, 0.415)
            assert self.page.classic_timing().check_sharePhoto() == True
Ejemplo n.º 7
0
class Test_farmTime():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    def test_farmTimeLess(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击农场学习'):
            self.page.timing().click_farmTiming()
        with allure.step('输入学习内容'):
            time.sleep(3)
            self.page.timing().input_learningTargetBox(12345)
        with allure.step('点击设置按钮'):
            self.page.timing().click_timeSettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_studySettingsuccessBtn()
        with allure.step('点击开始学习'):
            self.page.timing().click_startLearningBtn()
        with allure.step('点击结束'):
            self.page.farm_timing().click_farmTimeEndBtn()
        with allure.step('点击确定'):
            self.page.farm_timing().click_timingEndConfirmRight()
        with allure.step('点击后退'):
            self.page.timing().click_back()
        with allure.step('判断跳到首页'):
            assert self.page.shouye().check_friendCircle() == True

    def test_farmTimeEnough(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击农场学习'):
            self.page.timing().click_farmTiming()
        with allure.step('输入学习内容'):
            time.sleep(3)
            self.page.timing().input_learningTargetBox(12345)
        with allure.step('点击设置按钮'):
            self.page.timing().click_timeSettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_studySettingsuccessBtn()
        with allure.step('点击开始学习'):
            self.page.timing().click_startLearningBtn()
        with allure.step('判断时间到了结束弹窗'):
            time.sleep(55)
        with allure.step('点击我知道了'):
            self.page.farm_timing().click_timingDialog()
        with allure.step('点击结束'):
            time.sleep(1)
            self.page.farm_timing().tapScreen(0.500, 0.948)
        with allure.step('点击确定'):
            self.page.farm_timing().click_timingEndConfirmRight()
        with allure.step('判断跳转到完成页面'):
            assert self.page.farm_timing().check_timingEndSuccess() == True
Ejemplo n.º 8
0
class Test_browsesVlog():
    # setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    # 放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        # 设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    # tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    # 当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))                               # 装饰器
    #长视频列表页浏览测试用例
    def test_browsesVlog(self):
        with allure.step('点击进入发现页'):
            self.page.shouye().click_friendCircle()
        with allure.step('点击sVlog标题'):
            if self.page.discover().check_sVlogAuthor() == True:
                self.page.discover().click_sVlogGif()
            else:
                self.page.discover().swipeUp()
                self.page.discover().click_sVlogGif()
            time.sleep(2)
        with allure.step('快速浏览长视频列表2min'):
            for i in range(1, 5):
                for j in range(1, 100):
                    self.page.sVlog_list().swipeUp()
                time.sleep(2)
                self.page.sVlog_list().swipeLeft()
                time.sleep(1)
        with allure.step('断言:无任何崩溃闪退'):
            assert self.page.sVlog_list().check_followBtn() == True
Ejemplo n.º 9
0
class Test_checkRecordPage():
    # setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    # 放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        # 设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    # tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    # 当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))                               # 装饰器
    #长视频列表页浏览测试用例
    def test_checkRecordPage(self):
        with allure.step('进入道友聊天页'):
            self.page.shouye().click_friendIcon()
        with allure.step('点击说话就拍按钮'):
            self.page.friend_chat().click_recordBtn()
        with allure.step('点击确定按钮'):
            if self.page.video_record().check_openCamera() == True:
                self.page.video_record().click_openCamera()
                time.sleep(3)
                self.page.video_record().click_startRecord()
            else:
                pass
        with allure.step('检查界面元素'):
            with allure.step('检查后退按钮'):
                if self.page.video_record().check_back() == True:
                    assert True
                else:
                    assert False
            with allure.step('检查顶部标题'):
                if self.page.video_record().check_titleWord() == True:
                    assert True
                else:
                    assert False
            with allure.step('检查发送对象'):
                if self.page.video_record().check_sendTarget() == True:
                    assert True
                else:
                    assert False
            with allure.step('检查引导文案'):
                if self.page.video_record().check_guideWord() == True:
                    assert True
                else:
                    assert False
            with allure.step('检查美颜按钮'):
                if self.page.video_record().check_switchCamera() == True:
                    assert True
                    with allure.step('点击美颜按钮'):
                        self.page.video_record().click_beautyBtn()
                else:
                    assert False
            with allure.step('检查切换摄像头按钮'):
                if self.page.video_record().check_beautyBtn() == True:
                    assert True
                    with allure.step('点击摄像头按钮'):
                        self.page.video_record().click_switchCamera()
                    with allure.step('连点切换摄像头'):
                        time.sleep(3)
                        self.page.video_record().tapScreen(0.5, 0.5)
                        time.sleep(0.2)
                        self.page.video_record().tapScreen(0.5, 0.5)
                else:
                    assert False
            with allure.step('检查头套按钮'):
                if self.page.video_record().check_hatsBtn() == True:
                    assert True
                    with allure.step('点击头套按钮'):
                        self.page.video_record().click_hatsBtn()
                else:
                    assert False
            with allure.step('检查柠檬头'):
                if self.page.video_record().check_beginToRecord() == True:
                    assert True
                    with allure.step('滑动柠檬头进入说话就拍状态'):
                        self.page.video_record().swipeToSpeak()
                else:
                    assert False
            with allure.step('断言:成功进入录制状态'):
                assert self.page.video_record().check_readyToSpeak() == True
Ejemplo n.º 10
0
class Test_friendTime():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    def test_friendTimeLess(self):
        with allure.step('点击结伴学习'):
            self.page.shouye().click_startStudyBtn()
        # with allure.step('输入学习内容'):
        #     time.sleep(3)
        #     self.page.firend_timing().input_friendTimeBox(12345)
        with allure.step('点击创建按钮'):
            self.page.firend_timing().click_beginTimeBtn()
        with allure.step('点击结束学习'):
            self.page.firend_timing().click_endTimeBtn()
        with allure.step('确认结束学习'):
            self.page.firend_timing().click_endTimeYesBtn()
        with allure.step('判断跳到首页'):
            assert self.page.shouye().check_friendCircle() == True

    def test_friendTimeEnough(self):
        with allure.step('点击结伴学习'):
            self.page.shouye().click_startStudyBtn()
        # with allure.step('输入学习内容'):
        #     time.sleep(3)
        #     self.page.firend_timing().input_friendTimeBox(12345)
        with allure.step('点击创建按钮'):
            self.page.firend_timing().click_beginTimeBtn()
        with allure.step('计时超过70s'):
            time.sleep(70)
        with allure.step('点击结束学习'):
            self.page.firend_timing().click_endTimeBtn()
        with allure.step('确认结束学习'):
            self.page.firend_timing().click_endTimeYesBtn()
        with allure.step('点击去打卡按钮'):
            time.sleep(2)
            self.page.firend_timing().click_gotoDaka()
        with allure.step('判断是否有计时总结'):
            assert self.page.firend_timing().check_finshTime() == True
Ejemplo n.º 11
0
class Test_postDiary():
    # setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    # 放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        # 设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    # tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    # 当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()
    #判断元素是否在当前页面内
    sourse = []
    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))                               # 装饰器
    #长视频列表页浏览测试用例
    def test_postDiary(self):
        with allure.step('点击道友圈'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击更多按钮'):
            time.sleep(2)
            self.page.more().click_smallMore()
        with allure.step('点击发布/投稿'):
            self.page.small_more().click_postDiary()
        with allure.step('点击发布图文日记'):
            self.page.post().click_postPhotoDiary()
        with allure.step('输入日记内容'):
            self.page.post_diary().input_diaryContent(12345)
        with allure.step('点击发布按钮'):
            self.page.post_diary().click_post()
        with allure.step('点击确定按钮'):
            time.sleep(2)
            self.page.select_cover().click_next()
            time.sleep(15)
        with allure.step('刷新页面'):
            self.page.discover().tapScreen(0.72,0.07)
            self.page.match_friend().click_backBtn()
        with allure.step('断言:发布成功'):
            if self.page.follow().check_deleteDiaryBtn() == True:
                self.page.follow().click_deleteDiaryBtn()
                self.page.follow().click_yesBtn()
                return True
            else:
                return False
Ejemplo n.º 12
0
class Test_tomatoTime():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    def test_tomatoTimeLess(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击普通计时'):
            self.page.timing().click_normalTiming()
        with allure.step('点击番茄学习'):
            self.page.timing().click_tomatoTiming()
        with allure.step('填写学习内容'):
            self.page.timing().input_learningTargetBox(12345)
        with allure.step('点击开始学习'):
            self.page.timing().click_startLearningBtn()
        with allure.step('点击取消'):
            self.page.tomato_timing().click_timingTomatoCancel()
        with allure.step('点击确定'):
            self.page.tomato_timing().click_timingEndYes()
        with allure.step('点击后退'):
            self.page.timing().click_back()
        with allure.step('判断跳到更多页'):
            assert self.page.shouye().check_friendCircle() == True
Ejemplo n.º 13
0
class Test_changeNickname():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    #判断元素是否在当前页面内
    sourse = []

    # @pytest.mark.parametrize("args", analyze_file("address_data.yaml", "test_address"))                               # 装饰器
    #手机号密码登录测试用例
    def test_changeNickname(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('进入个人主页'):
            time.sleep(2)
            self.page.more().click_personalInformation()
        with allure.step('点击修改资料'):
            self.page.person_home().click_changeData()
            time.sleep(5)
        with allure.step('修改姓名'):
            name = random.randint(1, 100)
            self.page.edit_personalData().input_nameBox(name)
            time.sleep(1)
        with allure.step('点击保存'):
            self.page.edit_personalData().click_saveBtn()
            time.sleep(1)
        with allure.step('断言:修改请求完成'):
            self.page.person_home().check_nickName()
Ejemplo n.º 14
0
class Test_videoTime():
    #setup函数是在一个类里面最先被调用的函数,而且每执行完一个函数都要从setUp()调用开始后再执行下一个函数,有几个函数就调用他几次,与位置无关,随便放在那里都是他先被调用。
    #放一些准备的工作,或者准备一些测试数据。
    def setup(self):
        self.driver = Base().init_driver()
        #设定全局等待
        self.driver.implicitly_wait(50)
        self.page = Page(self.driver)

    #tearDown()函数是在众多函数执行完后他才被执行,意思就是不管这个类里面有多少函数,他总是最后一个被执行的,与位置无关,最后不管测试函数是否执行成功都执行tearDown()方法;如果setUp()方法失败,则认为这个测试项目失败,不会执行测试函数也不执行tearDown()方法。
    #当我在测试完的时候我要对测试有一个销毁的过程比如说关闭浏览器,那么我们就写在tearDown当中
    def teardown(self):
        self.driver.quit()

    def test_videoTimeLess(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击视频打卡'):
            self.page.timing().click_videoTiming()
        with allure.step('填写学习内容'):
            self.page.timing().input_learningTargetBox(12345)
        with allure.step('设置时间'):
            self.page.timing().click_timeSettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_settingFinshBtn()
        with allure.step('点击确定开启并开启摄像头'):
            self.page.timing().click_startLearningBtn()
        with allure.step('允许权限'):
            time.sleep(1)
            self.page.timing().tapScreen(0.298, 0.653)
            time.sleep(1)
            self.page.timing().tapScreen(0.3, 0.722)
        with allure.step('点击开始学习按钮'):
            self.page.video_timing().click_videoStartStudy()
        with allure.step('点击结束'):
            time.sleep(3)
            self.page.video_timing().click_videoClosBtn()
        with allure.step('点击确定'):
            self.page.video_timing().click_videoEndDialog()
        with allure.step('点击后退'):
            self.page.timing().click_back()
        with allure.step('判断跳到更多页'):
            assert self.page.shouye().check_friendCircle() == True

    def test_videoTimeEnough(self):
        with allure.step('进入更多页'):
            self.page.shouye().click_mainMoreBtn()
        with allure.step('点击自律工具'):
            time.sleep(2)
            self.page.more().click_studyToolBtn()
        with allure.step('点击视频打卡'):
            self.page.timing().click_videoTiming()
        with allure.step('填写学习内容'):
            self.page.timing().input_learningTargetBox(12345)
        with allure.step('设置时间'):
            self.page.timing().click_timeSettingBtn()
        with allure.step('设置学习时长'):
            time.sleep(3)
            self.page.more().swipeByTime()
        with allure.step('点击设置完成按钮'):
            self.page.timing().click_settingFinshBtn()
        with allure.step('点击确定开启并开启摄像头'):
            self.page.timing().click_startLearningBtn()
        with allure.step('点击开始学习按钮'):
            self.page.video_timing().click_videoStartStudy()
        with allure.step('判断时间到了结束弹窗'):
            time.sleep(65)
            assert self.page.video_timing().check_timingDialog() == True
        with allure.step('点击我知道了'):
            self.page.video_timing().click_timingDialog()
        with allure.step('点击结束'):
            self.page.video_timing().click_videoClosBtn()
        with allure.step('点击确定'):
            self.page.video_timing().click_videoEndDialog()
        with allure.step('判断到了视频打卡页面'):
            assert self.page.video_timing().check_videoSuccess()