Пример #1
0
def setup(init_driver):
    time.sleep(1.5)
    ClassroomPage(init_driver).join_classroom(success_data[0]["join_class_code"])
    yield init_driver
    # 返回课堂首页
    init_driver.get("https://www.ketangpai.com/Main/index.html")
    # 退出课堂
    ClassroomPage(init_driver).exit_web_class(Common_Datas.password)
 def test_enter_classroom(self, setup):
     do_log.info("----------进入班级用例开始执行----------")
     ClassroomPage(setup).enter_classroom()
     time.sleep(5)
     file_name = os.path.join(
         PAGESHOTS_DIR,
         f"加入课程_{datetime.strftime(datetime.now(), '%Y%m%d%H%M%S')}.png")
     try:
         assert WebClassPage(setup).check_ele()
         assert setup.current_url == "https://www.ketangpai.com/Interact/index/courseid/MDAwMDAwMDAwMLR2vd6Gz8mw.html"
     except:
         setup.save_screenshot(file_name)
         do_log.error(f"用例执行失败,截图为:{file_name}")
     else:
         do_log.info("----------进入班级用例执行成功----------")
Пример #3
0
def init_driver():
    # 创建会话对象
    driver = webdriver.Chrome(r'C:\Users\TR\AppData\Local\Google\Chrome\Application\chromedriver.exe')
    # 窗口最大化
    driver.maximize_window()
    # 打开网址https://www.ketangpai.com/
    driver.get(Common_Datas.home_url)
    # 首页点击登录按钮
    HomePage(driver).click_login_button()
    # 登录页面,登录账号
    LoginPage(driver).login(Common_Datas.username, Common_Datas.password)
    # 课堂页面,关闭提醒
    ClassroomPage(driver).close_notice()

    yield driver
    driver.quit()
Пример #4
0
 def test_private_msg_success(self, init_driver):
     ClassroomPage(init_driver).enter_msg_page()
     time.sleep(3)
     LetterPage(init_driver).send_letters("表白敏敏")
     assert LetterPage(init_driver).get_content() == "表白敏敏"
Пример #5
0
 def test_msg_homework_success(self, setup):
     ClassroomPage(setup).enter_classroom()
     WebClassPage(setup).upload_homework_ready()
     WebClassPage(setup).send_homework_msg("表白简神")
     assert WebClassPage(setup).get_homework_msg() == "表白简神"
 def test_check_homework_states_success(self, setup):
     ClassroomPage(setup).enter_classroom()
     assert WebClassPage(setup).get_homework_states() == "已提交"
def setup_enter_classroom(setup):
    # 进入课堂
    ClassroomPage(setup).enter_classroom()
    yield setup