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

2011-05-16 gabriel.oliveira

* Add initial version of test to verify the action of naming and renaming a document
parent 3f8ac9df
from base import BaseUNGTest
import unittest
class TestUNGChangeTitle(BaseUNGTest):
def test_ung_change_title(self):
sel = self.selenium
self.init()
self.login_as_default_user()
#New web illustration
sel.open("ERP5Site_createNewWebDocument?template=web_illustration_template")
sel.wait_for_page_to_load("30000")
self.assertEqual("Web Illustration", sel.get_text("//a[@name=\"document_title\"]"))
self.assertEqual("Draft", sel.get_text("//a[@name=\"document_state\"]"))
#First just see properties
sel.click("//a[@name=\"document_title\"]")
self.assertEqual("Rename Document", sel.get_text("//span[@id=\"ui-dialog-title-edit_document\"]"))
self.assertEqual("Web Illustration", sel.get_text("//a[@name=\"document_title\"]"))
self.assertEqual("Edit More Properties", sel.get_text("//p[@id=\"more_properties\"]"))
sel.click("//p[@id=\"more_properties\"]")
self.assertEqual("", sel.get_text("//input[@id='name']"))
self.assertEqual("", sel.get_text("//input[@id='short_title']"))
self.assertEqual("", sel.get_text("//input[@id='version']"))
self.assertEqual("", sel.get_text("//input[@id='language']"))
self.assertEqual("", sel.get_text("//input[@id='sort_index']"))
self.assertEqual("", sel.get_text("//textarea[@id='keyword_list']"))
sel.click("//span[@class=\"ui-icon ui-icon-closethick\"]")
#Than check and fill properties, without saving
sel.click("//a[@name=\"document_title\"]")
self.assertEqual("Rename Document", sel.get_text("//span[@id=\"ui-dialog-title-edit_document\"]"))
self.assertEqual("Web Illustration", sel.get_text("//a[@name=\"document_title\"]"))
self.assertEqual("", sel.get_text("//input[@id='name']"))
sel.type("name", "Functional UNG Test - Web Illustration")
self.assertEqual("Edit More Properties", sel.get_text("//p[@id=\"more_properties\"]"))
sel.click("//p[@id=\"more_properties\"]")
self.assertEqual("", sel.get_text("//input[@id='short_title']"))
sel.type("short_title", "Func. UNG Test - Web Illustration")
self.assertEqual("", sel.get_text("//input[@id='version']"))
sel.type("version", "002")
self.assertEqual("", sel.get_text("//input[@id='language']"))
sel.type("language", "fr")
self.assertEqual("", sel.get_text("//input[@id='sort_index']"))
sel.type("sort_index", "0")
self.assertEqual("", sel.get_text("//textarea[@id='keyword_list']"))
sel.type("keyword_list", "Functional UNG Test\nUNG Test")
sel.click("//span[@class=\"ui-icon ui-icon-closethick\"]")
#Than check and fill properties, saving
sel.click("//a[@name=\"document_title\"]")
self.assertEqual("Rename Document", sel.get_text("//span[@id=\"ui-dialog-title-edit_document\"]"))
self.assertEqual("Web Illustration", sel.get_text("//a[@name=\"document_title\"]"))
self.assertEqual("", sel.get_text("//input[@id='name']"))
sel.type("name", "Functional UNG Test - Web Illustration")
self.assertEqual("Edit More Properties", sel.get_text("//p[@id=\"more_properties\"]"))
sel.click("//p[@id=\"more_properties\"]")
self.assertEqual("", sel.get_text("//input[@id='short_title']"))
sel.type("short_title", "Func. UNG Test - Web Illustration")
self.assertEqual("", sel.get_text("//input[@id='version']"))
sel.type("version", "002")
self.assertEqual("", sel.get_text("//input[@id='language']"))
sel.type("language", "fr")
self.assertEqual("", sel.get_text("//input[@id='sort_index']"))
sel.type("sort_index", "0")
self.assertEqual("", sel.get_text("//textarea[@id='keyword_list']"))
sel.type("keyword_list", "Functional UNG Test\nUNG Test")
sel.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]/span")
sel.wait_for_page_to_load("30000")
self.wait_for_activities()
self.assertEqual("Functional UNG Test - Web Illu...", sel.get_text("//a[@name=\"document_title\"]"))
sel.refresh()
self.assertEqual("Functional UNG Test - Web Illu...", sel.get_text("//a[@name=\"document_title\"]"))
#Finally, verify
sel.open("")
sel.wait_for_page_to_load("30000")
self.assertEqual("Functional UNG Test - Web Illustration", sel.get_text("//tr[@class='your_listbox-data-line-0 DataA']/td[3]"))
sel.type("//input[@name=\"field_your_search_text\"]", "\"Functional UNG Test - Web Illustration\"")
sel.click("//input[@value=\"Search Docs\"]")
sel.wait_for_page_to_load("30000")
self.failIf(sel.is_text_present("No result."))
#Change to other
sel.open("")
sel.wait_for_page_to_load("30000")
sel.click("//tr[@class='your_listbox-data-line-0 DataA']/td[3]/a")
sel.wait_for_page_to_load("30000")
self.assertEqual("Functional UNG Test - Web Illu...", sel.get_text("//a[@name=\"document_title\"]"))
sel.click("//a[@name=\"document_title\"]")
self.assertEqual("Rename Document", sel.get_text("//span[@id=\"ui-dialog-title-edit_document\"]"))
self.assertEqual("Functional UNG Test - Web Illu...", sel.get_text("//a[@name=\"document_title\"]"))
self.assertEqual("", sel.get_text("//input[@id='name']"))
sel.type("name", "Functional UNG Test - Renamed Web Illustration")
self.assertEqual("Edit More Properties", sel.get_text("//p[@id=\"more_properties\"]"))
sel.click("//p[@id=\"more_properties\"]")
self.assertEqual("", sel.get_text("//input[@id='short_title']"))
sel.type("short_title", "Func. UNG Test - Renamed Web Illustration")
self.assertEqual("", sel.get_text("//input[@id='version']"))
sel.type("version", "003")
self.assertEqual("", sel.get_text("//input[@id='language']"))
sel.type("language", "en")
self.assertEqual("", sel.get_text("//input[@id='sort_index']"))
sel.type("sort_index", "1")
self.assertEqual("", sel.get_text("//textarea[@id='keyword_list']"))
sel.type("keyword_list", "Functional UNG Test Renamed\nUNG Test Renamed")
sel.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]/span")
sel.wait_for_page_to_load("30000")
self.wait_for_activities()
self.assertEqual("Functional UNG Test - Renamed ...", sel.get_text("//a[@name=\"document_title\"]"))
sel.refresh()
self.assertEqual("Functional UNG Test - Renamed ...", sel.get_text("//a[@name=\"document_title\"]"))
#Verify changes
sel.open("")
sel.wait_for_page_to_load("30000")
self.assertEqual("Functional UNG Test - Renamed Web Illustration", sel.get_text("//tr[@class='your_listbox-data-line-0 DataA']/td[3]"))
sel.click("//tr[@class='your_listbox-data-line-0 DataA']/td[3]/a")
sel.wait_for_page_to_load("30000")
self.assertEqual("Functional UNG Test - Renamed ...", sel.get_text("//a[@name=\"document_title\"]"))
sel.open("")
sel.wait_for_page_to_load("30000")
sel.type("//input[@name=\"field_your_search_text\"]", "\"Functional UNG Test - Renamed Web Illustration\"")
sel.click("//input[@value=\"Search Docs\"]")
sel.wait_for_page_to_load("30000")
self.failIf(sel.is_text_present("No result."))
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