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] 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"