コード例 #1
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)
コード例 #2
0
 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)
コード例 #3
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)
コード例 #4
0
 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)
コード例 #5
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_15(self):
     '''重新投票'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('div.list-title').click()
     sleep(1)
     try:
         driver.find_element_by_xpath("//div[@id='notice_detail_vote']/div[2]/div/div/label/div").click()
         sleep(1)
         driver.find_element_by_xpath('//div[3]/button').click()
         sleep(1)
         print u"投票成功!"
     except:
         print u"投票失败!"
     driver.find_element_by_xpath('//button[5]').click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/div[2]/div/button[2]').click()
     sleep(1)
     num = driver.find_element_by_xpath("//div[@id='notice_detail_vote']/div[1]/span[2]").text
     if int(num) == 0:
         print u'重新投票设置成功!'
     else:
         print u'重新投票设置失败!'
コード例 #6
0
 def test_knowmob_3(self):
     '''显示较早评论'''
     driver = self.driver
     user.login(self)
     driver.get(self.base_url + "/module/knowledge/index.m")
     time.sleep(2)
     num = randint(3, 16)
     driver.find_element_by_xpath("//div[%s]/div/div/a/strong" %
                                  num).click()
     time.sleep(1)
     comments = open(
         "D:\\work\\mgt_webtest\\data\\know_commentContent_1.txt")
     comment = comments.readlines()
     comments.close()
     for comm in comment:
         driver.find_element_by_xpath("//button[@id='commBtn']").click()
         time.sleep(2)
         self.assertEqual(
             "评论知识",
             driver.find_element_by_xpath(
                 "/html/body/div[1]/div/div[1]/div[2]/h4/strong").text)
         driver.find_element_by_xpath("//*[@id='commentContent']").clear()
         #unicode(rst,errors='ignore')
         driver.find_element_by_xpath(
             "//*[@id='commentContent']").send_keys('%s' % comm)
         time.sleep(3)
         driver.find_element_by_xpath("//*[@id='commSubBtn']").click()
         print u"操作成功!评论内容是:%s" % comm
         time.sleep(3)
     self.assertEqual(u"显示较早的评论...",
                      driver.find_element_by_link_text(u"显示较早的评论...").text)
     driver.find_element_by_link_text(u"显示较早的评论...").click()
     time.sleep(3)
     user.quit_m(self)
コード例 #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)
コード例 #8
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #9
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)
コード例 #10
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)
コード例 #11
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)
コード例 #12
0
 def test_knowmob_2(self):
     '''发表评论'''
     driver = self.driver
     user.login(self)
     driver.get(self.base_url + "/module/knowledge/index.m")        
     time.sleep(2)
     num = randint(3,16)
     driver.find_element_by_xpath("//div[%s]/div/div/a/strong"%num).click()
     time.sleep(1)
     driver.find_element_by_xpath("//button[@id='commBtn']").click()
     time.sleep(1)
     self.assertEqual("评论知识",driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/h4/strong").text)
     comments = open("D:\\work\\mgt_webtest\\data\\know_commentContent.txt")
     comment = comments.readlines()
     comments.close()
     for comm in comment:
         time.sleep(1)
         driver.find_element_by_xpath("//*[@id='commentContent']").clear()
         driver.find_element_by_xpath("//*[@id='commentContent']").send_keys('%s'%comm)
         time.sleep(2)
         driver.find_element_by_xpath("//*[@id='commSubBtn']").click()
         if len(comm.strip()) == 0:#comm.strip()=='':
             driver.get_screenshot_as_file("D:\\work\\mgt_webtest\\screenshot\\knowcommentnull%s.png"%time.strftime("%Y%m%d%H%M%S",time.localtime()))
             print u"评论内容为空!提示信息可见截图:\\screenshot_png\\knowcommentnull%s.png"%time.strftime("%Y%m%d%H%M%S",time.localtime())
         elif len(comm.strip()) > 20000:
             print u"评论内容字符长度大于20000,不允许提交!"
             driver.find_element_by_xpath("//*[@id='commCancel']").click()
         else:
             print u"操作成功!评论内容是:%s"%comm
             time.sleep(1)
             driver.find_element_by_xpath("//button[@id='commBtn']").click()
         time.sleep(3)
     user.quit_m(self)
コード例 #13
0
 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)
コード例 #14
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)
コード例 #15
0
 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()
コード例 #16
0
 def test_knowmob_3(self):
     '''显示较早评论'''
     driver = self.driver
     user.login(self)
     driver.get(self.base_url + "/module/knowledge/index.m")
     time.sleep(2)
     num = randint(3,16)
     driver.find_element_by_xpath("//div[%s]/div/div/a/strong"%num).click()
     time.sleep(1)
     comments = open("D:\\work\\mgt_webtest\\data\\know_commentContent_1.txt")
     comment = comments.readlines()
     comments.close()
     for comm in comment:
         driver.find_element_by_xpath("//button[@id='commBtn']").click()
         time.sleep(2)
         self.assertEqual("评论知识",driver.find_element_by_xpath("/html/body/div[1]/div/div[1]/div[2]/h4/strong").text)
         driver.find_element_by_xpath("//*[@id='commentContent']").clear()
         #unicode(rst,errors='ignore')
         driver.find_element_by_xpath("//*[@id='commentContent']").send_keys('%s'%comm)
         time.sleep(3)
         driver.find_element_by_xpath("//*[@id='commSubBtn']").click()
         print u"操作成功!评论内容是:%s"%comm
         time.sleep(3)
     self.assertEqual(u"显示较早的评论...",driver.find_element_by_link_text(u"显示较早的评论...").text)
     driver.find_element_by_link_text(u"显示较早的评论...").click()
     time.sleep(3)
     user.quit_m(self)
コード例 #17
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)
コード例 #18
0
 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)
コード例 #19
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
コード例 #20
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
コード例 #21
0
 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)
コード例 #22
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #23
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #24
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #25
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)
コード例 #26
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"今日工作小结已创建!"
コード例 #27
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #28
0
ファイル: at_task.py プロジェクト: jmb-cd/webcd_test
 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!'
コード例 #29
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)
コード例 #30
0
def intercept():
    '''
    This function will be invoked when a dynamic request comes.
    It firstly gets request path from evironment variables,
    then invokes corresponding functions according to request path.
    '''
    env = os.environ
    # Get request uri from environment variables
    uri = env['REQUEST_URI']
    # Get request path, leaving out query string
    path = uri.split('?', 1)[0]
    # Construct HTTPResquest object
    req = request.HTTPRequest()

    # Invoke corresponding functions according to request path
    if path == '/register':
        user.register(req)
    elif path == '/login':
        user.login(req)
    elif path == '/logout':
        user.logout(req)
    elif path == '/info':
        user.showinfo(req)
    elif path == '/upload':
        avatar.upload_avatar(req)
    elif re.compile(r'/avatar/(?P<md5>[\w]+)').match(path):
        # Get 32-char long md5, leaving out file ext or other chars.
        # If the length of md5 part is less than 32, get all the part.
        md5 = path[8:40]
        avatar.back_avatar(md5)
    else:
        util.msg_redirect('/static/homepage.html', 'unsupported url')
コード例 #31
0
ファイル: interceptor.py プロジェクト: xiongjp/minusone
def intercept():
    '''
    This function will be invoked when a dynamic request comes.
    It firstly gets request path from evironment variables,
    then invokes corresponding functions according to request path.
    '''
    env = os.environ
    # Get request uri from environment variables 
    uri = env['REQUEST_URI']
    # Get request path, leaving out query string
    path = uri.split('?', 1)[0]
    # Construct HTTPResquest object
    req = request.HTTPRequest()
    
    # Invoke corresponding functions according to request path
    if path == '/register':
        user.register(req)
    elif path == '/login':
        user.login(req)
    elif path == '/logout':
        user.logout(req)
    elif path == '/info':
        user.showinfo(req)
    elif path == '/upload':
        avatar.upload_avatar(req)
    elif re.compile(r'/avatar/(?P<md5>[\w]+)').match(path):
        # Get 32-char long md5, leaving out file ext or other chars.
        # If the length of md5 part is less than 32, get all the part. 
        md5 = path[8:40]
        avatar.back_avatar(md5)
    else:
        util.msg_redirect('/static/homepage.html','unsupported url')
コード例 #32
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_04(self):
     '''编辑公告'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('div.list-title-span.ellipsis').click()
     sleep(1)
     driver.find_element_by_xpath("//div[@id='main_notice_right']/div/div/div/button").click()
     sleep(1)
     now = pub.now()
     driver.find_element_by_css_selector('input[type="text"]').clear()
     driver.find_element_by_css_selector('input[type="text"]').send_keys(u'编辑公告标题-%s'%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='addScrollDiv']/ul/li[9]/button").click()
     title = driver.find_element_by_xpath('//*[@id="notice-detail-warp"]/div[1]/div[1]/div[2]').text
     try:
         self.assertEqual(u'编辑公告标题-%s'%now,title)
         # if title == u'编辑公告标题-%s'%now:
         print u'公告编辑成功!编辑后的公告标题为:%s'%title
     except:
         print u'公告编辑失败!'
コード例 #33
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"本周周计划已存在,测试结束!"
コード例 #34
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"本周周计划已存在,测试结束!"   
コード例 #35
0
ファイル: views.py プロジェクト: lqf96/cwng-bknd
 def login(self):
     user = authenticate(request.form.get("username"),
                         request.form.get("password"))
     if user:
         login(user)
         return SUCCESS_RESP
     else:
         raise APIError(401, "AuthError")
コード例 #36
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_17(self):
     '''结束投票'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('div.list-title').click()
コード例 #37
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()
コード例 #38
0
ファイル: batch.py プロジェクト: SnehitReddy/BIOAuthMedicare
def login_all_users():
    for direc in glob.glob("./UserData/*"):
        uid = direc[11:]
        uid = uid.split('_', 1)[0]
        uid = uid.rjust(4, '0')
        pw = PASSWORD_PREFIX + uid
        biom = glob.glob(direc + "/*.xyt")[0]
        sc = glob.glob(direc + "/*.smartcard")[0]
        login(uid, pw, biom, sc)
コード例 #39
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_18(self):
     '''发布公告_上传本地附件'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('span.mid_text').click()
     sleep(1)
     driver.find_element_by_id('noticeFileUpload').send_keys('D:\\workspace\\webcd_test\\data\\1.jpg')
コード例 #40
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_14(self):
     '''新建公告_添加投票'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     sleep(1)
     driver.find_element_by_css_selector('span.mid_text').click()
     page_notice.addVote(self)
     page_notice.addNotice(self)
コード例 #41
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()
コード例 #42
0
ファイル: test_task.py プロジェクト: jmb-cd/webcd_test
 def test_task_01(self):
     '''新建任务'''
     dr = self.driver
     user.login(self)
     pub.equal(self)
     print dr.title
     sleep(1)
     page_task.gotoTask(self)
     dr.find_element_by_css_selector('span.mid_text').click()
     sleep(1)
     now = pub.now()
     page_task.addTask(self)
     title = dr.find
コード例 #43
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)
コード例 #44
0
ファイル: test_notice.py プロジェクト: jmb-cd/webcd_test
 def test_notice_03(self):
     '''创建公告_置顶'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     sleep(2)
     driver.find_element_by_css_selector('span.mid_text').click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/label[4]').click()
     sleep(1)
     page_notice.addNotice(self)
コード例 #45
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)
コード例 #46
0
ファイル: ordering.py プロジェクト: jmcdona1d/Fiscal_Fresh
def handle_order(request_body, auth_info):
    request_body['recipes'] = copy.deepcopy(request_body)
    request_body['email'] = auth_info['email']
    recipe_details = json.loads(
        get_recipe_ingredients({"id": request_body["id"]}))
    session = Session()
    login(True, session, auth_info)
    ingredients, cart_id = get_ingredients(session, recipe_details)
    response = add_items_to_cart(session, ingredients, cart_id)
    if response.status_code == 200:
        # succesfully added to cart, store user recipe history
        add_recipe_history(request_body)
        print('added to cart and user history')

    return response.text
コード例 #47
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)
コード例 #48
0
ファイル: api.py プロジェクト: 13A5T0N/rs_examen
def login():
    if 'email' in request.form and 'pwd' in request.form:
        email = request.form.get("email")
        pwd = request.form.get("pwd")
    else:
        return "Error: No data inserted"
    return jsonify(user.login(db, email, pwd))
コード例 #49
0
ファイル: emulation.py プロジェクト: 0rqheus/kpi_db_2
 def __init__(self, connection, username, users_list, users_amount):
     Thread.__init__(self)
     self.connection = connection
     self.users_list = users_list
     self.users_amount = users_amount
     user.register(connection, username)
     self.user_id = user.login(connection, username)
コード例 #50
0
def login():
    global this_u_id, admin
    print("-" * 40)
    print("               Login Menu")
    print("-" * 40)
    login = input('''
1 = Register
2 = Already A Member
3 = Main Menu
4 = Exit
    ''')
    print("-" * 40)
    # print("\n")
    if login == '1':
        register()
    elif login == '2':
        print("2 - Login")
        x = input("user name:")
        y = input("password:"******"Are you an administrator? (y/n)")
        this_u_id = user.login(x, y)
        if w == 'y':
            admin = True
        main_menu()
    elif login == '3':
        main_menu()
    else:
        exit()
コード例 #51
0
ファイル: app.py プロジェクト: succulentxb/gen_exam_system
def login():
    username = request.args.get("username")
    password = request.args.get("password")
    login_res = user.login(username, password)
    response = {"status": 1}
    if login_res:
        response["status"] = 0
    return jsonify(response)
コード例 #52
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)
コード例 #53
0
def login():
    username = request.form["username"]
    password = request.form["password"]
    if user.login(username, password):
        return redirect("/frontpage")
    else:
        flash('Wrong username or password', 'flashError')
        return render_template("index.html")
コード例 #54
0
ファイル: main.py プロジェクト: Team-Sigma-Stern/api
def login():
	print(request.data.decode("utf-8"))
	data = json.loads(request.data)
	token = user.login(data["name"],data["password"])
	if token != None:
		return json.dumps({"name":data["name"],"display-name":"i dont know","auth-token":token}),201,{"Content-Type":"application/json"}
	else:
		return json.dumps({"message":"Wrong username or Password!"}),400,{"Content-Type":"application/json"}
コード例 #55
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)
コード例 #56
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)
コード例 #57
0
ファイル: routes.py プロジェクト: Jagedih/golfbook
def login():
    if request.method == "GET":
        return render_template("login.html")
    if request.method == "POST":
        username = request.form["username"]
        password = request.form["password"]
        if(user.login(username,password)):
            return render_template("index.html")
        else:
            return render_template("login.html", message="wrong username or password.")