def test_share(self): """分享""" print("========【case_0013】 分享测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(3) drawerMenuPage.share time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path()) drawerMenuPage.close_share time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path())
def test_qr_code_link(self): """二维码""" print("========【case_0005】 二维码页面测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(3) homepage.qr_code_link # 打开二维码 time.sleep(3) homepage.screenshot(Common.get_pic_path()) homepage.close_qr_code # 关闭二维码 time.sleep(3) homepage.screenshot(Common.get_pic_path())
def test_home_page(self): """主页""" print("========【case_0001】 主页测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(1) homepage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "90度地产") # 判断title是否是90度地产
def test_down_refresh_data(self): """下拉更新""" print("========【case_0006】 下拉更新测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(3) homepage.down_refresh_data homepage.screenshot(Common.get_pic_path())
def test_personal_page(self): """编辑个人资料""" print("========【case_0027】 编辑个人资料测试=============") personalpage = PersonalPage(self.driver) time.sleep(1) personalpage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "编辑个人资料") # 增加断言判断title是否是编辑个人资料
def test_detail_page(self): """详情页面""" print("========【case_0017】 详情页面测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(1) detailpage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "详情页") # 判断title是否是详情页
def test_daytime_mode(self): """白天模式""" print("========【case_0012】 白天模式测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(drawerMenuPage.night_mode.text, '夜间模式') # 判默认为白天模式,并且是否切换夜间模式
def test_drawer_menu_link(self): """我的页面""" print("========【case_0003】 我的页面测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(1) homepage.drawer_menu_link time.sleep(1) homepage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "我的") # 判断title是否是我的
def test_detail_link(self): """文章详情""" print("========【case_0002】 文章详情链接测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(1) homepage.detail_link time.sleep(1) homepage.screenshot(Common.get_pic_path()) self.assertIn("责任编辑", self.driver.page_source) # 判断文章内容是否包含责任编辑
def test_login_failed_collect(self): """未登录下收藏""" print("========【case_0021】 未登录下收藏测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(1) detailpage.collect time.sleep(1) detailpage.screenshot(Common.get_pic_path()) self.assertEquals(detailpage.login_title_text, "欢迎来到90度地产") # 判断是否弹出登录对话框
def test_big_data_link(self): """地产大数据报告""" print("========【case_0016】 地产大数据报告链接测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(1) drawerMenuPage.big_data_link time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, '地产大数据') # 判断标题是否为地产大数据
def test_original_link(self): """独家专题""" print("========【case_0015】 独家专题链接测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(3) drawerMenuPage.original_link time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, '独家原创') # 判断标题是否为独家原创
def test_news_link(self): """咨询""" print("========【case_0014】 咨询链接测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(3) drawerMenuPage.news_link time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, '90度地产') # 判断标题是否为90度地产
def test_async_loading(self): """上拉分页""" print("========【case_0004】 分页测试=============") homepage = Homepage.HomePage(self.driver) time.sleep(3) homepage.async_loading time.sleep(3) homepage.screenshot(Common.get_pic_path()) self.assertIn('北京二手房中介门店门可罗雀市场成交量低迷', self.driver.page_source) # 判断内容是否包含《北京二手房中介门店门可罗雀市场成交量低迷》文章
def test_goto_home_page(self): """回到首页""" print("========【case_0018】 详情页面回到首页测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(1) detailpage.goto_home_page time.sleep(1) detailpage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "90度地产") # 判断title是否是90度地产
def test_night_mode(self): """夜间模式""" print("========【case_0011】 夜间模式测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(3) drawerMenuPage.night_mode.click() time.sleep(3) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(drawerMenuPage.night_mode.text, '白天模式') # 判断切换为夜间模式,显示是否为白天模式
def test_head_update(self): """头像更新""" print("========【case_0029】 头像更新测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(1) Common.is_login_status_fail(self.driver, 'xxxx', '2327') time.sleep(1) drawerMenuPage.head_update('D:\\20171218160332.png') time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path())
def test_login_succeed_recent_read(self): """登录状态最近阅读""" print("========【case_0008】 登录状态最近阅读测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) Common.is_login_status_fail(self.driver, 'xxxx', '2327') time.sleep(1) drawerMenuPage.recent_read time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "最近阅读") # 判断是否打开最近阅读
def test_login_failed_recent_read(self): """未登录状态最近阅读""" print("========【case_0007】 未登录状态最近阅读测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(1) drawerMenuPage.recent_read time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(drawerMenuPage.login_title, "欢迎来到90度地产") # 判断是否弹出登录窗口
def test_login_failed_my_collect(self): """未登录状态我的收藏""" print("========【case_0009】 未登录状态我的收藏测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(1) drawerMenuPage.my_collect time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(drawerMenuPage.login_title, "欢迎来到90度地产") # 判断是否弹出登录窗口
def test_set_font_small(self): """小字体""" print("========【case_0023】 设置小字体测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.set_font time.sleep(2) detailpage.set_font_small time.sleep(2) detailpage.screenshot(Common.get_pic_path())
def test_set_night_mode(self): """夜间模式""" print("========【case_0025】 设置夜间模式测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.set_font time.sleep(1) detailpage.set_night_mode time.sleep(1) detailpage.screenshot(Common.get_pic_path())
def test_cancel_set_font(self): """取消字体设置""" print("========【case_0026】 取消字体测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.set_font time.sleep(1) detailpage.cancel_set_font time.sleep(1) detailpage.screenshot(Common.get_pic_path())
def test_set_font_big(self): """大字体""" print("========【case_0024】 设置大字体测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.set_font time.sleep(1) detailpage.set_font_big time.sleep(1) detailpage.screenshot(Common.get_pic_path())
def test_set_message(self): """消息设置""" print("========【case_0028】 消息设置测试=============") personalpage = PersonalPage(self.driver) time.sleep(1) personalpage.login('xxxx', '2327') time.sleep(1) personalpage.set_message personalpage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "消息设置") # 增加断言判断title是否是消息设置
def test_login_succeed_collect(self): """登录下收藏""" print("========【case_0022】 登录下收藏测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.collect if detailpage.login_title_text == '欢迎来到90度地产': detailpage.login('xxxx', '2327') detailpage.collect time.sleep(2) detailpage.screenshot(Common.get_pic_path())
def test_login_succeed_my_collect(self): """登录状态我的收藏""" print("========【case_0010】 登录状态我的收藏测试=====") drawerMenuPage = drawer_menu_page.DrawerMenuPage(self.driver) time.sleep(1) Common.is_login_status_fail(self.driver, 'xxxx', '2327') time.sleep(1) drawerMenuPage.my_collect time.sleep(1) drawerMenuPage.screenshot(Common.get_pic_path()) self.assertEquals(self.driver.title, "我的收藏") # 判断是否打开我的收藏
def test_login_failed_like(self): """未登录下点赞""" print("========【case_0019】 未登录下点赞测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(1) detailpage.like time.sleep(1) detailpage.screenshot(Common.get_pic_path()) self.assertEquals( Login.Login(self.driver).login_title_text, "欢迎来到90度地产") # 判断是否弹出登录对话框
def test_login_succeed_collect(self): """登录下收藏""" print("========【case_0022】 登录下收藏测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(2) detailpage.collect time.sleep(2) if detailpage.login_title_text == '欢迎来到90度地产': detailpage.login(ReadUser().get_username, ReadUser().get_password) time.sleep(2) detailpage.collect time.sleep(2) detailpage.screenshot(Common.get_pic_path())
def test_login_succeed_like(self): """登录下点赞""" print("========【case_0020】 登录下点赞测试=============") detailpage = detail_page.DetailPage(self.driver) time.sleep(1) start = int(detailpage.like_num) print(start) time.sleep(1) detailpage.like if detailpage.login_title_text == '欢迎来到90度地产': detailpage.login('xxxx', '2327') detailpage.like time.sleep(1) detailpage.screenshot(Common.get_pic_path()) end = int(detailpage.like_num) print(end)