Commit 83c378f0 authored by Gabriel L. Oliveira's avatar Gabriel L. Oliveira

Refactor to follow guidelines

parent 198ffc9b
from UNGTestMixin import UNGTestMixin from UNGTestMixin import UNGTestMixin
import unittest import unittest
class TestUNGCalendar(UNGTestMixin): class TestUNGCalendar(UNGTestMixin):
""" Tests related to UNG Calendar """ Tests related to UNG Calendar
""" """
...@@ -17,10 +18,14 @@ class TestUNGCalendar(UNGTestMixin): ...@@ -17,10 +18,14 @@ class TestUNGCalendar(UNGTestMixin):
test_subject_time = int(unittest.time.time()) test_subject_time = int(unittest.time.time())
self.selenium.open("calendar") self.selenium.open("calendar")
self.selenium.wait_for_page_to_load("30000") self.selenium.wait_for_page_to_load("30000")
self.assertEqual("Refresh", self.selenium.get_text("//span[@class='showdayflash']")) self.assertEqual("Refresh", self.selenium.get_text(
self.assertEqual("Su", self.selenium.get_text("//span[@title='Sunday']")) "//span[@class='showdayflash']"))
self.assertEqual("Su", self.selenium.get_text(
"//span[@title='Sunday']"))
self.selenium.click("//span[@class='showmonthview']") 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.click("//span[@class='showdayview']")
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.type("//input[@name='searchable-text']", "My Event %d" % test_subject_time) self.selenium.type("//input[@name='searchable-text']", "My Event %d" % test_subject_time)
......
...@@ -9,6 +9,7 @@ xmlns='http://www.w3.org/2000/svg'> \ ...@@ -9,6 +9,7 @@ xmlns='http://www.w3.org/2000/svg'> \
<ellipse ry='46' rx='47' id='svg_1' cy='93' cx='138' stroke-width='5' \ <ellipse ry='46' rx='47' id='svg_1' cy='93' cx='138' stroke-width='5' \
stroke='#000000' fill='#FF0000'/> </g></svg>") stroke='#000000' fill='#FF0000'/> </g></svg>")
class TestUNGDocs(UNGTestMixin): class TestUNGDocs(UNGTestMixin):
"""Tests related to UNG Docs""" """Tests related to UNG Docs"""
def test_web_illustration(self): def test_web_illustration(self):
...@@ -36,18 +37,23 @@ class TestUNGDocs(UNGTestMixin): ...@@ -36,18 +37,23 @@ class TestUNGDocs(UNGTestMixin):
pass pass
finally: finally:
self.selenium.set_timeout(30000) self.selenium.set_timeout(30000)
self.selenium.open(url + "/WebIllustration_viewEditor?editable_mode:int=1") self.selenium.open(url + "/WebIllustration_viewEditor?"
"editable_mode:int=1")
self.selenium.wait_for_page_to_load("30000") self.selenium.wait_for_page_to_load("30000")
#XXX had to change #XXX had to change
#self.selenium.wait_for_condition("selenium.isElementPresent(\"//ellipse[@id='svg_1']\")", "9000") #self.selenium.wait_for_condition("selenium.isElementPresent(\"//ellipse[@id='svg_1']\")", "9000")
self.selenium.select_frame("//iframe[@id='svgframe']") self.selenium.select_frame("//iframe[@id='svgframe']")
self.selenium.wait_for_condition("window.document.getElementById('svg_1')", "1000") self.selenium.wait_for_condition("window.document.getElementById"
self.assertEqual("46", self.selenium.get_eval("window.document.getElementById('svg_1').ry.baseVal.value")) "('svg_1')", "1000")
self.assertEqual("46", self.selenium.get_eval("window.document."
"getElementById('svg_1').ry.baseVal.value"))
self.selenium.select_window('null') self.selenium.select_window('null')
self.assertEqual("Web Illustration", self.selenium.get_text("//a[@name=\"document_title\"]")) self.assertEqual("Web Illustration", self.selenium.get_text(
self.assertEqual("Draft", self.selenium.get_text("//a[@name=\"document_state\"]")) "//a[@name=\"document_title\"]"))
self.assertEqual("Draft", self.selenium.get_text(
"//a[@name=\"document_state\"]"))
self.selenium.click("//a[@name=\"document_title\"]") self.selenium.click("//a[@name=\"document_title\"]")
unittest.time.sleep(2) unittest.time.sleep(2)
self.assertEqual("Rename Document", self.selenium.get_text("//span[@id=\"ui-dialog-title-edit_document\"]")) self.assertEqual("Rename Document", self.selenium.get_text("//span[@id=\"ui-dialog-title-edit_document\"]"))
......
from UNGTestMixin import UNGTestMixin from UNGTestMixin import UNGTestMixin
import unittest import unittest
class TestUNGDocsSharing(UNGTestMixin): class TestUNGDocsSharing(UNGTestMixin):
"""tests related to the action of share documents on UNG Docs""" """tests related to the action of share documents on UNG Docs"""
def test_share_web_page_with_another_user(self): def test_share_web_page_with_another_user(self):
"""test that web_page is correctly shared with another user""" """test that web_page is correctly shared with another user"""
self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template") self.selenium.open("ERP5Site_createNewWebDocument?template=web_page_template")
......
from UNGTestMixin import UNGTestMixin from UNGTestMixin import UNGTestMixin
import unittest import unittest
class TestUNGDocsTableEditor(UNGTestMixin): class TestUNGDocsTableEditor(UNGTestMixin):
def test_fill_some_cells_in_web_table(self): def test_fill_some_cells_in_web_table(self):
"""test the action of add, fill cells, assert title of sheet and """test the action of add, fill cells, assert title of sheet and
......
from UNGTestMixin import UNGTestMixin from UNGTestMixin import UNGTestMixin
import unittest import unittest
class TestUNGDocsTextEditor(UNGTestMixin): class TestUNGDocsTextEditor(UNGTestMixin):
"""tests related to UNG Docs text editors""" """tests related to UNG Docs text editors"""
def test_fill_content_on_web_page_with_fck_editor(self): def test_fill_content_on_web_page_with_fck_editor(self):
......
...@@ -3,6 +3,7 @@ import unittest ...@@ -3,6 +3,7 @@ import unittest
import re import re
class TestUNGGadgets(UNGTestMixin): class TestUNGGadgets(UNGTestMixin):
"""tests related to gadgets on UNG""" """tests related to gadgets on UNG"""
def test_add_and_delete_gadget(self): def test_add_and_delete_gadget(self):
......
from UNGTestMixin import UNGTestMixin from UNGTestMixin import UNGTestMixin
import unittest import unittest
class TestUNGSettings(UNGTestMixin): class TestUNGSettings(UNGTestMixin):
"""tests related to UNG settings""" """tests related to UNG settings"""
def test_saving_settings_even_on_different_users(self): def test_saving_settings_even_on_different_users(self):
......
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