From 7b7a3427d91cd09d2e40e7e463caf52daf193cc3 Mon Sep 17 00:00:00 2001 From: Jay Zoldak Date: Tue, 11 Jun 2013 15:16:12 -0400 Subject: [PATCH] Fix broken lettuce tests --- lms/djangoapps/courseware/features/problems.feature | 6 +++--- lms/djangoapps/courseware/features/problems.py | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/features/problems.feature b/lms/djangoapps/courseware/features/problems.feature index 9a2e908438..4a5e64e9f4 100644 --- a/lms/djangoapps/courseware/features/problems.feature +++ b/lms/djangoapps/courseware/features/problems.feature @@ -113,9 +113,9 @@ Feature: Answer problems Scenario: I can view and hide the answer if the problem has it: Given I am viewing a "numerical" that shows the answer "always" When I press the button with the label "Show Answer(s)" - Then The "Hide Answer(s)" button does appear - And The "Show Answer(s)" button does not appear + Then the button with the label "Hide Answer(s)" does appear + And the button with the label "Show Answer(s)" does not appear And I should see "4.14159" somewhere in the page When I press the button with the label "Hide Answer(s)" - Then The "Show Answer(s)" button does appear + Then the button with the label "Show Answer(s)" does appear And I should not see "4.14159" anywhere on the page diff --git a/lms/djangoapps/courseware/features/problems.py b/lms/djangoapps/courseware/features/problems.py index 0ad005d70a..4245e7ca86 100644 --- a/lms/djangoapps/courseware/features/problems.py +++ b/lms/djangoapps/courseware/features/problems.py @@ -126,6 +126,15 @@ def press_the_button_with_label(step, buttonname): @step(u'The "([^"]*)" button does( not)? appear') def action_button_present(step, buttonname, doesnt_appear): + button_css = 'section.action input[value*="%s"]' % buttonname + if doesnt_appear: + assert world.is_css_not_present(button_css) + else: + assert world.is_css_present(button_css) + + +@step(u'the button with the label "([^"]*)" does( not)? appear') +def button_with_label_present(step, buttonname, doesnt_appear): button_css = 'button span.show-label' elem = world.css_find(button_css).first if doesnt_appear: