Commit 87e28097 authored by Gabriel L. Oliveira's avatar Gabriel L. Oliveira

Move test files to correct location

parent 356f6fd3
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsSharing(UNGTestMixin):
"""tests related to the action of share documents on UNG Docs"""
def test_share_web_page_with_another_user(self):
"""test that web_page is correctly shared with another user"""
self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(name='Document Shared',
version='002',
language='pt-br',
keywords="My Subject")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("002", self.selenium.get_value("//input[@id=\"version\"]"))
self.assertEqual("pt-br", self.selenium.get_value("//input[@id=\"language\"]"))
self.assertEqual("My Subject", self.selenium.get_value("//textarea[@id=\"keyword_list\"]"))
self.assertEqual("Document Shared", self.selenium.get_value("//input[@id=\"name\"]"))
self.selenium.click("//a[@id=\"share_document\"]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Shared", self.selenium.get_text("//a[@name=\"document_state\"]"))
document_url = self.selenium.get_text("//span[@id=\"sharing_url\"]")
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//button[@value='ung_domain/shared.0']\")", "30000")
self.selenium.click("//button[@value='ung_domain/shared.0']")
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_text_present("No Result"))
self.selenium.wait_for_condition("selenium.isElementPresent(\"//button[@class='tree-open']\")", "30000")
self.assertEqual("Shared by me", self.selenium.get_text("//button[@class='tree-open']"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
#XXX user already created
# self.selenium.click("//td[@id=\"new-account-form\"]")
# self.selenium.type("//input[@name=\"firstname\"]", "Another")
# self.selenium.type("//input[@name=\"lastname\"]", "User")
# self.selenium.type("//input[@name=\"email\"]", "example2@example.com")
# self.selenium.type("//input[@name=\"login_name\"]", "ung_user2")
# self.selenium.type("//input[@name=\"password\"]", "1234")
# self.selenium.type("//input[@name=\"confirm\"]", "1234")
# self.selenium.click("//input[@value=\"Create Account\"]")
# self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.selenium.open(document_url)
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Document Shared", self.selenium.get_text("//a[@name=\"document_title\"]"))
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("002", self.selenium.get_value("//input[@id=\"version\"]"))
self.assertEqual("pt-br", self.selenium.get_value("//input[@id=\"language\"]"))
self.assertEqual("My Subject", self.selenium.get_value("//textarea[@id=\"keyword_list\"]"))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(name='Document Shared Updated', version='003')
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
self.login_as_default_user()
self.selenium.wait_for_condition("selenium.isElementPresent(\"//table[@class='listbox listbox listbox-table']\")", "30000")
self.selenium.click("//table[@class='listbox listbox listbox-table']/tbody/tr/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("Document Shared Updated", self.selenium.get_value("//input[@id=\"name\"]"))
self.assertEqual("003", self.selenium.get_value("//input[@id=\"version\"]"))
self.assertEqual("pt-br", self.selenium.get_value("//input[@id=\"language\"]"))
self.assertEqual("My Subject", self.selenium.get_value("//textarea[@id=\"keyword_list\"]"))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(version='004')
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("004", self.selenium.get_value("//input[@id=\"version\"]"))
#XXX this test delete all documents here
# but it won't be done
if __name__ == "__main__":
unittest.main()
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsTableEditor(UNGTestMixin):
def test_fill_some_cells_in_web_table(self):
"""test the action of add, fill cells, assert title of sheet and
content of cells of a Web Table document"""
self.selenium.open("ERP5Site_createNewWebDocument?template=web_table_template")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Web Table", self.selenium.get_text("//a[@name=\"document_title\"]"))
self.failUnless(self.selenium.is_element_present("//td[@id='0_table0_cell_c0_r1']"))
self.failUnless(self.selenium.is_element_present("//td[@id='0_table0_cell_c1_r1']"))
self.assertEqual("Spreadsheet Playground", self.selenium.get_text("//td[@id=\"jSheetTitle_0\"]"))
self.assertEqual("MENU", self.selenium.get_text("//td[@id=\"jSheetMenu_0\"]/span[@class=\"rootVoice\"]"))
self.selenium.run_script("$(\"#0_table0_cell_c0_r0\").html(\"Gabriel\")")
self.selenium.run_script("$(\"#0_table0_cell_c1_r1\").html(\"Monnerat\")")
self.selenium.click("//button[@class=\"save\"]")
for page_reload in range(2):
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Gabriel", self.selenium.get_text("//td[@id='0_table0_cell_c0_r0']"))
self.assertEqual("Monnerat", self.selenium.get_text("//td[@id='0_table0_cell_c1_r1']"))
if __name__ == "__main__":
unittest.main()
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsTextEditor(UNGTestMixin):
"""tests related to UNG Docs text editors"""
def test_fill_content_on_web_page_with_fck_editor(self):
"""test the action of filling content on FCK Editor for a Web Page
document"""
#configure settings
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
#create new Web Page
self.selenium.click("//div[@id='wrapper_main']/div[1]/fieldset/div/div/div/div/div/div[1]/li/ul/li[3]/a/span")
self.selenium.wait_for_page_to_load("30000")
#type text on FCK Editor
self.selenium.select_frame("//td[@id='xEditingArea']/iframe")
self.selenium.type("//body", "<p>hello there</p>")
self.selenium.select_window("null")
#save Web Page
self.selenium.click("//button[@name='Base_edit:method']")
self.selenium.wait_for_page_to_load("30000")
#wait for activities
self.wait_for_activities()
#assert text was typed
self.assertEqual("<p>hello there</p>", self.selenium.get_eval("window.document.getElementById('field_my_text_content').value"))
#go back to home page
self.open_ung_default_page('ung', clear_cache=1, wait_for_activities=1)
#go back to the created Web Page (the last one modified on the list)
self.selenium.click("//tr[@class='listbox-data-line-0 DataA']/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
#assert text was saved
self.selenium.wait_for_condition("selenium.browserbot.getCurrentWindow().document.getElementById('field_my_text_content')", "5000")
self.assertEqual("<p>hello there</p>", self.selenium.get_eval("window.document.getElementById('field_my_text_content').value"))
self.selenium.select_window("null")
def test_upload_text_with_image(self):
"""test that uploading a Text Document (Open Office) with an image, as a
Web Page, will have its text and image correctly showed on fck editor"""
test_time = int(unittest.time.time())
#set default text editor as FCKeditor
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
#get file_path
test_file_path = self.get_file_path("ung-UNGDocs.Sample.TextWithImage.Text-001-en.odt")
web_page_name = "Functional UNG Test %d - Uploaded Web Page With Image" % test_time
#upload document
self.selenium.click("//input[@id=\"upload\"]")
self.selenium.select("//select[@name=\"portal_type\"]", "Web Page")
self.selenium.click("//input[@id=\"submit_document\"]")
self.selenium.type("//input[@id=\"upload-file\"]", test_file_path)
self.selenium.click("//input[@id=\"submit_document\"]")
self.selenium.wait_for_page_to_load("30000")
self.selenium.wait_for_condition("selenium.isTextPresent(\"Opening\")", "30000")
self.selenium.wait_for_page_to_load("30000")
#XXX this requires enabling a System Preference with Cloudooo
self.selenium.wait_for_condition("selenium.isElementPresent(\"//a[@name='document_title']\")", "30000")
#save document
self.selenium.click("//button[@name='Base_edit:method']")
self.selenium.wait_for_page_to_load("30000")
#assert web_page title
self.failUnless(self.selenium.is_text_present("UNGDocs Text"))
web_page_content = self.selenium.get_eval("window.document.getElementById('field_my_text_content').value")
#assert text content is present
self.failUnless('<b>Functional UNG Test</b>' in web_page_content)
self.failUnless('<p style="margin-bottom: 0in; font-weight: normal">Sample text document created in order to test some UNG features.</p>' in web_page_content)
#assert image content is present
try:
self.failUnless('<img align="LEFT" width="122" height="30" border="0"'
' name="ung_docs-logo" src="image_module/' in web_page_content)
except AssertionError:
raise NotImplementedError("This should fail until implement "
"correct behaviour of images. They should be put under "
"image_module, instead of just a 'tmp' file. \n"
"XXX: Please refactor this try/except code if this"
" functionality is already implemented.")
def test_select_xinha_as_preferred_text_editor(self):
"""test that its possible to select Xinha instead of FCKeditor
for Edit Text Documents on UNG Docs."""
#assert Xinha Editor is shown as an option
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name='field_my_preferred_text_editor']\")", "3000")
self.failUnless(self.selenium.is_text_present("Text Format"))
self.failUnless(self.selenium.is_text_present("Xinha Editor"))
#select Xinha Editor as Preferred Text Editor
self.selenium.check("//input[@value='xinha']")
self.selenium.check("//input[@value='text/html']")
#save settings
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
#assert settings were saved
self.selenium.open("WebSite_logout")
self.login_as_default_user()
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name='field_my_preferred_text_editor']\")", "3000")
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value='xinha']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value='text/html']@checked"))
def test_fill_content_on_web_page_with_xinha_editor(self):
"""test the possibility to edit a Web Page document using
Xinha Text Editor"""
#select Xinha as Text Editor
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name='field_my_preferred_text_editor']\")", "3000")
self.selenium.check("//input[@value='xinha']")
self.selenium.check("//input[@value='text/html']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
#add new web_page
test_time = int(unittest.time.time())
self.create_document('page', name='Functional UNG Test %d - Web Page using Xinha' % test_time)
#activate Xinha Editor
self.selenium.click("//textarea[@id='my_text_content']")
#type text
self.selenium.select_frame("//iframe[@id='XinhaIFrame_my_text_content']")
web_page_content = """<p><strong>Chapter 1</strong></p> \n <p>&nbsp;Sample Text</p>"""
self.selenium.type("//body", web_page_content)
self.selenium.select_window("null")
#save Web Page
self.selenium.click("//button[@name='Base_edit:method']")
self.selenium.wait_for_page_to_load("30000")
#wait for activities
self.wait_for_activities()
#assert text was typed
self.assertEqual(web_page_content, self.selenium.get_eval("window.document.getElementById('my_text_content').value"))
#go back to home page
self.open_ung_default_page('ung', clear_cache=1, wait_for_activities=1)
#go back to the created Web Page (the last one modified on the list)
self.selenium.click("//tr[@class='listbox-data-line-0 DataA']/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
#assert text is the same
self.selenium.wait_for_condition("selenium.browserbot.getCurrentWindow().document.getElementById('my_text_content')", "5000")
self.assertEqual(web_page_content, self.selenium.get_eval("window.document.getElementById('my_text_content').value"))
self.selenium.select_window("null")
if __name__ == "__main__":
unittest.main()
from UNGTestMixin import UNGTestMixin
import unittest
import re
class TestUNGGadgets(UNGTestMixin):
"""tests related to gadgets on UNG"""
def test_add_and_delete_gadget(self):
"""test:
- default gadget message is show when no gadgets are present
- add gadget
- delete gadget
"""
self.failUnless(self.selenium.is_text_present("Please use link "
"(Add gadgets) to prepare it yourself."))
self.assertEqual("Add gadgets",
self.selenium.get_text("//a[@id=\"add-gadgets\"]/span"))
self.failIf(self.selenium.is_text_present("Join ERP5 Network !"))
self.failIf(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.failUnless(self.selenium.is_text_present("Add Gadget"))
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.failUnless(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.failIf(self.selenium.is_element_present("//div[@id="
"\"page_wrapper\"]/div[1]/h4"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this "
"gadget from your personalized page[\s\S]$",
self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Add gadgets", self.selenium.get_text(
"//a[@id=\"add-gadgets\"]/span"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class"
"=\"gadget_title\"]"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this "
"gadget from your personalized page[\s\S]$",
self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
# ung listbox, now a gadget, have this element until it's fully
# loaded, and then its removed from listbox
self.wait_ung_listbox_to_load()
self.failIf(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.clear_user_gadgets()
def test_add_two_gadgets(self):
"""test that its possible to add more than just 1 gadget"""
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.click("//div[@id=\"portal-column-0\"]/div[1]/h3/span/a[@title=\"Remove\"]")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_element_present("//div[@id=\"portal-column-0\"]/div[2]/h3/span/a[@title=\"Remove\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("?reset:int=1")
self.selenium.wait_for_page_to_load("30000")
self.wait_ung_listbox_to_load()
self.failIf(self.selenium.is_element_present("//a[@class='clickable-block block-remove']"))
self.clear_user_gadgets()
def test_add_gadget_on_different_users(self):
"""test that different users have different gadgets"""
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.wait_for_activities()
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
#XXX user already created
# self.selenium.click("//td[@id=\"new-account-form\"]")
# self.selenium.type("//input[@name=\"firstname\"]", "Another")
# self.selenium.type("//input[@name=\"lastname\"]", "User")
# self.selenium.type("//input[@name=\"email\"]", "example2@example.com")
# self.selenium.type("//input[@name=\"login_name\"]", "ung_user2")
# self.selenium.type("//input[@name=\"password\"]", "1234")
# self.selenium.type("//input[@name=\"confirm\"]", "1234")
# self.selenium.click("//input[@value=\"Create Account\"]")
# self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Please use link (Add gadgets) to prepare it yourself."))
self.failIf(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_worklists\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
self.login_as_default_user()
self.assertNotEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "zope")
self.selenium.type("__ac_password", "zope")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Please use link (Add gadgets) to prepare it yourself."))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_worklists\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
self.login_as_default_user()
self.assertNotEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.clear_user_gadgets()
self.clear_user_gadgets('ung_user2', '1234')
self.clear_user_gadgets('zope', 'zope')
if __name__ == "__main__":
unittest.main()
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGLogin(UNGTestMixin):
"""tests related to login on UNG"""
def test_login(self):
"""try to login as different users"""
self.selenium.open("WebSite_logout")
self.login_as_default_user()
#XXX bug because All Documents is not selected by default (it's saving "cache")
self.set_default_tree_view()
self.assertEqual("All Documents", self.selenium.get_text("//button[@class='tree-open']"))
self.assertEqual("Settings", self.selenium.get_text("//a[@id='settings']"))
self.failUnless(self.selenium.is_text_present("Web Illustration"))
self.failUnless(self.selenium.is_text_present("Web Page"))
self.failUnless(self.selenium.is_text_present("Web Table"))
#XXX: the user used on test's instance is 'test_user'
self.failUnless(self.selenium.is_text_present("test_user"))
self.selenium.click("link=Sign out")
self.selenium.wait_for_page_to_load(5000)
self.failUnless(self.selenium.is_text_present("Welcome to UNG Web Office"))
self.failUnless(self.selenium.is_text_present("Create an account now"))
self.selenium.click("//td[@id='new-account-form']")
self.selenium.click("//td[@id='back-login']")
#XXX: user is not created and, by orders, can't be created
#<tal:block metal:use-macro="here/Zuite_CommonTemplateForUNG/macros/create-user" />
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.assertEqual("ung_user2", self.selenium.get_text("//div[@class=\' navigation-right\']/fieldset/div[2]/div/div/a[2]"))
def test_login_using_enter_key(self):
"""try to login, submitting login form using 'enter' key (code 13)"""
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.key_press("//input[@value='Login']", '\\13')
self.selenium.wait_for_page_to_load(5000)
self.assertEqual("ung_user2", self.selenium.get_text("//div[@class=\' navigation-right\']/fieldset/div[2]/div/div/a[2]"))
if __name__ == "__main__":
unittest.main()
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGSettings(UNGTestMixin):
"""tests related to UNG settings"""
def test_saving_settings_even_on_different_users(self):
"""test that:
- settings are correct displayed
- settings remain saved
- different users have different settings
"""
self.failIf(self.selenium.is_text_present('Text Format'))
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.failUnless(self.selenium.is_text_present("Text Format"))
self.failUnless(self.selenium.is_text_present("FCK Editor"))
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/html\']@checked"))
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'text_area\']")
self.selenium.check("//input[@value=\'text/plain\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/plain\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text_area\']@checked"))
self.selenium.click("//span[@class=\'ui-icon ui-icon-closethick\']")
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
#don't try to create a new user since
#test's instance already have one with login_name 'ung_user2'
#XXX this is not correct, because it has to be created once a time
# next ones, just login
## self.selenium.click("//td[@id='new-account-form']")
# # self.selenium.type("//input[@name='firstname']", "Another")
# sel#.type("//input[@name='lastname']", "User")
# self.selenium.type(#"//input[@name='email']", "example2@example.com")
# # self.selenium.type("//input[@name='login_name']", "ung_use#r2")
# self.selenium.type("//input[@name='password']", "1#234")
# self.selenium.type("//input[@name='confirm']", "1234")
# self.selenium.click("//input[@value='Create Account']")
# self.selenium.wait_for_page_to_load(30000)
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/html\']@checked"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
self.selenium.type("__ac_name", "test_user")
self.selenium.type("__ac_password", "test_user")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text_area\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/plain\']@checked"))
if __name__ == "__main__":
unittest.main()
This diff is collapsed.
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGCalendar(UNGTestMixin):
""" Tests related to UNG Calendar
"""
......@@ -17,10 +18,14 @@ class TestUNGCalendar(UNGTestMixin):
test_subject_time = int(unittest.time.time())
self.selenium.open("calendar")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Refresh", self.selenium.get_text("//span[@class='showdayflash']"))
self.assertEqual("Su", self.selenium.get_text("//span[@title='Sunday']"))
self.assertEqual("Refresh", self.selenium.get_text(
"//span[@class='showdayflash']"))
self.assertEqual("Su", self.selenium.get_text(
"//span[@title='Sunday']"))
self.selenium.click("//span[@class='showmonthview']")
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull"
"('loadingpannel').style.display == 'none'",
"10000");
self.selenium.click("//span[@class='showdayview']")
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
self.selenium.type("//input[@name='searchable-text']", "My Event %d" % test_subject_time)
......@@ -40,14 +45,13 @@ class TestUNGCalendar(UNGTestMixin):
self.selenium.type("//input[@name=\"start_date_hour\"]", unittest.time.localtime().tm_hour + 1)
self.selenium.type("//input[@name=\"stop_date_hour\"]", unittest.time.localtime().tm_hour + 1)
self.selenium.click("//div[@aria-labelledby='ui-dialog-title-new_event_dialog']//button")
#XXX handle this behaviour differently: activities is called twice
# because sometimes its passing through method even with some present
# activities
#XXX handle this behaviour differently: wait_for_activities is called
# twice because sometimes its passing through method even with some
# remaining activities
self.wait_for_activities()
self.clear_cache()
self.wait_for_activities()
self.selenium.open("calendar")
self.selenium.wait_for_page_to_load("30000")
self.open_ung_default_page("calendar")
self.selenium.wait_for_condition("selenium.isTextPresent('My Event %d')" % test_subject_time, "10000")
self.failUnless(self.selenium.is_text_present("My Event %d" % test_subject_time))
self.selenium.type("//input[@name='searchable-text']", "My Event %d" % test_subject_time)
......@@ -548,6 +552,7 @@ class TestUNGCalendar(UNGTestMixin):
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#XXX due to interface delay again, try two times
# on second, sleeping 3 seconds before refreshing page again
#XXX: this part needs the 'Other##' workaround when many events are present
try:
for event_index in range(len(dates)):
self.assertTrue(self.selenium.is_text_present(event_name % (test_time, event_index)))
......@@ -611,7 +616,7 @@ class TestUNGCalendar(UNGTestMixin):
#assert event is present
self.assertTrue(self.selenium.is_text_present(event_name))
#click refresh button 10 times
for _refresh in range(5):
for _refresh in range(10):
self.selenium.click("//div/span[@title='Refresh view']")
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#assert only 1 event is present
......@@ -848,6 +853,11 @@ class TestUNGCalendar(UNGTestMixin):
#click Today button
self.selenium.click("//span[@class='showtoday']")
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#in cases when there are many events on same day, the 'month' view
# group them, only showing them after clicking on 'Others##'
if self.selenium.is_element_present("//td[@abbr='%s'][@ch='more']" % current_date):
self.selenium.click("//td[@abbr='%s'][@ch='more']" % current_date)
self.selenium.wait_for_condition("selenium.isTextPresent('%s')" % event_name, 30000)
self.assertTrue(self.selenium.is_text_present(event_name))
#check button for week view
......
This diff is collapsed.
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsSharing(UNGTestMixin):
"""tests related to the action of share documents on UNG Docs"""
def test_share_web_page_with_another_user(self):
"""test that web_page is correctly shared with another user"""
self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template")
self.selenium.wait_for_page_to_load("30000")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.type("//input[@id=\"name\"]", "Document Shared")
self.selenium.click("//p[@id=\"more_properties\"]")
self.selenium.type("//input[@id=\"version\"]", "002")
self.selenium.type("//input[@id=\"language\"]", "pt-br")
self.selenium.type("//textarea[@id=\"keyword_list\"]", "My Subject")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(name='Document Shared',
version='002',
language='pt-br',
keywords="My Subject")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("002", self.selenium.get_value("//input[@id=\"version\"]"))
......@@ -28,12 +26,13 @@ class TestUNGDocsSharing(UNGTestMixin):
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
#XXX this could be changed (for a generic approach) to //button[@value='ung_domain/shared.0']
self.selenium.click("//table[@class=\"your_listbox-table-domain-tree\"]/tbody/tr[9]/td/button")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//button[@value='ung_domain/shared.0']\")", "30000")
self.selenium.click("//button[@value='ung_domain/shared.0']")
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_text_present("No Result"))
self.assertEqual("Shared by me", self.selenium.get_text("//button[@class=\"tree-open\"]"))
self.selenium.click("//div[@id='wrapper_navigation']/div[2]/fieldset/div[2]/div/div/a[5]")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//button[@class='tree-open']\")", "30000")
self.assertEqual("Shared by me", self.selenium.get_text("//button[@class='tree-open']"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
#XXX user already created
# self.selenium.click("//td[@id=\"new-account-form\"]")
......@@ -47,7 +46,7 @@ class TestUNGDocsSharing(UNGTestMixin):
# self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@type=\"submit\"]")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.selenium.open(document_url)
self.selenium.wait_for_page_to_load("30000")
......@@ -59,19 +58,25 @@ class TestUNGDocsSharing(UNGTestMixin):
self.assertEqual("My Subject", self.selenium.get_value("//textarea[@id=\"keyword_list\"]"))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(name='Document Shared Updated', version='003')
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load("30000")
self.login_as_default_user()
self.selenium.click("//table[@class=\"listbox your_listbox your_listbox-table\"]/tbody/tr/td[3]/a")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//table[@class='listbox listbox listbox-table']\")", "30000")
self.selenium.click("//table[@class='listbox listbox listbox-table']/tbody/tr/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.selenium.type("//input[@id=\"version\"]", "003")
self.assertEqual("Document Shared Updated", self.selenium.get_value("//input[@id=\"name\"]"))
self.assertEqual("003", self.selenium.get_value("//input[@id=\"version\"]"))
self.assertEqual("pt-br", self.selenium.get_value("//input[@id=\"language\"]"))
self.assertEqual("My Subject", self.selenium.get_value("//textarea[@id=\"keyword_list\"]"))
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.rename_document(version='004')
self.selenium.click("//a[@name=\"document_title\"]")
self.selenium.click("//p[@id=\"more_properties\"]")
self.assertEqual("003", self.selenium.get_value("//input[@id=\"version\"]"))
self.assertEqual("004", self.selenium.get_value("//input[@id=\"version\"]"))
#XXX this test delete all documents here
# but it won't be done
......
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsTableEditor(UNGTestMixin):
def test_fill_some_cells_in_web_table(self):
"""test the action of add, fill cells, assert title of sheet and
......@@ -15,6 +16,7 @@ class TestUNGDocsTableEditor(UNGTestMixin):
self.selenium.run_script("$(\"#0_table0_cell_c0_r0\").html(\"Gabriel\")")
self.selenium.run_script("$(\"#0_table0_cell_c1_r1\").html(\"Monnerat\")")
self.selenium.click("//button[@class=\"save\"]")
for page_reload in range(2):
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Gabriel", self.selenium.get_text("//td[@id='0_table0_cell_c0_r0']"))
self.assertEqual("Monnerat", self.selenium.get_text("//td[@id='0_table0_cell_c1_r1']"))
......
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGDocsTextEditor(UNGTestMixin):
"""tests related to UNG Docs text editors"""
def test_fill_content_on_web_page_with_fck_editor(self):
......@@ -28,9 +29,9 @@ class TestUNGDocsTextEditor(UNGTestMixin):
#assert text was typed
self.assertEqual("<p>hello there</p>", self.selenium.get_eval("window.document.getElementById('field_my_text_content').value"))
#go back to home page
self.open_ung_default_page(clear_cache=1, wait_for_activities=1)
self.open_ung_default_page('ung', clear_cache=1, wait_for_activities=1)
#go back to the created Web Page (the last one modified on the list)
self.selenium.click("//tr[@class='your_listbox-data-line-0 DataA']/td[3]/a")
self.selenium.click("//tr[@class='listbox-data-line-0 DataA']/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
#assert text was saved
self.selenium.wait_for_condition("selenium.browserbot.getCurrentWindow().document.getElementById('field_my_text_content')", "5000")
......@@ -70,12 +71,17 @@ class TestUNGDocsTextEditor(UNGTestMixin):
web_page_content = self.selenium.get_eval("window.document.getElementById('field_my_text_content').value")
#assert text content is present
self.failUnless('<b>Functional UNG Test</b>' in web_page_content)
self.failUnless('<p style="margin-bottom: 0in; font-weight: normal;">'
'Sample text document created in order to test some UNG features.'
'</p>' in web_page_content)
self.failUnless('<p style="margin-bottom: 0in; font-weight: normal">Sample text document created in order to test some UNG features.</p>' in web_page_content)
#assert image content is present
try:
self.failUnless('<img align="LEFT" width="122" height="30" border="0"'
' name="ung_docs-logo" src="image_module/' in web_page_content)
except AssertionError:
raise NotImplementedError("This should fail until implement "
"correct behaviour of images. They should be put under "
"image_module, instead of just a 'tmp' file. \n"
"XXX: Please refactor this try/except code if this"
" functionality is already implemented.")
def test_select_xinha_as_preferred_text_editor(self):
"""test that its possible to select Xinha instead of FCKeditor
......@@ -127,9 +133,9 @@ class TestUNGDocsTextEditor(UNGTestMixin):
#assert text was typed
self.assertEqual(web_page_content, self.selenium.get_eval("window.document.getElementById('my_text_content').value"))
#go back to home page
self.open_ung_default_page(clear_cache=1, wait_for_activities=1)
self.open_ung_default_page('ung', clear_cache=1, wait_for_activities=1)
#go back to the created Web Page (the last one modified on the list)
self.selenium.click("//tr[@class='your_listbox-data-line-0 DataA']/td[3]/a")
self.selenium.click("//tr[@class='listbox-data-line-0 DataA']/td[3]/a")
self.selenium.wait_for_page_to_load("30000")
#assert text is the same
self.selenium.wait_for_condition("selenium.browserbot.getCurrentWindow().document.getElementById('my_text_content')", "5000")
......
......@@ -3,6 +3,7 @@ import unittest
import re
class TestUNGGadgets(UNGTestMixin):
"""tests related to gadgets on UNG"""
def test_add_and_delete_gadget(self):
......@@ -11,39 +12,58 @@ class TestUNGGadgets(UNGTestMixin):
- add gadget
- delete gadget
"""
self.failUnless(self.selenium.is_text_present("Please use link (Add gadgets) to prepare it yourself."))
self.assertEqual("Add gadgets", self.selenium.get_text("//a[@id=\"add-gadgets\"]/span"))
self.failUnless(self.selenium.is_text_present("Please use link "
"(Add gadgets) to prepare it yourself."))
self.assertEqual("Add gadgets",
self.selenium.get_text("//a[@id=\"add-gadgets\"]/span"))
self.failIf(self.selenium.is_text_present("Join ERP5 Network !"))
self.failIf(self.selenium.is_element_present("//a[@class=\"clickable-block block-remove\"]"))
self.failIf(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.failUnless(self.selenium.is_text_present("Add Gadget"))
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.failUnless(self.selenium.is_element_present("//a[@class=\"clickable-block block-remove\"]"))
self.failIf(self.selenium.is_element_present("//div[@id=\"page_wrapper\"]/div[1]/h4"))
self.selenium.click("//a[@class=\"clickable-block block-remove\"]")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.failUnless(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.failIf(self.selenium.is_element_present("//div[@id="
"\"page_wrapper\"]/div[1]/h4"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this "
"gadget from your personalized page[\s\S]$",
self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Add gadgets", self.selenium.get_text("//a[@id=\"add-gadgets\"]/span"))
self.assertEqual("Add gadgets", self.selenium.get_text(
"//a[@id=\"add-gadgets\"]/span"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.selenium.click("//a[@class=\"clickable-block block-remove\"]")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class"
"=\"gadget_title\"]"))
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this "
"gadget from your personalized page[\s\S]$",
self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("")
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_element_present("//a[@class=\"clickable-block block-remove\"]"))
# ung listbox, now a gadget, have this element until it's fully
# loaded, and then its removed from listbox
self.wait_ung_listbox_to_load()
self.failIf(self.selenium.is_element_present("//a[@class="
"'clickable-block block-remove']"))
self.clear_user_gadgets()
def test_add_two_gadgets(self):
"""test that its possible to add more than just 1 gadget"""
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
......@@ -57,16 +77,19 @@ class TestUNGGadgets(UNGTestMixin):
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_element_present("//div[@id=\"portal-column-0\"]/div[2]/h3/span/a[@title=\"Remove\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.click("//a[@class=\"clickable-block block-remove\"]")
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("?reset:int=1")
self.selenium.wait_for_page_to_load("30000")
self.failIf(self.selenium.is_element_present("//a[@class=\"clickable-block block-remove\"]"))
self.wait_ung_listbox_to_load()
self.failIf(self.selenium.is_element_present("//a[@class='clickable-block block-remove']"))
self.clear_user_gadgets()
def test_add_gadget_on_different_users(self):
"""test that different users have different gadgets"""
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_documentation\"]")
self.selenium.click("//input[@id=\"erp5_rss\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
......@@ -86,11 +109,12 @@ class TestUNGGadgets(UNGTestMixin):
# self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@type=\"submit\"]")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Please use link (Add gadgets) to prepare it yourself."))
self.failIf(self.selenium.is_text_present("Join ERP5 Network !"))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_worklists\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
......@@ -105,15 +129,16 @@ class TestUNGGadgets(UNGTestMixin):
self.selenium.wait_for_page_to_load("30000")
self.selenium.type("__ac_name", "zope")
self.selenium.type("__ac_password", "zope")
self.selenium.click("//input[@type=\"submit\"]")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load("30000")
self.failUnless(self.selenium.is_text_present("Please use link (Add gadgets) to prepare it yourself."))
self.selenium.click("//a[@id=\"add-gadgets\"]")
self.wait_add_gadgets_dialog_to_load()
self.selenium.click("//input[@id=\"erp5_worklists\"]")
self.selenium.click("//div[@class=\"ui-dialog-buttonset\"]/button[1]")
self.selenium.wait_for_page_to_load("30000")
self.assertEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.selenium.click("//a[@class=\"clickable-block block-remove\"]")
self.selenium.click("//a[@class='clickable-block block-remove']")
self.failUnless(re.search(r"^Are you sure you want to remove this gadget from your personalized page[\s\S]$", self.selenium.get_confirmation()))
self.wait_for_activities()
self.selenium.open("WebSite_logout")
......@@ -122,11 +147,10 @@ class TestUNGGadgets(UNGTestMixin):
self.assertNotEqual("ERP5 Worklists", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.assertEqual("Feed Reader", self.selenium.get_text("//span[@class=\"gadget_title\"]"))
self.failUnless(self.selenium.is_text_present("Join ERP5 Network !"))
self.clear_user_gadgets()
self.clear_user_gadgets('ung_user2', '1234')
self.clear_user_gadgets('zope', 'zope')
#XXX clean gadgets from all users after test
# maybe using KnowledgePad tool
# url: http://localhost:18080/erp5/portal_skins/erp5_web_ung_theme/WebSection_viewMenuWidget/pt_editForm
# starting at <div class="front_pad">
if __name__ == "__main__":
unittest.main()
......
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGLogin(UNGTestMixin):
"""tests related to login on UNG"""
......@@ -16,7 +17,7 @@ class TestUNGLogin(UNGTestMixin):
self.failUnless(self.selenium.is_text_present("Web Illustration"))
self.failUnless(self.selenium.is_text_present("Web Page"))
self.failUnless(self.selenium.is_text_present("Web Table"))
#XXX: the user used on test's instance is 'nsi'
#XXX: the user used on test's instance is 'test_user'
self.failUnless(self.selenium.is_text_present("test_user"))
self.selenium.click("link=Sign out")
self.selenium.wait_for_page_to_load(5000)
......@@ -28,7 +29,17 @@ class TestUNGLogin(UNGTestMixin):
#<tal:block metal:use-macro="here/Zuite_CommonTemplateForUNG/macros/create-user" />
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@type='submit']")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.assertEqual("ung_user2", self.selenium.get_text("//div[@class=\' navigation-right\']/fieldset/div[2]/div/div/a[2]"))
def test_login_using_enter_key(self):
"""try to login, submitting login form using 'enter' key (code 13)"""
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.key_press("//input[@value='Login']", '\\13')
self.selenium.wait_for_page_to_load(5000)
self.assertEqual("ung_user2", self.selenium.get_text("//div[@class=\' navigation-right\']/fieldset/div[2]/div/div/a[2]"))
......
from UNGTestMixin import UNGTestMixin
import unittest
class TestUNGSettings(UNGTestMixin):
"""tests related to UNG settings"""
def test_saving_settings_even_on_different_users(self):
......@@ -11,7 +12,9 @@ class TestUNGSettings(UNGTestMixin):
"""
self.failIf(self.selenium.is_text_present('Text Format'))
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.failUnless(self.selenium.is_text_present("Text Format"))
self.failUnless(self.selenium.is_text_present("FCK Editor"))
self.selenium.check("//input[@value=\'fck_editor\']")
......@@ -19,19 +22,29 @@ class TestUNGSettings(UNGTestMixin):
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text/html\']@checked"))
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/html\']@checked"))
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'text_area\']")
self.selenium.check("//input[@value=\'text/plain\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text/plain\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text_area\']@checked"))
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/plain\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text_area\']@checked"))
self.selenium.click("//span[@class=\'ui-icon ui-icon-closethick\']")
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
......@@ -50,36 +63,50 @@ class TestUNGSettings(UNGTestMixin):
# self.selenium.wait_for_page_to_load(30000)
self.selenium.type("__ac_name", "ung_user2")
self.selenium.type("__ac_password", "1234")
self.selenium.click("//input[@type='submit']")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.check("//input[@value=\'fck_editor\']")
self.selenium.check("//input[@value=\'text/html\']")
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.selenium.click("//html/body/div[3]/div[11]/div/button[1]")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text/html\']@checked"))
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'fck_editor\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/html\']@checked"))
self.selenium.open("WebSite_logout")
self.selenium.wait_for_page_to_load(5000)
self.selenium.type("__ac_name", "test_user")
self.selenium.type("__ac_password", "test_user")
self.selenium.click("//input[@type='submit']")
self.selenium.click("//input[@value='Login']")
self.selenium.wait_for_page_to_load(5000)
self.selenium.click("//a[@id='settings']")
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input[@name=\'field_my_preferred_text_editor\']\")", "3000")
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text_area\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute("//input[@value=\'text/plain\']@checked"))
self.selenium.wait_for_condition("selenium.isElementPresent(\"//input"
"[@name=\'field_my_preferred_text_editor\']\")",
"30000")
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text_area\']@checked"))
self.assertEqual(u'true', self.selenium.get_attribute(
"//input[@value=\'text/plain\']@checked"))
if __name__ == "__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