Commit 4558ac2f authored by Arnaud Fontaine's avatar Arnaud Fontaine

Allow to specify an expected transition message when submitting a workflow...

Allow to specify an expected transition message when submitting a workflow even if there is no dialog.
parent 7a64a400
...@@ -987,7 +987,7 @@ class ContextMainForm(MainForm): ...@@ -987,7 +987,7 @@ class ContextMainForm(MainForm):
maximum_attempt_number=1, maximum_attempt_number=1,
sleep_between_attempt=0, sleep_between_attempt=0,
dialog_name=None, dialog_name=None,
dialog_expected_transition_message=None, expected_transition_message=None,
**kw): **kw):
""" """
Select and submit a workflow action, given either by its label Select and submit a workflow action, given either by its label
...@@ -1022,8 +1022,8 @@ class ContextMainForm(MainForm): ...@@ -1022,8 +1022,8 @@ class ContextMainForm(MainForm):
@type sleep_between_attempt: int @type sleep_between_attempt: int
@param dialog_name: Function to call after the workflow action ('cancel' or 'confirm') @param dialog_name: Function to call after the workflow action ('cancel' or 'confirm')
@type dialog_name: str @type dialog_name: str
@param dialog_expected_transition_message: Expected dialog transition message @param expected_transition_message: Expected dialog transition message
@type dialog_expected_transition_message: str @type expected_transition_message: str
""" """
url_before = self.browser.url url_before = self.browser.url
...@@ -1045,13 +1045,14 @@ class ContextMainForm(MainForm): ...@@ -1045,13 +1045,14 @@ class ContextMainForm(MainForm):
getattr(self.browser.mainForm, getattr(self.browser.mainForm,
'submitDialog' + dialog_name.capitalize())() 'submitDialog' + dialog_name.capitalize())()
if dialog_expected_transition_message: if expected_transition_message:
transition_message = self.browser.getTransitionMessage() transition_message = self.browser.getTransitionMessage()
if transition_message != dialog_expected_transition_message: if transition_message != expected_transition_message:
raise AssertionError("Expected transition message: %s, got: %s" % \ raise AssertionError("Expected transition message: %s, got: %s" % \
(dialog_expected_transition_message, (expected_transition_message,
transition_message)) transition_message))
if dialog_name:
return show_dialog_time return show_dialog_time
if maximum_attempt_number == 1: if maximum_attempt_number == 1:
......
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