From d396af939340cefd804c8fd712a275a115ae2686 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 28 Oct 2022 20:53:21 +0800 Subject: [PATCH] MDL-76120 behat: Swap click on select option to set field Recent versions of Marionette do not like to click on the option element so we must always use the set field option. --- .../tests/behat/navigate_content.feature | 12 ++++------ .../overview/tests/behat/regrading.feature | 12 +++++----- .../tests/behat/columnsortorder.feature | 6 ++--- .../tests/behat/question_comment.feature | 3 +-- .../tests/behat/question_status.feature | 22 ++++++++----------- .../tests/behat/question_reports.feature | 3 +-- 6 files changed, 22 insertions(+), 36 deletions(-) diff --git a/contentbank/tests/behat/navigate_content.feature b/contentbank/tests/behat/navigate_content.feature index a34e52a60a688..6faf18af4352f 100644 --- a/contentbank/tests/behat/navigate_content.feature +++ b/contentbank/tests/behat/navigate_content.feature @@ -44,13 +44,11 @@ Feature: Navigate to different contexts in the content bank And I should see "santjordi.h5p" And I should not see "santjordi_rose.h5p" And I should not see "Dragon.h5p" - And I click on "contextid" "select" - And I click on "Cat 1" "option" + And I set the field "contextid" to "Cat 1" Then I should not see "santjordi.h5p" And I should see "santjordi_rose.h5p" And I should not see "Dragon.h5p" - And I click on "contextid" "select" - And I click on "C0" "option" + And I set the field "contextid" to "C0" And I should not see "santjordi.h5p" And I should not see "santjordi_rose.h5p" And I should see "Dragon.h5p" @@ -82,8 +80,7 @@ Feature: Navigate to different contexts in the content bank And I should not see "princess.h5p" And I should not see "santjordi.h5p" And I should not see "santjordi_rose.h5p" - And I click on "contextid" "select" - And I click on "C1" "option" + And I set the field "contextid" to "C1" Then I should not see "Dragon.h5p" And I should see "princess.h5p" And I should not see "santjordi.h5p" @@ -102,7 +99,6 @@ Feature: Navigate to different contexts in the content bank And the "contextid" select box should not contain "Cat 2" And the "contextid" select box should not contain "C2" And I should see "Dragon.h5p" - And I click on "contextid" "select" - And I click on "Cat 1" "option" + And I set the field "contextid" to "Cat 1" And I should not see "Dragon.h5p" And I should see "santjordi_rose.h5p" diff --git a/mod/quiz/report/overview/tests/behat/regrading.feature b/mod/quiz/report/overview/tests/behat/regrading.feature index d6ab3f47ffd41..58d1bd605143e 100644 --- a/mod/quiz/report/overview/tests/behat/regrading.feature +++ b/mod/quiz/report/overview/tests/behat/regrading.feature @@ -81,8 +81,8 @@ Feature: Regrading quiz attempts using the Grades report And I follow "Edit question SA" And I set the field "id_fraction_1" to "50%" And I press "id_submitbutton" - And I click on "v1" "option" - And I click on "v2" "option" + And I set the field "version" in the "TF" "list_item" to "v1" + And I set the field "version" in the "SA" "list_item" to "v2 (latest)" And I follow "Attempts: 2" And I press "Dry run a full regrade" @@ -128,8 +128,7 @@ Feature: Regrading quiz attempts using the Grades report And I set the field "Correct answer" to "False" And I press "id_submitbutton" And I navigate to "Questions" in current page administration - And I click on "version" "select" in the "TF" "list_item" - And I click on "v2 (latest)" "option" + And I set the field "version" in the "TF" "list_item" to "v2 (latest)" And I navigate to "Results" in current page administration And I press "Dry run a full regrade" And I should see "Regrade completed" @@ -167,14 +166,13 @@ Feature: Regrading quiz attempts using the Grades report And I should see "v2" And I should see "v3 (latest)" # Set version that is going to be attempted to an older one. - And I click on "v1" "option" + And I set the field "version" in the "TF" "list_item" to "v1" And user "student3" has attempted "Quiz for testing regrading" with responses: | slot | response | | 1 | True | | 2 | toad | And I navigate to "Questions" in current page administration - And I click on "version" "select" in the "TF" "list_item" - And I click on "Always latest" "option" + And I set the field "version" in the "TF" "list_item" to "Always latest" And I navigate to "Results" in current page administration And I press "Regrade all" And I should see "Finished regrading (1/1)" diff --git a/question/bank/columnsortorder/tests/behat/columnsortorder.feature b/question/bank/columnsortorder/tests/behat/columnsortorder.feature index e3906356abbdf..0c3be7622552c 100644 --- a/question/bank/columnsortorder/tests/behat/columnsortorder.feature +++ b/question/bank/columnsortorder/tests/behat/columnsortorder.feature @@ -28,8 +28,7 @@ Feature: An plugin column can be reordered and displayed in the question bank vi Scenario: Teacher can see proper view Given I am on the "Test quiz Q001" "quiz activity" page logged in as "teacher1" When I navigate to "Question bank" in current page administration - And I click on "category" "select" - And I click on "Question category 1" "option" + And I set the field "category" to "Question category 1" And I should see "Test question to be seen" Then I should see "Teacher 1" @@ -39,8 +38,7 @@ Feature: An plugin column can be reordered and displayed in the question bank vi And I drag "Created by (creator_name_column)" "text" and I drop it in "T (question_type_column)" "text" And I am on the "Test quiz Q001" "quiz activity" page logged in as "teacher1" And I navigate to "Question bank" in current page administration - And I click on "category" "select" - And I click on "Question category 1" "option" + And I set the field "category" to "Question category 1" Then ".creatorname" "css_element" should appear before ".qtype" "css_element" Scenario: Disabling and enabling column display is proper diff --git a/question/bank/comment/tests/behat/question_comment.feature b/question/bank/comment/tests/behat/question_comment.feature index 1aaca0d492b8d..2aeeffa7bee4e 100644 --- a/question/bank/comment/tests/behat/question_comment.feature +++ b/question/bank/comment/tests/behat/question_comment.feature @@ -164,7 +164,6 @@ Feature: A Teacher can comment in a question And I click "0" on the row on the comments column And I should see "Version 2" Then I should see "edited question" - And I click on "question_version_dropdown" "select" And I should see "Version 1" - And I click on "Version 1" "option" + And I set the field "question_version_dropdown" to "Version 1" And I should see "Answer the first question" diff --git a/question/bank/editquestion/tests/behat/question_status.feature b/question/bank/editquestion/tests/behat/question_status.feature index 0a9abf83a39f4..db6349647a971 100644 --- a/question/bank/editquestion/tests/behat/question_status.feature +++ b/question/bank/editquestion/tests/behat/question_status.feature @@ -24,18 +24,14 @@ Feature: Use the qbank base view to test the status change using And I navigate to "Question bank" in current page administration And I set the field "Select a category" to "Test questions" And I should see "Test questions" - And I should see "Ready" in the "First question" "table_row" - And I should see "Ready" in the "Second question" "table_row" - And I click on "question_status_dropdown" "select" in the "First question" "table_row" - And I should see "Draft" - And I click on "Draft" "option" + And the field "question_status_dropdown" in the "First question" "table_row" matches value "Ready" + And the field "question_status_dropdown" in the "Second question" "table_row" matches value "Ready" + And I set the field "question_status_dropdown" to "Draft" And I reload the page - And I should see "Draft" in the "First question" "table_row" - And I should see "Ready" in the "Second question" "table_row" - And I click on "question_status_dropdown" "select" in the "Second question" "table_row" - And I click on "Draft" "option" - And I click on "question_status_dropdown" "select" in the "First question" "table_row" - And I click on "Ready" "option" + And the field "question_status_dropdown" in the "First question" "table_row" matches value "Draft" + And the field "question_status_dropdown" in the "Second question" "table_row" matches value "Ready" + And I set the field "question_status_dropdown" in the "Second question" "table_row" to "Draft" + And I set the field "question_status_dropdown" in the "First question" "table_row" to "Ready" And I reload the page - Then I should see "Ready" in the "First question" "table_row" - And I should see "Draft" in the "Second question" "table_row" + And the field "question_status_dropdown" in the "First question" "table_row" matches value "Ready" + And the field "question_status_dropdown" in the "Second question" "table_row" matches value "Draft" diff --git a/report/questioninstances/tests/behat/question_reports.feature b/report/questioninstances/tests/behat/question_reports.feature index 0e2a502d3fec0..49b9789d20909 100644 --- a/report/questioninstances/tests/behat/question_reports.feature +++ b/report/questioninstances/tests/behat/question_reports.feature @@ -53,8 +53,7 @@ Feature: A Teacher can generate question instance reports Then "Course: Course 1" row "Total" column of "generaltable" table should contain "2" And "Course: Course 1" row "Visible" column of "generaltable" table should contain "1" And "Course: Course 1" row "Hidden" column of "generaltable" table should contain "1" - And I click on "menuqtype" "select" - And I click on "True/False" "option" + And I set the field "menuqtype" to "True/False" And I press "Get the report" And "Course: Course 1" row "Total" column of "generaltable" table should contain "1" And "Course: Course 1" row "Visible" column of "generaltable" table should contain "0"