def test_myProfile(self): login_page = Action.user_login_home(0) user_center = myProfile.jump_to_me(login_page) assert "个人资料" in user_center.web_driver.title user_center.close()
def test_myLearning(self): login_page = Action.user_login_home(0) user_center = myLearning.jump_to_me(login_page) assert "我学习的课程" in user_center.web_driver.title user_center.close()
def test_myClass(self): login_page = Action.user_login_home(0) user_center = myClass.jump_to_me(login_page) assert "我的课时" in user_center.web_driver.title user_center.close()
def test_myHomework(self): login_page = Action.user_login_home(0) user_center = myHomework.jump_to_me(login_page) assert "我的作业" in user_center.web_driver.title user_center.close()
def test_myPassword(self): login_page = Action.user_login_home(0) user_center = myPassword.jump_to_me(login_page) assert "修改密码" in user_center.web_driver.title user_center.close()
def test_myCourseCollection(self): login_page = Action.user_login_home(0) user_center = myCourseCollection.jump_to_me(login_page) assert "我收藏的课程" in user_center.web_driver.title user_center.close()
def test_asset_detail(self): home_page = Action.user_login_home(0) asset_detail = AssetDetail.jump_to_me(home_page, args='/' + id) assert "自动测试作品标题" in asset_detail.web_driver.title asset_detail.close()
def test_login_submit(self): try: login_page = Action.user_login_home(0) finally: login_page.close()
def test_myMessage(self): login_page = Action.user_login_home(0) user_center = myMessagePage.jump_to_me(login_page) assert "互动信息" in user_center.web_driver.title user_center.close()
def test_myAsset(self): login_page = Action.user_login_home(0) user_center = myAssetPage.jump_to_me(login_page) assert "我的作品" in user_center.web_driver.title user_center.close()
def test_create_asset(self): home_page = Action.user_login_home(0) create_asset = CreateAsset.jump_to_me(home_page) assert "创建作品" in create_asset.web_driver.title create_asset.input_asset_info(0) asset_web = create_asset.navigate_by_xpath(xpath = '//*[@id="root"]/div[2]/div/div[2]/label[2]/input', to_web_page=myAssetPage) WebDriverWait(self.web_driver, 10).until(EC.title_contains(''))
def test_question(self): home_page = Action.user_login_home(0) create_question = CreateQuestion.jump_to_me(home_page) assert "" in create_question.web_driver.title create_question.input_question_info(0) sleep(2) btn = create_question.find_by_xpath("//input[@value = '提交问题']") btn.click()
def test_signup_course(self): home_page = Action.user_login_home(1) signup_course = CourseDetail.jump_to_me(home_page) assert "自动化测试课程标题" in signup_course.web_driver.title studyBtn = signup_course.find_by_className(value='studyBtn') studyBtn.click() # WebDriverWait(driver, 10).until(EC.title_contains("元素")) signBtn = signup_course.find_by_className(value='mic-btn') signBtn.click() signup_course.close()
def test_create_course(self): home_page = Action.user_login_home(0) create_course = CreateCourse.jump_to_me(home_page) assert "创建课程" in create_course.web_driver.title create_course.input_course_info(0) create_course.add_class_info() sleep(1) course_web = create_course.navigate_by_xpath(xpath='//*[@id="root"]/div[1]/div/div[2]/span/div[2]/input', to_web_page=myCourse) # Obtain Course id_href try: course_id_href = course_web.find_by_xpath('//div[@class="card course"][1]/a').get_attribute('href') print('====>',course_id_href) except Exception as error: print('Xpath语句有误,请检查!\nError:{}'.format(error)) else: # Use Re Obtain course id course_id = re.search(r'/course/(.*)', course_id_href) if course_id: courseID = course_id.group(1) print('----->', courseID) return courseID else: print('未获取课程ID') create_course.close()
def test_myCourse(self): login_page = Action.user_login_home(0) user_center = myCourse.jump_to_me(login_page) assert "全部" in user_center.web_driver.title