From 35f7cf429c73991920d8c070a58d8c9c728b31a7 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 27 Jul 2016 11:00:54 +0800 Subject: [PATCH] MDL-54987 behat: Fixed feedback scenarios to display chart data Now chart data is not visible by default, we need to click 'Show chart data' to view. Also, extra space is not required between % as it's done by chart library --- mod/feedback/item/multichoice/lib.php | 2 +- mod/feedback/item/multichoicerated/lib.php | 5 +- mod/feedback/tests/behat/anonymous.feature | 19 +++-- .../tests/behat/behat_mod_feedback.php | 27 ++++++ .../tests/behat/coursemapping.feature | 16 +++- mod/feedback/tests/behat/groups.feature | 18 ++++ mod/feedback/tests/behat/multichoice.feature | 85 +++++++++++-------- .../tests/behat/non_anonymous.feature | 13 ++- .../tests/behat/question_types.feature | 37 ++++---- .../behat/question_types_non_anon.feature | 35 ++++---- 10 files changed, 167 insertions(+), 90 deletions(-) diff --git a/mod/feedback/item/multichoice/lib.php b/mod/feedback/item/multichoice/lib.php index 3e31ce104a7..63c515b895c 100644 --- a/mod/feedback/item/multichoice/lib.php +++ b/mod/feedback/item/multichoice/lib.php @@ -223,7 +223,7 @@ class feedback_item_multichoice extends feedback_item_base { $quotient = format_float($val->quotient * 100, 2); $strquotient = ''; if ($val->quotient > 0) { - $strquotient = ' ('. $quotient . ' %)'; + $strquotient = '('. $quotient . ' %)'; } $answertext = format_text(trim($val->answertext), FORMAT_HTML, array('noclean' => true, 'para' => false)); diff --git a/mod/feedback/item/multichoicerated/lib.php b/mod/feedback/item/multichoicerated/lib.php index b77f7e6b41f..a28a6d25de0 100644 --- a/mod/feedback/item/multichoicerated/lib.php +++ b/mod/feedback/item/multichoicerated/lib.php @@ -194,10 +194,11 @@ class feedback_item_multichoicerated extends feedback_item_base { foreach ($analysed_vals as $val) { $avg += $val->avg; $quotient = format_float($val->quotient * 100, 2); - $answertext = format_text(trim($val->answertext), FORMAT_HTML, + $answertext = '('.$val->value.') ' . format_text(trim($val->answertext), FORMAT_HTML, array('noclean' => true, 'para' => false)); + if ($val->quotient > 0) { - $strquotient = ' ('.$quotient.' %)'; + $strquotient = '('.$quotient.' %)'; } else { $strquotient = ''; } diff --git a/mod/feedback/tests/behat/anonymous.feature b/mod/feedback/tests/behat/anonymous.feature index b279660b274..f18b618e426 100644 --- a/mod/feedback/tests/behat/anonymous.feature +++ b/mod/feedback/tests/behat/anonymous.feature @@ -60,6 +60,7 @@ Feature: Anonymous feedback And I should not see "Submitted answers" And I press "Continue" + @javascript Scenario: Complete anonymous feedback and view analysis on the front page as an authenticated user And I log in as "admin" And I set the following system permissions of "Authenticated user on frontpage" role: @@ -92,9 +93,10 @@ Feature: Anonymous feedback And I should see "Submitted answers: 2" And I should see "Questions: 1" # And I should not see "multichoice2" # TODO MDL-29303 do not show labels to users who can not edit feedback + And I show chart data for the "multichoice2" feedback And I should see "Do you like our site?" - And I should see "1 (50.00 %)" in the "Yes:" "table_row" - And I should see "1 (50.00 %)" in the "No:" "table_row" + And I should see "1 (50.00 %)" in the "Yes" "table_row" + And I should see "1 (50.00 %)" in the "No" "table_row" And I log out And I log in as "manager" And I am on site homepage @@ -124,6 +126,7 @@ Feature: Anonymous feedback And I should not see "Submitted answers" And I press "Continue" + @javascript Scenario: Complete fully anonymous feedback and view analyze on the front page as a guest And I log in as "admin" And I set the following administration settings values: @@ -156,9 +159,10 @@ Feature: Anonymous feedback And I should see "Submitted answers: 2" And I should see "Questions: 1" # And I should not see "multichoice2" # TODO MDL-29303 + And I show chart data for the "multichoice2" feedback And I should see "Do you like our site?" - And I should see "1 (50.00 %)" in the "Yes:" "table_row" - And I should see "1 (50.00 %)" in the "No:" "table_row" + And I should see "1 (50.00 %)" in the "Yes" "table_row" + And I should see "1 (50.00 %)" in the "No" "table_row" And I log in as "manager" And I am on site homepage And I follow "Site feedback" @@ -168,6 +172,7 @@ Feature: Anonymous feedback And I should see "Response number: 1 (Anonymous)" And I log out + @javascript Scenario: Anonymous feedback in a course # Teacher can not When I log in as "teacher" @@ -208,9 +213,10 @@ Feature: Anonymous feedback And I should see "Submitted answers: 2" And I should see "Questions: 1" # And I should not see "multichoice2" # TODO MDL-29303 + And I show chart data for the "multichoice1" feedback And I should see "Do you like this course?" - And I should see "1 (50.00 %)" in the "Yes:" "table_row" - And I should see "1 (50.00 %)" in the "No:" "table_row" + And I should see "1 (50.00 %)" in the "Yes" "table_row" + And I should see "1 (50.00 %)" in the "No" "table_row" And I log out And I log in as "teacher" And I follow "Course 1" @@ -233,6 +239,7 @@ Feature: Anonymous feedback And I follow "Back" # Delete anonymous response And I click on "Delete entry" "link" in the "Response number: 1" "table_row" + And I press "Yes" And I should see "Anonymous entries (1)" And I should not see "Response number: 1" And I should see "Response number: 2" diff --git a/mod/feedback/tests/behat/behat_mod_feedback.php b/mod/feedback/tests/behat/behat_mod_feedback.php index 23ad80cdddb..5c46245057e 100644 --- a/mod/feedback/tests/behat/behat_mod_feedback.php +++ b/mod/feedback/tests/behat/behat_mod_feedback.php @@ -128,6 +128,33 @@ class behat_mod_feedback extends behat_base { $this->compare_exports(file_get_contents($CFG->dirroot . '/' . $filename), $result); } + /** + * Clicks on Show chart data to display chart data if not visible. + * + * @Then /^I show chart data for the "(?P(?:[^"]|\\")*)" feedback$/ + * @param string $feedbackname name of the feedback for which chart data needs to be shown. + */ + public function i_show_chart_data_for_the_feedback($feedbackname) { + + $feedbackxpath = "//th[contains(normalize-space(string(.)), \"" . $feedbackname . "\")]/ancestor::table/" . + "following-sibling::div[contains(concat(' ', normalize-space(@class), ' '), ' chart-area ')][1]" . + "//p[contains(concat(' ', normalize-space(@class), ' '), ' chart-table-expand ')]"; + + $charttabledataxpath = $feedbackxpath . + "/following-sibling::div[contains(concat(' ', normalize-space(@class), ' '), ' chart-table-data ')][1]"; + + // If chart data is not visible then expand. + $node = $this->get_selected_node("xpath_element", $charttabledataxpath); + if (!$node->isVisible()) { + $this->execute('behat_general::i_click_on_in_the', array( + get_string('showchartdata'), + 'link', + $feedbackxpath, + 'xpath_element' + )); + } + } + /** * Ensures two feedback export files are identical * diff --git a/mod/feedback/tests/behat/coursemapping.feature b/mod/feedback/tests/behat/coursemapping.feature index bf22d09c824..047a35e9b4b 100644 --- a/mod/feedback/tests/behat/coursemapping.feature +++ b/mod/feedback/tests/behat/coursemapping.feature @@ -116,17 +116,19 @@ Feature: Mapping courses in a feedback And I follow "Analysis" And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I show chart data for the "multichoicerated" feedback And I should see "1 (33.33 %)" in the "option a" "table_row" And I should see "1 (33.33 %)" in the "option b" "table_row" And I should see "1 (33.33 %)" in the "option c" "table_row" - And I should see "Average: 2.00" in the "(multichoicerated)" "table" - And I click on "Sort by course" "link" in the "(multichoicerated)" "table" + And I should see "Average: 2.00" + And I follow "Sort by course" And I should see "2.50" in the "C1" "table_row" And I should see "1.00" in the "Acceptance test site" "table_row" And I follow "Back" And I set the field "Filter by course" to "Course 1" And I press "Filter" And I should see "Course 1" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "1 (50.00 %)" in the "option b" "table_row" And I should see "1 (50.00 %)" in the "option c" "table_row" @@ -197,27 +199,33 @@ Feature: Mapping courses in a feedback And I follow "Course feedback" And I follow "Analysis" And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element" + And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "1 (33.33 %)" in the "option b" "table_row" And I should see "2 (66.67 %)" in the "option c" "table_row" - And I should see "Average: 3.67" in the "(multichoicerated)" "table" - And I click on "Sort by course" "link" in the "(multichoicerated)" "table" + And I should see "Average: 3.67" + And I click on "Sort by course" "link" And I should see "3.00" in the "C3" "table_row" And I should see "2.50" in the "C2" "table_row" And I follow "Back" And I set the field "Filter by course" to "Course 2" And I press "Filter" + And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "1 (50.00 %)" in the "option b" "table_row" And I should see "1 (50.00 %)" in the "option c" "table_row" + And I show chart data for the "multichoicesimple" feedback And I should see "2 (100.00 %)" in the "option e" "table_row" And I set the field "Filter by course" to "Course 3" And I press "Filter" + And I show chart data for the "multichoicerated" feedback And I should see "0" in the "option a" "table_row" And I should see "0" in the "option b" "table_row" And I should see "1 (100.00 %)" in the "option c" "table_row" + And I show chart data for the "multichoicesimple" feedback And I should see "1 (100.00 %)" in the "option d" "table_row" And I follow "Show all" + And I show chart data for the "multichoicesimple" feedback And I should see "1 (33.33 %)" in the "option d" "table_row" And I should see "2 (66.67 %)" in the "option e" "table_row" And I should see "0" in the "option f" "table_row" diff --git a/mod/feedback/tests/behat/groups.feature b/mod/feedback/tests/behat/groups.feature index ec867c915fd..181188d6cbe 100644 --- a/mod/feedback/tests/behat/groups.feature +++ b/mod/feedback/tests/behat/groups.feature @@ -62,6 +62,7 @@ Feature: Feedbacks in courses with groups | Multiple choice values | Yes of course\nNot at all\nI don't know | And I log out + @javascript Scenario: Non anonymous feedback with groups in a course When I log in as "teacher" And I follow "Course 1" @@ -94,6 +95,7 @@ Feature: Feedbacks in courses with groups And I follow "Course feedback" And I follow "Submitted answers" And I should see "Separate groups: Group 1" + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I log out @@ -103,6 +105,7 @@ Feature: Feedbacks in courses with groups And I follow "Course feedback" And I follow "Submitted answers" And I should see "Separate groups: Group 2" + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I log out @@ -112,9 +115,11 @@ Feature: Feedbacks in courses with groups And I follow "Course feedback" And I follow "Submitted answers" And the field "Separate groups" matches value "Group 1" + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I select "Group 2" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And the "Separate groups" select box should not contain "All participants" @@ -125,6 +130,7 @@ Feature: Feedbacks in courses with groups And I follow "Course feedback" And I follow "Submitted answers" And I should see "Separate groups: All participants" + And I show chart data for the "multichoice1" feedback And I should see "2 (28.57 %)" in the "Yes of course" "table_row" And I should see "3 (42.86 %)" in the "Not at all" "table_row" And I should see "2 (28.57 %)" in the "I don't know" "table_row" @@ -135,13 +141,16 @@ Feature: Feedbacks in courses with groups And I follow "Course feedback" And I follow "Analysis" And the field "Separate groups" matches value "All participants" + And I show chart data for the "multichoice1" feedback And I should see "2 (28.57 %)" in the "Yes of course" "table_row" And I should see "3 (42.86 %)" in the "Not at all" "table_row" And I should see "2 (28.57 %)" in the "I don't know" "table_row" And I select "Group 1" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I select "Group 2" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I follow "Show responses" @@ -156,6 +165,7 @@ Feature: Feedbacks in courses with groups And I should see "Username 3" And I log out + @javascript Scenario: Anonymous feedback with groups in a course When I log in as "teacher" And I follow "Course 1" @@ -195,6 +205,7 @@ Feature: Feedbacks in courses with groups And I follow "Course anon feedback" And I follow "Submitted answers" And I should see "Separate groups: Group 1" + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I log out @@ -204,6 +215,7 @@ Feature: Feedbacks in courses with groups And I follow "Course anon feedback" And I follow "Submitted answers" And I should see "Separate groups: Group 2" + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I log out @@ -213,9 +225,11 @@ Feature: Feedbacks in courses with groups And I follow "Course anon feedback" And I follow "Submitted answers" And the field "Separate groups" matches value "Group 1" + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I select "Group 2" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And the "Separate groups" select box should not contain "All participants" @@ -226,6 +240,7 @@ Feature: Feedbacks in courses with groups And I follow "Course anon feedback" And I follow "Submitted answers" And I should see "Separate groups: All participants" + And I show chart data for the "multichoice1" feedback And I should see "2 (28.57 %)" in the "Yes of course" "table_row" And I should see "3 (42.86 %)" in the "Not at all" "table_row" And I should see "2 (28.57 %)" in the "I don't know" "table_row" @@ -236,13 +251,16 @@ Feature: Feedbacks in courses with groups And I follow "Course anon feedback" And I follow "Analysis" And the field "Separate groups" matches value "All participants" + And I show chart data for the "multichoice1" feedback And I should see "2 (28.57 %)" in the "Yes of course" "table_row" And I should see "3 (42.86 %)" in the "Not at all" "table_row" And I should see "2 (28.57 %)" in the "I don't know" "table_row" And I select "Group 1" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "2 (50.00 %)" in the "Yes of course" "table_row" And I should see "1 (25.00 %)" in the "Not at all" "table_row" And I select "Group 2" from the "Separate groups" singleselect + And I show chart data for the "multichoice1" feedback And I should see "0" in the "Yes of course" "table_row" And I should see "2 (66.67 %)" in the "Not at all" "table_row" And I follow "Show responses" diff --git a/mod/feedback/tests/behat/multichoice.feature b/mod/feedback/tests/behat/multichoice.feature index 6d7d16c835c..0a672a1af24 100644 --- a/mod/feedback/tests/behat/multichoice.feature +++ b/mod/feedback/tests/behat/multichoice.feature @@ -144,24 +144,28 @@ Feature: Testing multichoice questions in feedback And I follow "Analysis" And I should see "Submitted answers: 2" And I should see "Questions: 3" - And I should see "1 (50.00 %)" in the "option a:" "table_row" - And I should not see "%" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" - And I should see "1 (50.00 %)" in the "option d:" "table_row" - And I should not see "%" in the "option e:" "table_row" - And I should see "1 (50.00 %)" in the "option f:" "table_row" - And I should not see "%" in the "option g:" "table_row" - And I should not see "%" in the "option h:" "table_row" - And I should see "1 (100.00 %)" in the "option i:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (50.00 %)" in the "option a" "table_row" + And I should not see "%" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" + And I show chart data for the "multichoice2" feedback + And I should see "1 (50.00 %)" in the "option d" "table_row" + And I should not see "%" in the "option e" "table_row" + And I should see "1 (50.00 %)" in the "option f" "table_row" + And I show chart data for the "multichoice3" feedback + And I should not see "%" in the "option g" "table_row" + And I should not see "%" in the "option h" "table_row" + And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" - And I should see "1 (100.00 %)" in the "option a:" "table_row" - And I should not see "%" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (100.00 %)" in the "option a" "table_row" + And I should not see "%" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" And I log out @javascript @@ -283,26 +287,31 @@ Feature: Testing multichoice questions in feedback And I follow "Analysis" And I should see "Submitted answers: 2" And I should see "Questions: 3" - And I should see "1 (50.00 %)" in the "option a:" "table_row" - And I should see "1 (50.00 %)" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" - And I should see "1 (50.00 %)" in the "option d:" "table_row" - And I should not see "%" in the "option e:" "table_row" - And I should see "2 (100.00 %)" in the "option f:" "table_row" - And I should not see "%" in the "option g:" "table_row" - And I should not see "%" in the "option h:" "table_row" - And I should see "1 (100.00 %)" in the "option i:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (50.00 %)" in the "option a" "table_row" + And I should see "1 (50.00 %)" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" + And I show chart data for the "multichoice2" feedback + And I should see "1 (50.00 %)" in the "option d" "table_row" + And I should not see "%" in the "option e" "table_row" + And I should see "2 (100.00 %)" in the "option f" "table_row" + And I show chart data for the "multichoice3" feedback + And I should not see "%" in the "option g" "table_row" + And I should not see "%" in the "option h" "table_row" + And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" - And I should see "1 (100.00 %)" in the "option a:" "table_row" - And I should see "1 (100.00 %)" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (100.00 %)" in the "option a" "table_row" + And I should see "1 (100.00 %)" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" And I log out + @javascript Scenario: Non-rated single-answer dropdown multiple choice questions in feedback When I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 1 | @@ -400,22 +409,26 @@ Feature: Testing multichoice questions in feedback And I follow "Analysis" And I should see "Submitted answers: 2" And I should see "Questions: 3" - And I should see "1 (50.00 %)" in the "option a:" "table_row" - And I should not see "%" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" - And I should see "1 (50.00 %)" in the "option d:" "table_row" - And I should not see "%" in the "option e:" "table_row" - And I should see "1 (50.00 %)" in the "option f:" "table_row" - And I should not see "%" in the "option g:" "table_row" - And I should not see "%" in the "option h:" "table_row" - And I should see "1 (100.00 %)" in the "option i:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (50.00 %)" in the "option a" "table_row" + And I should not see "%" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" + And I show chart data for the "multichoice2" feedback + And I should see "1 (50.00 %)" in the "option d" "table_row" + And I should not see "%" in the "option e" "table_row" + And I should see "1 (50.00 %)" in the "option f" "table_row" + And I show chart data for the "multichoice3" feedback + And I should not see "%" in the "option g" "table_row" + And I should not see "%" in the "option h" "table_row" + And I should see "1 (100.00 %)" in the "option i" "table_row" # Change the settings so we don't analyse empty submits And I follow "Edit questions" And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element" And I set the field "Do not analyse empty submits" to "Yes" And I press "Save changes to question" And I follow "Analysis" - And I should see "1 (100.00 %)" in the "option a:" "table_row" - And I should not see "%" in the "option b:" "table_row" - And I should not see "%" in the "option c:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (100.00 %)" in the "option a" "table_row" + And I should not see "%" in the "option b" "table_row" + And I should not see "%" in the "option c" "table_row" And I log out diff --git a/mod/feedback/tests/behat/non_anonymous.feature b/mod/feedback/tests/behat/non_anonymous.feature index a7d5c91bb27..f657f773109 100644 --- a/mod/feedback/tests/behat/non_anonymous.feature +++ b/mod/feedback/tests/behat/non_anonymous.feature @@ -60,6 +60,7 @@ Feature: Non anonymous feedback And I should not see "Submitted answers" And I press "Continue" + @javascript Scenario: Complete non anonymous feedback and view analysis on the front page as an authenticated user And I log in as "admin" And I set the following system permissions of "Authenticated user on frontpage" role: @@ -86,9 +87,10 @@ Feature: Non anonymous feedback And I should see "Submitted answers: 2" And I should see "Questions: 1" # And I should not see "multichoice2" # TODO MDL-29303 do not show labels to users who can not edit feedback + And I show chart data for the "multichoice2" feedback And I should see "Do you like our site?" - And I should see "1 (50.00 %)" in the "Yes of course:" "table_row" - And I should see "1 (50.00 %)" in the "Not at all:" "table_row" + And I should see "1 (50.00 %)" in the "Yes of course" "table_row" + And I should see "1 (50.00 %)" in the "Not at all" "table_row" And I should not see "Show responses" And I log out And I log in as "manager" @@ -104,6 +106,7 @@ Feature: Non anonymous feedback And I follow "Back" And I log out + @javascript Scenario: Non anonymous feedback in a course When I log in as "teacher" And I follow "Course 1" @@ -137,9 +140,10 @@ Feature: Non anonymous feedback And I should see "Submitted answers: 2" And I should see "Questions: 1" # And I should not see "multichoice2" # TODO MDL-29303 + And I show chart data for the "multichoice1" feedback And I should see "Do you like this course?" - And I should see "1 (50.00 %)" in the "Yes of course:" "table_row" - And I should see "1 (50.00 %)" in the "Not at all:" "table_row" + And I should see "1 (50.00 %)" in the "Yes of course" "table_row" + And I should see "1 (50.00 %)" in the "Not at all" "table_row" And I log out And I log in as "teacher" And I follow "Course 1" @@ -162,6 +166,7 @@ Feature: Non anonymous feedback And I follow "Back" # Delete non anonymous response And I click on "Delete entry" "link" in the "Username 1" "table_row" + And I press "Yes" And I should see "Non anonymous entries (1)" And I should not see "Username 1" And I should see "Username 2" diff --git a/mod/feedback/tests/behat/question_types.feature b/mod/feedback/tests/behat/question_types.feature index 75958b4279c..1fddcc3e1c0 100644 --- a/mod/feedback/tests/behat/question_types.feature +++ b/mod/feedback/tests/behat/question_types.feature @@ -4,7 +4,8 @@ Feature: Test creating different types of feedback questions for anonymous feedb As a teacher I need to be able to add different question types - Background: + @javascript + Scenario: Create different types of questions in anonymous feedback with javascript enabled Given the following "users" exist: | username | firstname | lastname | | teacher1 | Teacher | 1 | @@ -109,29 +110,27 @@ Feature: Test creating different types of feedback questions for anonymous feedb And I should see "C1" in the "(info)" "table" And I should see "my long answer" in the "(longertext)" "table" And I should see "lots of feedbacks" in the "(longertext)" "table" - And I should see "2 (100.00 %)" in the "option d:" "table_row" - And I should see "1 (50.00 %)" in the "option e:" "table_row" - And I should see "1 (50.00 %)" in the "option f:" "table_row" - And I should see "0" in the "option g:" "table_row" - And I should not see "%" in the "option g:" "table_row" - And I should see "1 (50.00 %)" in the "option h:" "table_row" - And I should see "1 (50.00 %)" in the "option i:" "table_row" - And I should see "0" in the "(0) option k" "table_row" + And I show chart data for the "multichoice2" feedback + And I should see "2 (100.00 %)" in the "option d" "table_row" + And I should see "1 (50.00 %)" in the "option e" "table_row" + And I should see "1 (50.00 %)" in the "option f" "table_row" + And I show chart data for the "multichoice3" feedback + And I should see "0" in the "option g" "table_row" + And I should not see "%" in the "option g" "table_row" + And I should see "1 (50.00 %)" in the "option h" "table_row" + And I should see "1 (50.00 %)" in the "option i" "table_row" + And I show chart data for the "multichoice4" feedback + And I should see "0" in the "option k" "table_row" And I should not see "%" in the "(0) option k" "table_row" And I should see "1 (50.00 %)" in the "(1) option l" "table_row" - And I should see "1 (50.00 %)" in the "(5) option m:" "table_row" - And I should see "Average: 3.00" in the "(multichoice4)" "table" + And I should see "1 (50.00 %)" in the "(5) option m" "table_row" + And I should see "Average: 3.00" And I should see "35" in the "(numeric)" "table" And I should see "71" in the "(numeric)" "table" And I should see "Average: 53.00" in the "(numeric)" "table" And I should see "no way" in the "(shorttext)" "table" And I should see "hello" in the "(shorttext)" "table" - - Scenario: Create different types of questions in anonymous feedback with javascript disabled - And I log out - - @javascript - Scenario: Create different types of questions in anonymous feedback with javascript enabled - And I should see "1 (50.00 %)" in the "option a:" "table_row" - And I should see "1 (50.00 %)" in the "option b:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (50.00 %)" in the "option a" "table_row" + And I should see "1 (50.00 %)" in the "option b" "table_row" And I log out diff --git a/mod/feedback/tests/behat/question_types_non_anon.feature b/mod/feedback/tests/behat/question_types_non_anon.feature index 1641ddcc92e..834a146af92 100644 --- a/mod/feedback/tests/behat/question_types_non_anon.feature +++ b/mod/feedback/tests/behat/question_types_non_anon.feature @@ -4,7 +4,8 @@ Feature: Test creating different types of feedback questions for non-anonymous f As a teacher I need to be able to add different question types - Background: + @javascript + Scenario: Create different types of questions in non-anonymous feedback with javascript enabled Given the following "users" exist: | username | firstname | lastname | | teacher1 | Teacher | 1 | @@ -113,29 +114,27 @@ Feature: Test creating different types of feedback questions for non-anonymous f And I should see "C1" in the "(info)" "table" And I should see "my long answer" in the "(longertext)" "table" And I should see "lots of feedbacks" in the "(longertext)" "table" - And I should see "2 (100.00 %)" in the "option d:" "table_row" - And I should see "1 (50.00 %)" in the "option e:" "table_row" - And I should see "1 (50.00 %)" in the "option f:" "table_row" - And I should see "0" in the "option g:" "table_row" - And I should not see "%" in the "option g:" "table_row" - And I should see "1 (50.00 %)" in the "option h:" "table_row" - And I should see "1 (50.00 %)" in the "option i:" "table_row" + And I show chart data for the "multichoice2" feedback + And I should see "2 (100.00 %)" in the "option d" "table_row" + And I should see "1 (50.00 %)" in the "option e" "table_row" + And I should see "1 (50.00 %)" in the "option f" "table_row" + And I show chart data for the "multichoice3" feedback + And I should see "0" in the "option g" "table_row" + And I should not see "%" in the "option g" "table_row" + And I should see "1 (50.00 %)" in the "option h" "table_row" + And I should see "1 (50.00 %)" in the "option i" "table_row" + And I show chart data for the "multichoice4" feedback And I should see "0" in the "(0) option k" "table_row" And I should not see "%" in the "(0) option k" "table_row" And I should see "1 (50.00 %)" in the "(1) option l" "table_row" - And I should see "1 (50.00 %)" in the "(5) option m:" "table_row" - And I should see "Average: 3.00" in the "(multichoice4)" "table" + And I should see "1 (50.00 %)" in the "(5) option m" "table_row" + And I should see "Average: 3.00" And I should see "35" in the "(numeric)" "table" And I should see "71" in the "(numeric)" "table" And I should see "Average: 53.00" in the "(numeric)" "table" And I should see "no way" in the "(shorttext)" "table" And I should see "hello" in the "(shorttext)" "table" - - Scenario: Create different types of questions in non-anonymous feedback with javascript disabled - And I log out - - @javascript - Scenario: Create different types of questions in non-anonymous feedback with javascript enabled - And I should see "1 (50.00 %)" in the "option a:" "table_row" - And I should see "1 (50.00 %)" in the "option b:" "table_row" + And I show chart data for the "multichoice1" feedback + And I should see "1 (50.00 %)" in the "option a" "table_row" + And I should see "1 (50.00 %)" in the "option b" "table_row" And I log out