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

Refactor to reuse rename_document when appropriate

- Also call wait_for_activities when asked for
parent a755b72a
...@@ -136,17 +136,24 @@ class UNGTestMixin(unittest.TestCase): ...@@ -136,17 +136,24 @@ class UNGTestMixin(unittest.TestCase):
self.selenium.stop() self.selenium.stop()
self.assertEqual([], self.verificationErrors) self.assertEqual([], self.verificationErrors)
def create_document(self, portal_type, name=None, keywords=None): def create_document(self, portal_type, keywords=None,
wait_for_activities=True, **kw):
"""create web documents, given a portal_type, optionally changing """create web documents, given a portal_type, optionally changing
properties: properties:
name = name of the document name = name of the document
keywords = keyword_list of the document keywords = keyword_list of the document
""" """
self.selenium.open("ERP5Site_createNewWebDocument?template=web_%s_template" % portal_type) self.selenium.open("ERP5Site_createNewWebDocument?template="
"web_%s_template" % portal_type)
self.selenium.wait_for_page_to_load("30000") self.selenium.wait_for_page_to_load("30000")
self.selenium.click("//a[@name=\"document_title\"]") if keywords or kw:
if name: self.rename_document(keywords=keywords,
self.selenium.type("//input[@id=\"name\"]", name) wait_for_activities=wait_for_activities, **kw)
elif wait_for_activities:
self.wait_for_activities()
return self.selenium.get_eval("selenium.browserbot."
"getCurrentWindow().location").split('?')[0]
def rename_document(self, url=None, keywords=None, stop_try=False, def rename_document(self, url=None, keywords=None, stop_try=False,
wait_for_activities=True, **kw): wait_for_activities=True, **kw):
"""Change document attributes. At the end, check if rename was """Change document attributes. At the end, check if rename was
......
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