Пример #1
0
 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'公告编辑失败!'
Пример #2
0
 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'重新投票设置失败!'
Пример #3
0
 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()
Пример #4
0
 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')
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
 def test_notice_10(self):
     '''删除栏目'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('#notice_label_setting').click()
     sleep(1)
     #点击删除按钮
     driver.find_element_by_xpath('//tr[4]/td[4]/div/button[2]').click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/div[2]/div/button[2]').click()
     sleep(1)
     print u'删除栏目成功!'
Пример #8
0
 def test_notice_13(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').click()
     sleep(1)
     driver.find_element_by_xpath('//div[3]/div[5]').click()
     sleep(1)
     now = pub.now()
     driver.get_screenshot_as_file("D:\\workspace\\webcd_test\\screenshot\\preview%s.png"%now)
     print u'预览页面已保存为文件:D:\\workspace\\webcd_test\\screenshot\\preview%s.png'%now
     print u'查看浏览记录完成!'
Пример #9
0
 def test_notice_09(self):
     '''编辑栏目'''
     driver = self.driver
     user.login(self)
     pub.equal(self)
     print driver.title
     page_notice.gotoNotice(self)
     driver.find_element_by_css_selector('#notice_label_setting').click()
     sleep(1)
     driver.find_element_by_xpath('//tr[4]/td[4]/div/button').click()
     sleep(1)
     now = pub.now_s()
     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='noticeShowDialogContent']/div/div[2]/div[2]/button[2]").click()
     sleep(1)
     print u'编辑栏目成功!名称是:编辑栏目-%s'%now
Пример #10
0
 def test_notice_16(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').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"投票失败!"
Пример #11
0
 def test_notice_11(self):
     '''新建栏目_创建公告页面'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     sleep(1)
     driver.find_element_by_css_selector('span.mid_text').click()
     sleep(1)
     driver.find_element_by_css_selector('#addColumn').click()
     sleep(1)
     now = pub.now_s()
     driver.find_element_by_xpath('//div[2]/div/div/div[2]/input').send_keys(u'新栏目-%s'%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='noticeShowDialogContent']/div/div[2]/div[2]/button[2]").click()
     sleep(1)
     print u'新建栏目:新栏目-%s'%now
Пример #12
0
 def test_notice_08(self):
     '''添加栏目'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     sleep(1)
     driver.find_element_by_css_selector('#notice_label_setting').click()
     sleep(1)
     driver.find_element_by_xpath("//div[@id='columnListContent']/div/div/button").click()
     sleep(1)
     now = pub.now_s()
     driver.find_element_by_css_selector('input[type="text"]').send_keys("column-name-%s"%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='noticeShowDialogContent']/div/div[2]/div[2]/button[2]").click()
     sleep(1)
     print u'创建栏目成功!名称是:column-name-%s'%now
Пример #13
0
 def test_notice_02(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)
     now = pub.now()
     driver.find_element_by_css_selector('input[type="text"]').send_keys(u"公告标题_%s"%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='editContent']/div/div/div/div").send_keys(u'公告内容_%s'%now)
     sleep(1)
     driver.find_element_by_xpath('//button[3]').click()
     sleep(1)
     driver.get_screenshot_as_file("D:\\workspace\\webcd_test\\screenshot\\preview%s.png"%now)
     print u'预览页面已保存为文件:D:\\workspace\\webcd_test\\screenshot\\preview%s.png'%now
Пример #14
0
 def test_notice_12(self):
     '''删除公告'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     title_1 = driver.find_element_by_css_selector('div.list-title').text
     driver.find_element_by_css_selector('div.list-title').click()
     sleep(1)
     driver.find_element_by_xpath("//button[3]").click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/div[2]/div/button[2]').click()
     sleep(1)
     title_2 = driver.find_element_by_css_selector('div.list-title').text
     if title_1 == title_2:
         print u'公告删除失败!'
     else:
         print u'公告删除成功!'
Пример #15
0
 def test_notice_07(self):
     '''允许评论-发表评论'''
     driver = self.driver
     user.login(self)
     sleep(2)
     pub.equal(self)
     print driver.title
     sleep(1)
     page_notice.gotoNotice(self)
     sleep(1)
     driver.find_element_by_css_selector('span.mid_text').click()
     sleep(1)
     driver.find_element_by_xpath('//*[@id="addScrollDiv"]/ul/li[7]/div[2]/label[1]').click()
     driver.find_element_by_xpath('//div[2]/label[4]').click()
     page_notice.addNotice(self)
     now = pub.now()
     driver.find_element_by_xpath("//*[@id='cke_notice_comment_desc_editor']/div/div/div").send_keys(u'评论-我是机器人%s'%now)
     sleep(1)
     driver.find_element_by_xpath("//div[@id='notice-detail-warp']/div[4]/div[3]/button").click()
     sleep(1)
     print u'已发表评论内容:评论-我是机器人%s'%now
Пример #16
0
 def test_notice_05(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').click()
     sleep(1)
     driver.find_element_by_xpath("//div[@id='main_notice_right']/div/div/div/button[2]").click()
     sleep(1)
     driver.find_element_by_xpath('//div[2]/div[2]/div/button[2]').click()
     sleep(1)
     fabu_button = driver.find_element_by_xpath("//div[@id='main_notice_right']/div/div/div/button[2]").text
     try:
         self.assertEqual(u'发布',fabu_button)
         print u'撤销公告成功'
     except:
         print u'撤销公告失败'