def test_project_status_4(self):
     '''恢复项目'''
     driver = self.driver
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #过滤为已撤销的项目,恢复列表中的第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='1']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     #点击恢复按钮
     driver.find_element_by_xpath("//div[2]/div/div[2]/span").click()
     time.sleep(2)
     resReason = driver.find_element_by_xpath("//*[@id='MgtPopup-Popup']")
     resReason.find_element_by_xpath("//*[@id='reason']").clear()
     driver.find_element_by_xpath("//*[@id='reason']").send_keys(
         u"恢复理由@%s" % time.ctime())
     time.sleep(2)
     resReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id(
         "confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id(
         "buttonOk").click()
     time.sleep(1)
     print u"项目已恢复!"
     user.quit(self)
Ejemplo n.º 2
0
    def test_newweekplan(self):
        '''新建周计划'''
        driver = self.driver
        driver.get(self.base_url)  # + "/mgt/frame.jsp?url=MGT_PLN")
        user.login(self)
        time.sleep(2)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_plan").click()
        time.sleep(2)
        pub.switchtoframe(self)
        driver.find_element_by_xpath("//span[@id='realname']").click()
        time.sleep(1)

        try:
            driver.find_element_by_xpath(
                "//div[@id='submitButton']/input[2]").click()
            time.sleep(1)
            now = time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime())
            driver.find_element_by_name("modifyTitle").click()
            time.sleep(1)
            driver.find_element_by_id("planTitle").clear()
            driver.find_element_by_id("planTitle").send_keys(u"新计划标题:%s" % now)
            driver.find_element_by_xpath(
                "//div[@id='hideTitleDiv']/span/input[2]").click()
            time.sleep(1)
            driver.find_element_by_xpath("//input[@value='立即发布当前计划']").click(
            )  #/html/body/div[5]/div/div[2]/div/div/table/tbody/tr/td/div/div[3]/div/div/input
            driver.find_element_by_id("mgtConfirmDivId").find_element_by_id(
                "confirmOk").click()
            time.sleep(3)
            print u"新建周计划成功,周计划标题是:%s" % now
        except:
            print u"本周周计划已存在,测试结束!"
 def test_mycomment_03(self):
     '''删除发出的评论'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[4]/a/strong").click()
     time.sleep(2)
     self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
     driver.find_element_by_xpath("//div[2]/div/div/ul/li[2]/a").click()
     time.sleep(2)
     del_before = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'取消')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'确定')]").click()
     time.sleep(2)
     del_after = driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text
     if del_after != del_before:
         print u"删除成功!目前最新的评论内容是:%s"%del_after
     else:
         print u"删除失败!"
     user.quit(self)
 def test_mycomment_02(self):
     '''编辑发出的评论'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[4]/a/strong").click()
     time.sleep(2)
     self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
     driver.find_element_by_xpath("//div[2]/div/div/ul/li[2]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     nowtime = time.ctime()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(u"编辑发出的评论%s"%nowtime)
     #time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     self.assertEqual(u"编辑发出的评论%s"%nowtime,driver.find_element_by_xpath("/html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]").text)
     print u"修改成功!"
     user.quit(self)
 def test_project_status_5(self):
     '''修改项目'''
     driver = self.driver
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为实现中的项目,修改第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//input[@value='修改']").click()
     time.sleep(2)
     driver.find_element_by_id("targetName").clear()
     driver.find_element_by_id("targetName").send_keys(
         u"修改项目名称_%s" % time.strftime("%Y%m%d_%H%M%S", time.localtime()))
     time.sleep(2)
     driver.find_element_by_id("editTargetReason").clear()
     driver.find_element_by_id("editTargetReason").send_keys(u"修改理由@%s" %
                                                             time.ctime())
     time.sleep(2)
     driver.find_element_by_id("submitAdd").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id(
         "confirmOk").click()
     print u"修改成功!修改理由@%s" % time.ctime()
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 6
0
 def test_task_10(self):
     '''撤销及恢复任务'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     page_task.newTask(self)
     sleep(1)
     driver.find_element_by_xpath('//*[@id="taskList"]').click()
     sleep(1)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     #撤销任务
     driver.find_element_by_xpath('//*[@id="taskRevokeBtn"]').click()
     sleep(2)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     sleep(1)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     #恢复任务
     driver.find_element_by_xpath('//*[@id="taskRecoverBtn"]').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="okBtn"]').click()
     sleep(1)
     popInfo_1 = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo_1
     # self.assertEqual(popInfo_1,u'操作成功','Test failed!!!')
     if popInfo == u'操作成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
Ejemplo n.º 7
0
 def test_project_status_3(self):
     '''撤销项目'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PROJECT_MY")        
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为进行中的项目,撤销列表中的第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     pro_name = driver.find_element_by_xpath("//td[3]/a")
     #pro_name.text
     pro_name.click()
     time.sleep(2)
     #点击撤销按钮
     driver.find_element_by_xpath("//div[3]/div/div[2]/span").click()
     time.sleep(2)
     cancelReason = driver.find_element_by_id("MgtPopup-Popup")
     cancelReason.find_element_by_id("reason").clear()
     cancelReason.find_element_by_id("reason").send_keys(u"项目需要撤销!")
     time.sleep(2)
     cancelReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id("buttonOk").click()
     time.sleep(1)
     print u"项目已撤销!"
     user.quit(self)
Ejemplo n.º 8
0
 def test_newweekplan(self):
     '''新建周计划'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PLN")
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_plan").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//span[@id='realname']").click()
     time.sleep(1)
     
     try:
         driver.find_element_by_xpath("//div[@id='submitButton']/input[2]").click()
         time.sleep(1)
         now = time.strftime('%Y-%m-%d_%H-%M-%S',time.localtime())
         driver.find_element_by_name("modifyTitle").click()
         time.sleep(1)
         driver.find_element_by_id("planTitle").clear()
         driver.find_element_by_id("planTitle").send_keys(u"新计划标题:%s"%now)
         driver.find_element_by_xpath("//div[@id='hideTitleDiv']/span/input[2]").click()        
         time.sleep(1)
         driver.find_element_by_xpath("//input[@value='立即发布当前计划']").click()#/html/body/div[5]/div/div[2]/div/div/table/tbody/tr/td/div/div[3]/div/div/input
         driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
         time.sleep(3)
         print u"新建周计划成功,周计划标题是:%s"%now
     except:
         print u"本周周计划已存在,测试结束!"   
 def test_todaylog_05(self):
     '''修改工作记录'''
     driver = self.driver
     driver.get(self.base_url)# + "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     try:
         driver.find_element_by_xpath("//td[3]/a/i").click()        
         time.sleep(1)
         #使用二次定位的方法找到对话框中的文本框
         div = driver.find_element_by_id("myModal").find_element_by_id("modalContent")
         nowtime = time.strftime("%Y_%m_%d-%H_%M_%S",time.localtime())
         div.clear()
         div.send_keys(u"第一个工作记录:%s"%nowtime)
         print u"修改成功!内容如下:今天的第一个工作记录:%s"%nowtime
         time.sleep(2)
         driver.find_element_by_id("btn_worklog_ok").click()
         time.sleep(2)
     except NoSuchElementException, e:
         print u"数据尚未创建!"
         return False
Ejemplo n.º 10
0
 def test_project_status_2(self):
     '''激活项目'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PROJECT_MY")        
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为已完成的项目,撤销第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='2']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     #点击激活按钮
     driver.find_element_by_xpath("//div[2]/div/div[2]/span").click()
     time.sleep(2)
     actReason=driver.find_element_by_xpath("//*[@id='MgtPopup-Popup']")        
     actReason.find_element_by_xpath("//*[@id='reason']").clear()
     driver.find_element_by_xpath("//*[@id='reason']").send_keys(u"激活理由@%s"%time.ctime())
     print u"项目已激活成功!"
     time.sleep(2)
     actReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id("buttonOk").click()
     time.sleep(1)
     print u"项目已激活!"
     user.quit(self)
 def test_planlist_03(self):
     '''查询日计划'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[2]/a/strong").click()
     time.sleep(2)
     driver.find_element_by_css_selector("i.icon-calendar").click()
     driver.find_element_by_xpath(
         "/html/body/div[2]").find_element_by_xpath(
             "//tbody/tr[5]/td[5]").click()
     time.sleep(1)
     driver.find_element_by_xpath("//span[@id='dpYears2']/span/i").click()
     driver.find_element_by_xpath(
         "/html/body/div[3]").find_element_by_xpath(
             "//div[3]/div[3]/table/tbody/tr[5]/td[5]").click()
     time.sleep(1)
     driver.find_element_by_xpath("//button[@id='checkBtn']").click()
     time.sleep(2)
     print u"查询结果成功!"
     driver.find_element_by_xpath("//*[@id='resetBtn']").click()
     print u"查询时间已清空!"
     user.quit(self)
Ejemplo n.º 12
0
 def test_todaylog_03(self):
     '''删除日计划'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//td[3]/a/i").click()
     time.sleep(1)
     dayplan_del = driver.find_element_by_id(
         "myModalDayPlan").find_element_by_id("btn_worklog_delete_dayPlan")
     dayplan_del.click()
     time.sleep(2)
     driver.find_element_by_xpath(
         "//a[contains(text(),'取消')]").click()  #取消删除
     time.sleep(1)
     dayplan_del.click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//a[contains(text(),'确定')]").click()  #确认删除
     time.sleep(2)
     print u"日计划删除成功!"
     user.quit(self)
 def test_mylog_02(self):
     '''查看日志详情'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath(
         "//a[contains(@href, 'mylog.do')]").click()
     time.sleep(2)
     driver.find_element_by_xpath(
         "//div[@id='containerDiv']/div/div[2]/div[3]/div/table/tbody/tr/td/div"
     ).click()
     time.sleep(2)
     logdetail = driver.find_element_by_xpath(
         "/html/body/div/div/div[2]/div[2]/div/div/h4")
     logdetail.text
     print u"您现在看到的日志是%s的日志" % logdetail.text
     driver.find_element_by_xpath("//div[3]/div/div/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'上一个')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'返回日志列表')]").click()
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 14
0
 def test_project_status_4(self):
     '''恢复项目'''
     driver = self.driver
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #过滤为已撤销的项目,恢复列表中的第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='1']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     #点击恢复按钮
     driver.find_element_by_xpath("//div[2]/div/div[2]/span").click()
     time.sleep(2)
     resReason=driver.find_element_by_xpath("//*[@id='MgtPopup-Popup']")
     resReason.find_element_by_xpath("//*[@id='reason']").clear()
     driver.find_element_by_xpath("//*[@id='reason']").send_keys(u"恢复理由@%s"%time.ctime())
     time.sleep(2)
     resReason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     time.sleep(2)
     driver.find_element_by_id("mgtAlertDivId").find_element_by_id("buttonOk").click()
     time.sleep(1)
     print u"项目已恢复!"
     user.quit(self)
Ejemplo n.º 15
0
 def test_task_02(self):
     '''添加事件'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_id('addAffairBtn').click()
     driver.find_element_by_xpath("//input[@id='taskAffairTitle']").clear()
     driver.find_element_by_xpath("//input[@id='taskAffairTitle']").send_keys(u'新建事件标题_%s'%pub.now())
     print u'新建事件成功!事件标题为:新建事件标题_%s'%pub.now()
     sleep(1)
     driver.find_element_by_xpath('//button[@id="addEventSubmitBtn"]').click()
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'创建成功','Test failed!!!')
     if popInfo == u'创建成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
 def test_mylog_01(self):
     '''查看评阅日志权限人'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath(
         "//a[contains(@href, 'mylog.do')]").click()
     time.sleep(2)
     driver.find_element_by_xpath(
         "//a[contains(text(),'看看谁有权评阅您的日志')]").click()
     time.sleep(2)
     pingyue = driver.find_element_by_xpath("/html/body/div[4]/div[2]/div")
     pingyue.text
     print u"有权评阅您的日志的有:%s" % pingyue.text
     driver.get_screenshot_as_file(
         "D:\\work\\mgt_webtest\\screenshot\\permModalpeople%s" %
         time.strftime("%Y%m%d_%H%M%S", time.localtime()))
     time.sleep(2)
     driver.find_element_by_xpath(
         "//div[@id='permModal']/div[3]/button").click(
         )  #find_element_by_xpath('//*[@id="permModal"]').
     user.quit(self)
Ejemplo n.º 17
0
 def test_todaylog_08(self):
     '''预览附件'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     nowhandle = driver.current_window_handle
     driver.find_element_by_xpath("//a[contains(text(),'预览')]").click()
     time.sleep(2)
     allhandles = driver.window_handles
     for handle in allhandles:
         if handle != nowhandle:
             driver.switch_to_window(handle)
             time.sleep(2)
             driver.get_screenshot_as_file(
                 "D:\\work\\mgt_webtest\\screenshot\\dayplan_attachpreview%s.png"
                 % time.strftime("%Y%m%d_%H%M%S", time.localtime()))
             print u"预览成功,截图在screenshot目录下!"
             driver.close()
     driver.switch_to_window(nowhandle)
     time.sleep(3)
     user.quit(self)
Ejemplo n.º 18
0
 def test_task_05(self):
     '''编辑任务'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="taskEditBtn"]').click()
     sleep(0.5)
     now = pub.now()
     driver.find_element_by_xpath('//*[@id="taskTitle"]').clear()
     driver.find_element_by_xpath('//*[@id="taskTitle"]').send_keys('edited_task_title_%s'%now)
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     newTitle = driver.find_element_by_xpath('//div[@id="rightContent"]/div[3]/div/div/span').text
     print u'编辑后的标题:%s'%newTitle
     self.assertEqual(newTitle,'edited_task_title_%s'%now,'Test failed!!!')
     if newTitle == 'edited_task_title_%s'%now:
         print 'Test passed!'
     else:
         print 'Test failed!'
Ejemplo n.º 19
0
 def test_todaylog_06(self):
     '''新建今日工作小结'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     #点击新建工作小结链接,并输入数据创建;若已创建,则打印已创建
     try:
         driver.find_element_by_xpath(
             "//a[contains(text(),'新建工作小结')]").click()
         time.sleep(2)
         #使用二次定位的方法找到对话框中的文本框
         worksumm = driver.find_element_by_id("myModal").find_element_by_id(
             "modalContent")
         nowtime = time.strftime("%Y_%m_%d-%H_%M_%S", time.localtime())
         worksumm.send_keys(u"今日工作小结:%s" % nowtime)
         print u"工作小结新建成功!内容如下:今日工作小结:%s" % nowtime
         driver.find_element_by_id("btn_worklog_ok").click()
         time.sleep(2)
     except NoSuchElementException, e:
         print u"今日工作小结已创建!"
Ejemplo n.º 20
0
 def test_task_06(self):
     '''任务总结'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="taskSummaryBtn"]').click()
     sleep(0.5)
     now = pub.now()
     driver.find_element_by_xpath('//div[@role="presentation"]/div/div').clear()
     driver.find_element_by_xpath('//div[@role="presentation"]/div/div').send_keys('task_summary_%s'%now)
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     sleep(0.5)
     taskSummary = driver.find_element_by_xpath('//div[@id="viewContent"]/table/tbody/tr[5]/td[2]/span/p').text
     print u'总结内容是:%s'%taskSummary
     self.assertEqual(taskSummary,'task_summary_%s'%now,'Test failed!!!')
     if taskSummary == 'task_summary_%s'%now:
         print 'Test passed!'
     else:
         print 'Test failed!'
Ejemplo n.º 21
0
 def test_todaylog_05(self):
     '''修改工作记录'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     try:
         driver.find_element_by_xpath("//td[3]/a/i").click()
         time.sleep(1)
         #使用二次定位的方法找到对话框中的文本框
         div = driver.find_element_by_id("myModal").find_element_by_id(
             "modalContent")
         nowtime = time.strftime("%Y_%m_%d-%H_%M_%S", time.localtime())
         div.clear()
         div.send_keys(u"第一个工作记录:%s" % nowtime)
         print u"修改成功!内容如下:今天的第一个工作记录:%s" % nowtime
         time.sleep(2)
         driver.find_element_by_id("btn_worklog_ok").click()
         time.sleep(2)
     except NoSuchElementException, e:
         print u"数据尚未创建!"
         return False
 def test_viewlog_03(self):
     '''删除评阅日志'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[5]/a/strong").click()
     time.sleep(2)
     self.assertEqual("评阅日志",driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/span").text)
     driver.find_element_by_xpath("//div[@id='viewlogList']/table/tbody/tr/td/div").click()
     time.sleep(2)
     theFirstInfo = driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'取消')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'确定')]").click()
     time.sleep(2)
     #self.verifyEqual(theFirstInfo,driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text)
     if theFirstInfo != driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text:
         print u"删除成功!"
         print u"删除的评论内容是:%s"%theFirstInfo
     else:
         print u"删除失败"
     user.quit(self)
 def test_viewlog_02(self):
     '''编辑评阅日志'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[5]/a/strong").click()
     time.sleep(2)
     self.assertEqual("评阅日志",driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/span").text)
     driver.find_element_by_xpath("//div[@id='viewlogList']/table/tbody/tr/td/div").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(2)
     nowtime = time.ctime()
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(u"编辑经理评阅日志@%s"%nowtime)
     print u"编辑评阅日志成功!编辑后的评论内容:编辑经理评阅日志@%s"%nowtime
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     self.assertEqual(u"编辑经理评阅日志@%s"%nowtime,driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text)
     user.quit(self)
     driver.close()
Ejemplo n.º 24
0
 def test_project_status_5(self):
     '''修改项目'''
     driver = self.driver
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为实现中的项目,修改第一个项目
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//input[@value='修改']").click()
     time.sleep(2)
     driver.find_element_by_id("targetName").clear()
     driver.find_element_by_id("targetName").send_keys(u"修改项目名称_%s"%time.strftime("%Y%m%d_%H%M%S",time.localtime()))
     time.sleep(2)
     driver.find_element_by_id("editTargetReason").clear()
     driver.find_element_by_id("editTargetReason").send_keys(u"修改理由@%s"%time.ctime())
     time.sleep(2)
     driver.find_element_by_id("submitAdd").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     print u"修改成功!修改理由@%s"%time.ctime()
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 25
0
 def test_viewweekplan(self):
     '''查看周计划'''
     driver = self.driver
     driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PLN")
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_plan").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//span[@id='realname']").click()
     time.sleep(1)
     #默认新建本周的计划,若已存在,则直接进入本周计划
     now_a = time.strftime('%Y-%m-%d_%H-%M-%S',time.localtime())
     
     try:            
         driver.find_element_by_xpath("//div[@id='weekInfo']/div/input").click()
     except:
         print u"计划不存在,无法查看,测试结束!"
     time.sleep(2)
     try:
         driver.find_element_by_name("modifyPlan").click()
     except:
         driver.find_element_by_name("modifyTitle").click()
         driver.find_element_by_id("planTitle").clear()
         driver.find_element_by_id("planTitle").send_keys(u"新计划标题:%s"%now_a)
         time.sleep(3)
         driver.find_element_by_xpath("//div[@id='hideTitleDiv']/span/input[2]").click()
         time.sleep(1)
         driver.find_element_by_xpath("//input[@value='立即发布当前计划']").click()
         driver.find_element_by_id("mgtConfirmDivId").find_element_by_id("confirmOk").click()
     print u"计划已发布!计划标题是:新计划标题:%s"%now_a
     time.sleep(1)
Ejemplo n.º 26
0
 def test_task_03(self):
     '''发起讨论'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath("//button[2]").click()
     sleep(1)
     driver.find_element_by_xpath('//input[@id="talkTitle"]').clear()
     driver.find_element_by_xpath('//input[@id="talkTitle"]').send_keys(u'新发起的讨论标题_%s'%pub.now())
     # print u'讨论发起成功!名称为:新发起的讨论标题_%s'%pub.now()
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="talkSubmit"]').click()
     sleep(0.5)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'创建成功','Test failed!!!')
     if popInfo == u'创建成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
Ejemplo n.º 27
0
 def test_task_04(self):
     '''上传文档'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     driver.find_element_by_css_selector('td.ellipsis.ch').click()
     sleep(1)
     driver.find_element_by_xpath('//button[3]').click()
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="mgtfile"]').send_keys('D:\\work\\mgt_webtest\\data\\mobilebook.txt')
     sleep(0.5)
     driver.find_element_by_xpath('//*[@id="submitBtn"]').click()
     print u'上传文档成功!'
     sleep(0.5)
     popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text
     print u'提示信息:%s'%popInfo
     self.assertEqual(popInfo,u'上传成功','Test failed!!!')
     if popInfo == u'上传成功':
         print 'Test passed!'
     else:
         print 'Test failed!'
Ejemplo n.º 28
0
    def test_viewlog_01(self):
        '''发布评阅日志'''
        driver = self.driver
        driver.get(self.base_url)
        user.login(self)
        time.sleep(2)
        self.assertEqual("今目标企业工作平台", driver.title)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_log").click()
        pub.switchtoframe(self)
        driver.find_element_by_xpath("//li[5]/a/strong").click()
        time.sleep(2)
        self.assertEqual(
            "评阅日志",
            driver.find_element_by_xpath(
                "/html/body/div[1]/div/div[2]/div[1]/div/span").text)
        driver.find_element_by_xpath(
            "//div[@id='viewlogList']/table/tbody/tr/td/div").click()
        time.sleep(2)
        #发布一条为空的评论,查看错误信息提示是否正确
        driver.find_element_by_xpath("//*[@id='btnComment']").click()
        print u"%s" % driver.find_element_by_class_name("valid-error").text
        self.assertEqual(u"请输入评论内容或上传附件!",
                         driver.find_element_by_class_name("valid-error").text)
        time.sleep(2)
        nowtime = time.ctime()
        driver.find_element_by_xpath("//*[@id='logComment']").send_keys(
            u"经理评阅日志@%s" % nowtime)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='btnComment']").click()
        print u"经理评阅日志成功!内容为:经理评阅日志@%s" % nowtime
        time.sleep(2)
        driver.switch_to_default_content()
        driver.find_element_by_xpath("//a[contains(text(),'安全退出')]").click()
        time.sleep(2)

        #被评阅的员工查看经理发出的评阅信息
        driver.get(self.base_url)
        user.login_a(self)
        time.sleep(2)
        self.assertEqual("今目标企业工作平台", driver.title)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_log").click()
        pub.switchtoframe(self)
        driver.find_element_by_xpath("//li[4]/a/strong").click()
        time.sleep(2)
        self.assertEqual(
            "我的评论",
            driver.find_element_by_xpath(
                "/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
        managerView = driver.find_element_by_xpath(
            "html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]"
        )
        managerView.text
        self.assertEqual(u'经理评阅日志@%s' % nowtime, managerView.text)
        print u"员工可看到领导发布的评阅信息!"
        user.quit(self)
        driver.close()
Ejemplo n.º 29
0
    def test_sendnewemail(self):
        '''发送新邮件'''
        driver = self.driver
        driver.get(self.base_url)# + "/mgt/frame.jsp?url=RA8B4")
        user.login(self)
        time.sleep(3)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_email").click()
        time.sleep(2)
        pub.switchtoframe(self)        
        driver.find_element_by_id("li_1").click()
        time.sleep(5)
        driver.find_element_by_id("tos").send_keys("*****@*****.**")
        time.sleep(1)
        driver.find_element_by_id("cc").send_keys("*****@*****.**")
        time.sleep(1)
        now = time.strftime('%Y-%m-%d_%H-%M-%S',time.localtime())
        mailtitle = driver.find_element_by_id("title")
        mailtitle.send_keys(u"邮件标题_%s"%now)
        driver.find_element_by_id("commonUpload_a").click()
        driver.find_element_by_xpath("//input[@name='0']").send_keys("D:\\work\\mgt_webtest\\data\\mailcontent.txt")
        time.sleep(3)
        driver.find_element_by_id("commonUpload_a").click()
        driver.find_element_by_xpath("//input[@name='1']").send_keys("D:\\work\\mgt_webtest\\data\\worklog.txt")
        time.sleep(6)
        driver.find_element_by_xpath("/html/body/div[5]/div/div[2]/div/div[2]/table/tbody/tr/td/div/div[5]/input").click()
        print u"发送邮件成功,邮件主题是:'邮件标题_%s'"%now
        #driver.implicitly_wait(30)
        time.sleep(6)

        #打开收件箱检查是否收到邮件
        driver.get("http://www.126.com")
        time.sleep(3)
        driver.find_element_by_id("idInput").clear()
        driver.find_element_by_id("idInput").send_keys("itaobay")
        time.sleep(2)
        driver.find_element_by_id("pwdInput").clear()
        driver.find_element_by_id("pwdInput").send_keys("guanghui")
        driver.find_element_by_id("loginBtn").click()
        time.sleep(5)
        driver.find_element_by_id("_mail_component_34_34").click()
        time.sleep(5)
        driver.find_element_by_id("_mail_component_40_40").click()
        time.sleep(3)
        newmailtitle = driver.find_element_by_xpath("/html/body/div[2]/div/div[2]/div/div/div[4]/div[2]/div/div[2]/span").text#click()
        #newmailtitle = driver.find_element_by_xpath("/html/body/div[2]/div/div[3]/div/div/div/div/h1").text
        if newmailtitle == u"邮件标题_%s"%now:
            print u"邮件收到,测试通过!邮件标题是:%s"%newmailtitle
        else:
            driver.get_screenshot_as_file("D:\\work\\mgt_webtest\\screenshot_png\\邮件未收到%s.png"%time.strftime("%Y%m%d%H%M%S",time.localtime()))
            print u"邮件未收到,测试失败,请人工查看原因!"
        driver.delete_all_cookies()
 def test_todaylog_09(self):
     '''查看访问记录'''
     driver = self.driver
     driver.get(self.base_url)# + "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'访问记录')]").click()
     time.sleep(1)
     print u"访问记录查看成功!"
     user.quit(self)
Ejemplo n.º 31
0
 def test_todaylog_09(self):
     '''查看访问记录'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'访问记录')]").click()
     time.sleep(1)
     print u"访问记录查看成功!"
     user.quit(self)
 def test_todaylog_15(self):
     '''查看本周计划'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'本周计划')]").click()
     driver.get_screenshot_as_file("D:\\work\\mgt_webtest\\screenshot\\worklogtoweekplan%s"%time.strftime("%Y%m%d_%H%M%S",time.localtime()))
     time.sleep(2)
     driver.find_element_by_xpath("//div[@id='modal4weekplan']/div/button").click()#//button[@type='button'])[2]
     user.quit(self)
 def test_todaylog_11(self):
     '''发表评论'''
     driver = self.driver
     driver.get(self.base_url)#+ "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//*[@id='logComment']").send_keys(u"发表评论@%s"%time.ctime())
     print u"发表评论内容为:发表评论@%s"%time.ctime()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='btnComment']").click()
     time.sleep(3)
     user.quit(self)
Ejemplo n.º 34
0
 def test_task_13(self):
     '''负责人为空_任务待分派'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     sleep(1)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_task").click()
     sleep(1)
     pub.switchtoframe(self)
     page_task.newTask_no_principal(self)
     sleep(1)
     driver.find_element_by_xpath("//li[@id='left_li_wait_send']/a").click()
     sleep(1)
     taskTitle = driver.find_element_by_css_selector('td.ellipsis.ch').text
     print u'待分派任务第一条标题为:%s'%taskTitle
Ejemplo n.º 35
0
 def test_weibo_add(self):
     '''发微博'''
     driver = self.driver
     driver.get(self.base_url)
     time.sleep(3)
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_twitter").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//textarea").send_keys(u"测试,测试!%s"%time.ctime())
     time.sleep(3)
     driver.find_element_by_xpath("//button[@type='button']").click()
     print u"微博发布!"
     user.quit(self)
    def test_viewlog_01(self):
        '''发布评阅日志'''
        driver = self.driver
        driver.get(self.base_url)     
        user.login(self)
        time.sleep(2)
        self.assertEqual("今目标企业工作平台",driver.title)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_log").click()
        pub.switchtoframe(self)
        driver.find_element_by_xpath("//li[5]/a/strong").click()
        time.sleep(2)
        self.assertEqual("评阅日志",driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[1]/div/span").text)
        driver.find_element_by_xpath("//div[@id='viewlogList']/table/tbody/tr/td/div").click()
        time.sleep(2)
        #发布一条为空的评论,查看错误信息提示是否正确
        driver.find_element_by_xpath("//*[@id='btnComment']").click()
        print u"%s"%driver.find_element_by_class_name("valid-error").text
        self.assertEqual(u"请输入评论内容或上传附件!",driver.find_element_by_class_name("valid-error").text)
        time.sleep(2)
        nowtime = time.ctime()
        driver.find_element_by_xpath("//*[@id='logComment']").send_keys(u"经理评阅日志@%s"%nowtime)
        time.sleep(2)
        driver.find_element_by_xpath("//*[@id='btnComment']").click()
        print u"经理评阅日志成功!内容为:经理评阅日志@%s"%nowtime
        time.sleep(2)
        driver.switch_to_default_content()
        driver.find_element_by_xpath("//a[contains(text(),'安全退出')]").click()
        time.sleep(2)

        #被评阅的员工查看经理发出的评阅信息
        driver.get(self.base_url)     
        user.login_a(self)
        time.sleep(2)
        self.assertEqual("今目标企业工作平台",driver.title)
        pub.module_icon(self)
        driver.find_element_by_class_name("j_ico_log").click()
        pub.switchtoframe(self)
        driver.find_element_by_xpath("//li[4]/a/strong").click()
        time.sleep(2)
        self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
        managerView = driver.find_element_by_xpath("html/body/div/div/div[2]/div[2]/div/table/tbody/tr[1]/td/div[1]/span[1]")
        managerView.text
        self.assertEqual(u'经理评阅日志@%s'%nowtime,managerView.text)
        print u"员工可看到领导发布的评阅信息!"
        user.quit(self)
        driver.close()
Ejemplo n.º 37
0
 def test_todaylog_11(self):
     '''发表评论'''
     driver = self.driver
     driver.get(self.base_url)  #+ "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//*[@id='logComment']").send_keys(
         u"发表评论@%s" % time.ctime())
     print u"发表评论内容为:发表评论@%s" % time.ctime()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='btnComment']").click()
     time.sleep(3)
     user.quit(self)
Ejemplo n.º 38
0
 def test_todaylog_15(self):
     '''查看本周计划'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'本周计划')]").click()
     driver.get_screenshot_as_file(
         "D:\\work\\mgt_webtest\\screenshot\\worklogtoweekplan%s" %
         time.strftime("%Y%m%d_%H%M%S", time.localtime()))
     time.sleep(2)
     driver.find_element_by_xpath("//div[@id='modal4weekplan']/div/button"
                                  ).click()  #//button[@type='button'])[2]
     user.quit(self)
Ejemplo n.º 39
0
def project_info(self):
    '''打开状态为实现中的第一个项目'''
    driver = self.driver
    driver.get(self.base_url)  # + "/mgt/frame.jsp?url=MGT_PROJECT_MY")
    user.login(self)
    time.sleep(2)
    pub.module_icon(self)
    driver.find_element_by_class_name("j_ico_project").click()
    pub.switchtoframe(self)
    #筛选状态为进行中的项目,给第一个项目新建协商
    driver.find_element_by_id("statusFilter").click()
    time.sleep(0.5)
    filt = driver.find_element_by_id("mainStatusChange")
    time.sleep(1)
    filt.find_element_by_xpath("//option[@value='0']").click()
    time.sleep(1)
    driver.find_element_by_xpath("//td[3]/a").click()
    time.sleep(2)
def project_info(self):
    """打开状态为实现中的第一个项目"""
    driver = self.driver
    driver.get(self.base_url)  # + "/mgt/frame.jsp?url=MGT_PROJECT_MY")
    user.login(self)
    time.sleep(2)
    pub.module_icon(self)
    driver.find_element_by_class_name("j_ico_project").click()
    pub.switchtoframe(self)
    # 筛选状态为进行中的项目,给第一个项目新建协商
    driver.find_element_by_id("statusFilter").click()
    time.sleep(0.5)
    filt = driver.find_element_by_id("mainStatusChange")
    time.sleep(1)
    filt.find_element_by_xpath("//option[@value='0']").click()
    time.sleep(1)
    driver.find_element_by_xpath("//td[3]/a").click()
    time.sleep(2)
 def test_project_add(self):
     '''新建项目'''
     driver = self.driver
     #driver.get(self.base_url)# + "/mgt/frame.jsp?url=MGT_PROJECT_MY")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     driver.find_element_by_id("realname").click()
     time.sleep(1)
     now = time.strftime('%Y%m%d_%H%M%S', time.localtime())
     driver.find_element_by_id("targetName").send_keys(u"项目名称_%s" % now)
     time.sleep(1)
     f1 = driver.find_element_by_xpath(
         "//span/table/tbody/tr[2]/td/iframe"
     )  #/html/body/div[5]/div/div[2]/div/div/div[2]/table/tbody/tr[3]/td/div/span/table/tbody/tr[2]/td/iframe")
     driver.switch_to_frame(f1)
     driver.find_element_by_xpath("//*[@id='tinymce']").send_keys(
         u"项目描述@%s" % time.ctime())
     driver.switch_to_default_content()
     pub.switchtoframe(self)
     time.sleep(1)
     driver.find_element_by_id("beginDateCheckBox").click()
     time.sleep(1)
     driver.find_element_by_id("endDateCheckBox").click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//a[@id='selectUserListBtnHref']").click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//input[@id='userListSelectSelfInput']").click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//input[@id='userListSubmitButton']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//*[@id='submitAdd']").click()
     time.sleep(1)
     driver.find_element_by_id("confirmOk").click()
     print u"新建项目成功!项目名称_%s" % now
     time.sleep(2)
     user.quit(self)
 def test_planlist_01(self):
     '''新建日计划'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     time.sleep(3)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[2]/a/strong").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'新建日计划')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='dayPlanContent']").send_keys(u"今日工作计划@%s"%time.ctime())
     time.sleep(3)
     driver.find_element_by_xpath("//*[@id='btn_worklog_ok_dayPlan']").click()
     user.quit(self)
 def test_mycomment_01(self):
     '''评论标签切换'''
     driver = self.driver
     driver.get(self.base_url)     
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[4]/a/strong").click()
     time.sleep(2)
     self.assertEqual("我的评论",driver.find_element_by_xpath("/html/body/div/div/div[2]/div[1]/div/div/div/span").text)
     driver.find_element_by_xpath("//div[2]/div/div/ul/li[2]/a").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(@href, 'mycomment.do?type=received')]").click()
     print u"测试通过!"
     time.sleep(2)
     user.quit(self)
 def test_todaylog_02(self):
     '''日计划状态修改'''
     driver = self.driver
     driver.get(self.base_url)# + "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     planstatus = driver.find_element_by_xpath("//td/a/i")
     if planstatus.get_attribute('class') == 'mpic-deny':
         driver.find_element_by_css_selector('i.mpic-deny').click()
         print u"状态修改为已完成!"
     else:
         driver.find_element_by_css_selector('i.mpic-ok').click()
         print u"状态修改为未完成!"
     time.sleep(2)
     user.quit(self)
 def test_todaylog_12(self):
     '''修改评论'''
     driver = self.driver
     driver.get(self.base_url)#+ "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(3)
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(u"编辑评论@%s"%time.ctime())
     print u"评论内容修改为:编辑评论@%s"%time.ctime()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     user.quit(self)
 def test_todaylog_07(self):
     '''上传附件'''
     driver = self.driver
     driver.get(self.base_url)# + "/module/worklog/userfo.do?locale=zh_CN")        
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台",driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)        
     driver.find_element_by_xpath("//a[contains(text(),'上传附件')]").click()
     time.sleep(1)
     upatt = driver.find_element_by_id("attachForm").find_element_by_id("mgtfile")
     upatt.send_keys("D:\\work\\mgt_webtest\\data\\mailcontent.txt")
     print u"上传附件成功!"
     time.sleep(2)
     driver.find_element_by_id("myModal").find_element_by_id("btn_worklog_ok").click()
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 47
0
 def test_todaylog_12(self):
     '''修改评论'''
     driver = self.driver
     driver.get(self.base_url)  #+ "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click()
     time.sleep(3)
     driver.find_element_by_xpath("//*[@id='commentText']").clear()
     driver.find_element_by_xpath("//*[@id='commentText']").send_keys(
         u"编辑评论@%s" % time.ctime())
     print u"评论内容修改为:编辑评论@%s" % time.ctime()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='editCommentOk']").click()
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 48
0
 def test_todaylog_02(self):
     '''日计划状态修改'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     planstatus = driver.find_element_by_xpath("//td/a/i")
     if planstatus.get_attribute('class') == 'mpic-deny':
         driver.find_element_by_css_selector('i.mpic-deny').click()
         print u"状态修改为已完成!"
     else:
         driver.find_element_by_css_selector('i.mpic-ok').click()
         print u"状态修改为未完成!"
     time.sleep(2)
     user.quit(self)
 def test_project_status_1(self):
     '''完成项目'''
     driver = self.driver
     driver.get(self.base_url)  # + "/mgt/frame.jsp?url=MGT_PROJECT_MY")
     user.login(self)
     time.sleep(2)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_project").click()
     pub.switchtoframe(self)
     #筛选状态为进行中的项目,将第一个项目状态置为已完成
     driver.find_element_by_id("statusFilter").click()
     time.sleep(0.5)
     filt = driver.find_element_by_id("mainStatusChange")
     time.sleep(1)
     filt.find_element_by_xpath("//option[@value='0']").click()
     time.sleep(1)
     driver.find_element_by_xpath("//td[3]/a").click()
     time.sleep(2)
     #点击完成按钮
     driver.find_element_by_xpath("//div[4]/div/div[2]/span").click()
     time.sleep(2)
     okreason = driver.find_element_by_id("MgtPopup-Popup")
     okreason.find_element_by_id("reason").clear()
     okreason.find_element_by_id("reason").send_keys(u"项目已完成!")
     time.sleep(2)
     okreason.find_element_by_xpath("//input[@value='提交']").click()
     time.sleep(1)
     driver.find_element_by_id("mgtConfirmDivId").find_element_by_id(
         "confirmOk").click()
     time.sleep(1)
     oktext = driver.find_element_by_id(
         "mgtAlertDivId").find_element_by_class_name("alertContentClass")
     oktext.text
     if oktext.text == u"修改成功":
         print u"项目已完成!"
         driver.find_element_by_id("mgtAlertDivId").find_element_by_id(
             "buttonOk").click()
         user.quit(self)
     else:
         print u"项目修改失败!!!"
         user.quit(self)
Ejemplo n.º 50
0
 def test_pline_add(self):
     '''新建主线'''
     driver = self.driver
     #driver.get(self.base_url)# + "/module/igoal/index.do?locale=zh_CN")
     user.login(self)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_pline").click()
     time.sleep(2)
     pub.switchtoframe(self)
     driver.implicitly_wait(30)
     driver.find_element_by_xpath(u"//a[contains(text(),'新建主线')]").click()
     driver.implicitly_wait(30)
     driver.find_element_by_xpath("//input[@id='toNewigoalTitle']").clear()
     newline = driver.find_element_by_xpath(
         "//input[@id='toNewigoalTitle']")
     now = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime())
     newline.send_keys(u"新建主线_%s" % now)
     time.sleep(3)
     driver.find_element_by_xpath("//button[@id='editIgoalOk']").click()
     time.sleep(2)
     print u"新建主线成功!主线名称为:新建主线_%s" % now
 def test_planlist_01(self):
     '''新建日计划'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     time.sleep(3)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[2]/a/strong").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'新建日计划')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//*[@id='dayPlanContent']").send_keys(
         u"今日工作计划@%s" % time.ctime())
     time.sleep(3)
     driver.find_element_by_xpath(
         "//*[@id='btn_worklog_ok_dayPlan']").click()
     user.quit(self)
Ejemplo n.º 52
0
 def test_todaylog_07(self):
     '''上传附件'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'上传附件')]").click()
     time.sleep(1)
     upatt = driver.find_element_by_id("attachForm").find_element_by_id(
         "mgtfile")
     upatt.send_keys("D:\\work\\mgt_webtest\\data\\mailcontent.txt")
     print u"上传附件成功!"
     time.sleep(2)
     driver.find_element_by_id("myModal").find_element_by_id(
         "btn_worklog_ok").click()
     time.sleep(2)
     user.quit(self)
 def test_planlist_02(self):
     '''日计划状态'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     time.sleep(3)
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[2]/a/strong").click()
     time.sleep(2)
     driver.find_element_by_css_selector("i.mpic-deny").click()
     time.sleep(2)
     print u"日计划状态已改为已完成!"
     driver.find_element_by_xpath("//a[2]/span").click()
     time.sleep(1)
     driver.find_element_by_css_selector("i.mpic-ok").click()
     time.sleep(1)
     print u"日计划状态恢复为未完成!"
     user.quit(self)
Ejemplo n.º 54
0
 def test_viewlog_03(self):
     '''删除评阅日志'''
     driver = self.driver
     driver.get(self.base_url)
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//li[5]/a/strong").click()
     time.sleep(2)
     self.assertEqual(
         "评阅日志",
         driver.find_element_by_xpath(
             "/html/body/div[1]/div/div[2]/div[1]/div/span").text)
     driver.find_element_by_xpath(
         "//div[@id='viewlogList']/table/tbody/tr/td/div").click()
     time.sleep(2)
     theFirstInfo = driver.find_element_by_xpath(
         "/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td"
     ).text
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'取消')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(2)
     driver.find_element_by_xpath("//a[contains(text(),'确定')]").click()
     time.sleep(2)
     #self.verifyEqual(theFirstInfo,driver.find_element_by_xpath("/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td").text)
     if theFirstInfo != driver.find_element_by_xpath(
             "/html/body/div[1]/div/div[2]/div[4]/div/div/div[6]/div/table/tbody/tr[2]/td"
     ).text:
         print u"删除成功!"
         print u"删除的评论内容是:%s" % theFirstInfo
     else:
         print u"删除失败"
     user.quit(self)
Ejemplo n.º 55
0
 def test_todaylog_10(self):
     '''删除附件'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//a[contains(text(),'取消')]").click()  #取消删除
     time.sleep(1)
     driver.find_element_by_xpath("//a[contains(text(),'删除')]").click()
     time.sleep(1)
     driver.find_element_by_xpath(
         "//a[contains(text(),'确定')]").click()  #确定删除
     print u"删除成功!"
     time.sleep(2)
     user.quit(self)
Ejemplo n.º 56
0
 def test_todaylog_04(self):
     '''新建工作记录'''
     driver = self.driver
     driver.get(
         self.base_url)  # + "/module/worklog/userfo.do?locale=zh_CN")
     user.login(self)
     time.sleep(2)
     self.assertEqual("今目标企业工作平台", driver.title)
     pub.module_icon(self)
     driver.find_element_by_class_name("j_ico_log").click()
     pub.switchtoframe(self)
     driver.find_element_by_xpath("//a[contains(text(),'新建工作记录')]").click()
     time.sleep(2)
     #使用二次定位的方法找到对话框中的文本框
     worklog = driver.find_element_by_id("myModal").find_element_by_id(
         "modalContent")
     worklog.send_keys(u"工作记录:%s" %
                       time.strftime("%Y_%m_%d-%H_%M_%S", time.localtime()))
     time.sleep(1)
     driver.find_element_by_id("btn_worklog_ok").click()
     time.sleep(2)
     print u"工作记录:%s" % time.strftime("%Y_%m_%d-%H_%M_%S", time.localtime())
     user.quit(self)