Commit da3465de authored by Gabriel L. Oliveira's avatar Gabriel L. Oliveira

Test that UNG Docs paginate when many documents are present.

parent d59bc608
...@@ -971,6 +971,60 @@ class TestUNGDocs(UNGTestMixin): ...@@ -971,6 +971,60 @@ class TestUNGDocs(UNGTestMixin):
self.failIf(self.selenium.is_checked("//tr[@class='your_listbox-data-line-1 DataB']/td[1]/input")) self.failIf(self.selenium.is_checked("//tr[@class='your_listbox-data-line-1 DataB']/td[1]/input"))
self.failIf(self.selenium.is_checked("//tr[@class='your_listbox-data-line-2 DataA']/td[1]/input")) self.failIf(self.selenium.is_checked("//tr[@class='your_listbox-data-line-2 DataA']/td[1]/input"))
def test_pagination_with_many_documents(self):
"""UNG Docs should paginate when many documents are present.
Test that the action of paginate will work, given that many documents
are present."""
#XXX this test needs an empty instance
test_time = int(unittest.time.time())
page_title = "Functional UNG Test %d - Web Page " % test_time
#add many documents to ensure that it has to paginate
for doc_index in range(1, 101):
self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.type("name", page_title + str(doc_index))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]/span")
self.selenium.wait_for_page_to_load("30000")
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
#assert first and last (relative) documents on first page
self.assertEqual('1', self.selenium.get_value("//input[@name='your_listbox_page_start']"))
self.assertTrue(self.selenium.is_text_present(page_title + '100'))
self.assertTrue(self.selenium.is_text_present(page_title + '84'))
#assert first and last (relative) documents on third page
# (next button)
for next_page in range(2):
self.selenium.click("//button[@name='nextPage']")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual('3', self.selenium.get_value("//input[@name='your_listbox_page_start']"))
self.assertTrue(self.selenium.is_text_present(page_title + '66'))
self.assertTrue(self.selenium.is_text_present(page_title + '50'))
#assert first and last (relative) documents on second page
# (previous button)
self.selenium.click("//button[@name='previousPage']")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual('2', self.selenium.get_value("//input[@name='your_listbox_page_start']"))
self.assertTrue(self.selenium.is_text_present(page_title + '83'))
self.assertTrue(self.selenium.is_text_present(page_title + '67'))
#assert first and last (relative) documents on last page
# (last button)
last_page_number = self.selenium.get_text("//div[@class='listbox-navigation']").split('/')[1].strip()
self.selenium.click("//button[@name='lastPage']")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual(last_page_number, self.selenium.get_value("//input[@name='your_listbox_page_start']"))
self.assertTrue(self.selenium.is_text_present(page_title + '15'))
self.assertTrue(self.selenium.is_text_present(page_title + '1'))
#assert first and last (relative) documents on first page
# (first button)
self.selenium.click("//button[@name='firstPage']")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual('1', self.selenium.get_value("//input[@name='your_listbox_page_start']"))
self.assertTrue(self.selenium.is_text_present(page_title + '100'))
self.assertTrue(self.selenium.is_text_present(page_title + '84'))
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
......
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGPagination(UNGTestMixin):
"""tests related to pagination on UNG Docs default page """
def test_pagination_with_20_documents(self):
"""test that the action of paginate will work, given that 20 documents are added"""
test_time = int(unittest.time.time())
#add 20 documents to ensure that it has to paginate
for doc_index in range(20):
self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.type("name", "Functional UNG Test %d - Web Page %d" % (test_time, doc_index))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]/span")
self.selenium.wait_for_page_to_load("30000")
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
#TODO: assert first and last document on first page
# and then first and last (relative) created document on second page
#XXX pagination is not implemented yet
raise NotImplementedError
if __name__ == "__main__":
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment