def test_17_CheckButtonList(self):
     RES().click_submit_button()
     for button in RES().button_list:
         if findsomething().find_by_message(self._driver, button, 2, 1):
             print '按钮' + button + '存在'
         else:
             print '按钮' + button + '不存在'
 def test_16_CheckScoreList(self):
     RES().click_submit_button()
     for score in RES().score_list:
         if findsomething().find_by_message(self._driver, score, 2, 1):
             print '分数' + score + '存在'
         else:
             print '分数' + score + '不存在'
 def test_15_CheckWrongReason(self):
     RES().click_submit_button()
     photo().take_screeshot()
     for reason in RES().wrong_list:
         if findsomething().find_by_message(self._driver, reason, 2, 1):
             print '错题原因' + reason + '存在'
         else:
             print '错题原因' + reason + '不存在'
 def test_18_ClickCancelButton(self):
     RES().click_submit_button()
     photo().take_screeshot()
     cancel_button = self._driver.find_element_by_id(RES.ID_CANCEl)
     cancel_button.click()
     if findsomething().find_by_message(self._driver, u'提交', 2, 1):
         print u'取消功能正常,弹出框关闭'
     else:
         print u'取消功能不正常,弹出框没有关闭'
 def test_14_ClickSubmitDialog(self):
     RES().click_submit_button()
     if findsomething().find_by_message(self._driver, u'1分', 2, 1):
         print u'点击提交后弹出框正确!'
     else:
         print u'点击提交后弹出框错误!'
    def draw_work(self):
        '''
        画几笔,用用橡皮擦
        录音,播放播音
        选择对错
        提交
        :return:
        '''
        # 定义driver
        res_driver = Driver().get_driver()
        # 定义对号
        right_button = res_driver.find_element_by_id(RES.ID_RIGHT)
        # 定义错号
        wrong_button = res_driver.find_element_by_id(RES.ID_WRONG)
        # 定义半对
        right_wrong_button = res_driver.find_element_by_id(RES.ID_RIGHT_WRONG)
        # 结果列表
        result = [right_button, wrong_button, right_wrong_button]

        # 定义提交按钮并点击
        submit_button = res_driver.find_element_by_id(RES.ID_SUBMIT)
        # 定义铅笔/橡皮按钮
        pen_erase_button = res_driver.find_element_by_id(RES.ID_PEN)
        # 定义录音/停止按钮
        record_button = res_driver.find_element_by_id(RES.ID_RECORD)
        # 定义播放按钮
        record_play_button = res_driver.find_element_by_id(RES.ID_RECORD_PLAY)
        # 定义查看题目按钮
        question_see_button = res_driver.find_element_by_id(RES.ID_QUESTION_SEE)

        # 定义标记按钮
        feedback_button = res_driver.find_element_by_id(RES.ID_IS_FEEDBACK)



        # 用笔画3笔
        res_driver.swipe(661, 473, 1821, 473)
        res_driver.swipe(661, 1358, 1821, 1358)
        res_driver.swipe(996, 318, 996, 1323)
        res_driver.swipe(1530, 318, 1530, 1323)
        # 点击铅笔按钮变为橡皮擦
        pen_erase_button.click()
        # 擦除一条线
        res_driver.swipe(1530, 318, 1530, 1323)
        # 录音按钮
        record_button.click()
        # 设置录音时间5s
        res_driver.implicitly_wait(5)
        # 再次点击停止录音
        record_button.click()
        # 点击录音播放按钮
        record_play_button.click()
        # 设置播放录音时间5s
        res_driver.implicitly_wait(5)
        # 点击查看题目
        question_see_button.click()
        if findsomething().find_by_message(res_driver, u'原题', 2, 1):
            print u'查看题目功能正常'
        else:
            print u'查看题目功能不正常'
        # 定义关闭查看题目按钮
        question_close_button = res_driver.find_element_by_id('com.xes.drawpanel:id/diss_window')
        # 关闭查看题目
        question_close_button.click()
        # 随机选择一个答题结果
        result[random.randint(0, 2)].click()
        # 点击标记按钮
        feedback_button.click()
        # 点击提交按钮
        submit_button.click()
                # 知识点出错
        show_submit1 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT1)
        # 分析能力弱
        show_submit2 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT2)
        # 基础概念模糊
        show_submit3 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT3)
        # 计算失误
        show_submit4 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT4)
        # 学习习惯较差
        show_submit5 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT5)
        # 马虎粗心
        show_submit6 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT6)
        # 态度不端正
        show_submit7 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT7)
        # 其它
        show_submit8 = res_driver.find_element_by_id(RES.ID_SHOW_SUBMIT8)
        # 1分
        show_score1 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE1)
        # 2分
        show_score2 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE2)
        # 3分
        show_score3 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE3)
        # 4分
        show_score4 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE4)
        # 5分
        show_score5 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE5)
        # 6分
        show_score6 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE6)
        # 7分
        show_score7 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE7)
        # 8分
        show_score8 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE8)
        # 9分
        show_score9 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE9)
        # 10分
        show_score10 = res_driver.find_element_by_id(RES.ID_SHOW_SCORE10)
        # 取消
        cancel_button = res_driver.find_element_by_id(RES.ID_CANCEl)
        # 确认
        yes_button = res_driver.find_element_by_id(RES.ID_YES)

        # 定义出错原因list
        wrong_button_list = [show_submit1, show_submit2, show_submit3, show_submit4, \
                             show_submit5, show_submit6, show_submit7, show_submit8]

        # 定义分数列表
        score_button_list = [show_score1, show_score2, show_score3, show_score4, show_score5, \
                             show_score6, show_score7, show_score8, show_score9, show_score10]
        # 随机选择一个错题原因
        wrong_button_list[random.randint(0, 7)].click()
        # 随机选择一个分数
        score_button_list[random.randint(0, 9)].click()
        # 取消关闭对话框
        cancel_button.click()
        # 再次点击提交按钮
        submit_button.click()
        # 随机选择一个错题原因
        wrong_button_list[random.randint(0, 7)].click()
        # 随机选择一个分数
        score_button_list[random.randint(0, 9)].click()
        # 点击确认提交作业
        yes_button.click()