From 477f29d5ee4248efb49e3e208e6b227da8259dfe Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Thu, 6 Jun 2013 14:52:35 -0400 Subject: [PATCH] Added docstring specifying when this method must be called --- common/djangoapps/terrain/steps.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py index c126cae0ad..6e512982b7 100644 --- a/common/djangoapps/terrain/steps.py +++ b/common/djangoapps/terrain/steps.py @@ -163,14 +163,29 @@ def dialogs_are_closed(step): @step('I will confirm all alerts') def i_confirm_all_alerts(step): + """ + Please note: This method must be called RIGHT BEFORE an expected alert + Window variables are page local and thus all changes are removed upon navigating to a new page + In addition, this method changes the functionality of ONLY future alerts + """ world.browser.execute_script('window.confirm = function(){return true;} ; window.alert = function(){return;}') @step('I will cancel all alerts') def i_cancel_all_alerts(step): + """ + Please note: This method must be called RIGHT BEFORE an expected alert + Window variables are page local and thus all changes are removed upon navigating to a new page + In addition, this method changes the functionality of ONLY future alerts + """ world.browser.execute_script('window.confirm = function(){return false;} ; window.alert = function(){return;}') @step('I will answer all prompts with "([^"]*)"') def i_answer_prompts_with(step, prompt): + """ + Please note: This method must be called RIGHT BEFORE an expected alert + Window variables are page local and thus all changes are removed upon navigating to a new page + In addition, this method changes the functionality of ONLY future alerts + """ world.browser.execute_script('window.prompt = function(){return %s;}') % prompt