From adbe0fcb70a2eb6b9b6d1443d6e0991d64abe9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Massart?= Date: Tue, 27 Sep 2016 14:11:56 +0200 Subject: [PATCH 1/3] MDL-55071 mod_quiz: Action menu items were hidden The CSS rule was too vague and cause the menu items to be hidden rather than just the first item. --- mod/quiz/styles.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/quiz/styles.css b/mod/quiz/styles.css index 92f77c7968f..3fbe0d46814 100644 --- a/mod/quiz/styles.css +++ b/mod/quiz/styles.css @@ -560,8 +560,8 @@ table.quizreviewsummary td.cell { position: relative; } -#page-mod-quiz-edit ul.section li.pagenumber:first-child .add-menu-outer .menu :first-child, -#page-mod-quiz-edit .last-add-menu .add-menu-outer .menu :first-child { +#page-mod-quiz-edit ul.section li.pagenumber:first-child .add-menu-outer .menu > :first-child, +#page-mod-quiz-edit .last-add-menu .add-menu-outer .menu > :first-child { display: none; } From b3d0a8b4a786509477f55809ba7e7364ff0bd3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Massart?= Date: Tue, 27 Sep 2016 15:59:48 +0200 Subject: [PATCH 2/3] MDL-55071 behat: Normalise space on multi-field admin elements --- admin/templates/setting_courselist_frontpage.mustache | 2 +- admin/tests/behat/behat_admin.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/templates/setting_courselist_frontpage.mustache b/admin/templates/setting_courselist_frontpage.mustache index 1cde3aa075e..2fe18cc1028 100644 --- a/admin/templates/setting_courselist_frontpage.mustache +++ b/admin/templates/setting_courselist_frontpage.mustache @@ -39,7 +39,7 @@ }}
{{#selects}} - {{#options}} {{/options}} diff --git a/admin/tests/behat/behat_admin.php b/admin/tests/behat/behat_admin.php index 3f5cb46997e..73ce5728e20 100644 --- a/admin/tests/behat/behat_admin.php +++ b/admin/tests/behat/behat_admin.php @@ -89,8 +89,10 @@ class behat_admin extends behat_base { } catch (ElementNotFoundException $e) { // Multi element settings, interacting only the first one. - $fieldxpath = "//*[label[.= $label]|span[.= $label]]/ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" . - "/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]"; + $fieldxpath = "//*[label[normalize-space(.)= $label]|span[normalize-space(.)= $label]]/" . + "ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" . + "/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select]" . + "[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]"; $fieldnode = $this->find('xpath', $fieldxpath); // It is the same one that contains the type. From ce1a09f1242f28a436a083e1d1d8eb07a101b51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Massart?= Date: Tue, 27 Sep 2016 17:20:26 +0200 Subject: [PATCH 3/3] MDL-55071 mod_quiz: Fix behat selector for question chooser The chooser template now re-uses a core one which caused the IDs of the fields to be changed. The behat tests have been changed to target the new IDs. Note: using the label values did not work because more than one matched due to loose checking. --- mod/quiz/tests/behat/editing_add.feature | 22 +++++++++---------- .../tests/behat/editing_move_by_click.feature | 2 +- .../tests/behat/editing_repaginate.feature | 8 +++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/mod/quiz/tests/behat/editing_add.feature b/mod/quiz/tests/behat/editing_add.feature index 43097619746..cae2fc4e023 100644 --- a/mod/quiz/tests/behat/editing_add.feature +++ b/mod/quiz/tests/behat/editing_add.feature @@ -27,7 +27,7 @@ Feature: Edit quiz page - adding things Scenario: Add some new question to the quiz using '+ a new question' options of the 'Add' menu. And I open the "last" add to quiz menu And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 01 new" @@ -38,7 +38,7 @@ Feature: Edit quiz page - adding things And I open the "Page 1" add to quiz menu And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 02 new" @@ -50,7 +50,7 @@ Feature: Edit quiz page - adding things And I open the "Page 1" add to quiz menu And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 03 new" @@ -63,7 +63,7 @@ Feature: Edit quiz page - adding things And I open the "Page 1" add to quiz menu And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 04 new" @@ -89,7 +89,7 @@ Feature: Edit quiz page - adding things # Add a question to page 2. When I open the "Page 2" add to quiz menu And I choose "a new question" in the open action menu - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" When I set the field "Question name" to "Essay for page 2" @@ -129,7 +129,7 @@ Feature: Edit quiz page - adding things # Create the Essay 01 question. When I press "Create a new question ..." - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "Add" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 01" @@ -142,7 +142,7 @@ Feature: Edit quiz page - adding things And I should see "Select a category" And I set the field "Select a category:" to "Subcat 1" When I press "Create a new question ..." - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "Add" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 02" @@ -155,7 +155,7 @@ Feature: Edit quiz page - adding things And I set the field "Select a category" to "Default for C1" And I wait until the page is ready When I press "Create a new question ..." - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "Add" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 03" @@ -166,7 +166,7 @@ Feature: Edit quiz page - adding things # Create the TF 01 question. When I press "Create a new question ..." - And I set the field "qtype_qtype_truefalse" to "1" + And I set the field "item_qtype_truefalse" to "1" And I press "Add" Then I should see "Adding a True/False question" And I set the field "Question name" to "TF 01" @@ -178,7 +178,7 @@ Feature: Edit quiz page - adding things # Create the TF 02 question. When I press "Create a new question ..." - And I set the field "qtype_qtype_truefalse" to "1" + And I set the field "item_qtype_truefalse" to "1" And I press "Add" Then I should see "Adding a True/False question" And I set the field "Question name" to "TF 02" @@ -242,7 +242,7 @@ Feature: Edit quiz page - adding things # Add a random question to page 4. And I open the "Page 4" add to quiz menu And I choose "a new question" in the open action menu - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay for page 4" diff --git a/mod/quiz/tests/behat/editing_move_by_click.feature b/mod/quiz/tests/behat/editing_move_by_click.feature index 11442c560d6..955a659493f 100644 --- a/mod/quiz/tests/behat/editing_move_by_click.feature +++ b/mod/quiz/tests/behat/editing_move_by_click.feature @@ -70,7 +70,7 @@ Feature: Edit quiz page - drag-and-drop When I click on the "Add" page break icon after question "Question A" When I open the "Page 2" add to quiz menu And I choose "a new question" in the open action menu - And I set the field "qtype_qtype_description" to "1" + And I set the field "item_qtype_description" to "1" And I press "submitbutton" Then I should see "Adding a description" And I set the following fields to these values: diff --git a/mod/quiz/tests/behat/editing_repaginate.feature b/mod/quiz/tests/behat/editing_repaginate.feature index fb9148a2bde..2d7b438e847 100644 --- a/mod/quiz/tests/behat/editing_repaginate.feature +++ b/mod/quiz/tests/behat/editing_repaginate.feature @@ -32,7 +32,7 @@ Feature: Edit quiz page - pagination # Add the first Essay question. And I follow "Add" And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 01 new" @@ -44,7 +44,7 @@ Feature: Edit quiz page - pagination # Add the second Essay question. And I follow "Add" And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 02 new" @@ -69,7 +69,7 @@ Feature: Edit quiz page - pagination # Add the third Essay question. And I follow "Add" And I follow "a new question" - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" And I set the field "Question name" to "Essay 03 new" @@ -117,7 +117,7 @@ Feature: Edit quiz page - pagination # Add the forth Essay question in a new page (Page 4). When I open the "Page 3" add to quiz menu And I choose "a new question" in the open action menu - And I set the field "qtype_qtype_essay" to "1" + And I set the field "item_qtype_essay" to "1" And I press "submitbutton" Then I should see "Adding an Essay question" When I set the field "Question name" to "Essay 04 new"