From 80a26532bb5d7f24627e393b0c493e341a152036 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 5 Dec 2024 08:00:16 +0800 Subject: [PATCH] MDL-82946 behat: use existing questions to validate bulk delete This commit also changes the question names to something more logical --- .../behat/delete_question_column.feature | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/question/bank/deletequestion/tests/behat/delete_question_column.feature b/question/bank/deletequestion/tests/behat/delete_question_column.feature index 8768aabd4ca..7465469e948 100644 --- a/question/bank/deletequestion/tests/behat/delete_question_column.feature +++ b/question/bank/deletequestion/tests/behat/delete_question_column.feature @@ -18,11 +18,11 @@ Feature: Use the qbank plugin manager page for deletequestion And the following "question categories" exist: | contextlevel | reference | name | | Activity module | quiz1 | Test questions | - | Course | C1 | Course questions | And the following "questions" exist: - | questioncategory | qtype | name | questiontext | - | Test questions | truefalse | First question | Answer the first question | - | Test questions | truefalse | First question second | Answer the first question | + | questioncategory | qtype | name | questiontext | + | Test questions | truefalse | Question 1 | Answer the first question | + | Test questions | truefalse | Question 2 | Answer the second question | + | Test questions | truefalse | Question 3 | Answer the third question | Scenario: Enable/disable delete question column from the base view Given I log in as "admin" @@ -30,11 +30,11 @@ Feature: Use the qbank plugin manager page for deletequestion And I should see "Delete question" And I click on "Disable" "link" in the "Delete question" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page - Then the "Delete" action should not exist for the "First question" question in the question bank + Then the "Delete" action should not exist for the "Question 1" question in the question bank And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration And I click on "Enable" "link" in the "Delete question" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page - And the "Delete" action should exist for the "First question" question in the question bank + And the "Delete" action should exist for the "Question 1" question in the question bank @javascript Scenario: Enable/disable delete questions bulk action from the base view @@ -54,24 +54,24 @@ Feature: Use the qbank plugin manager page for deletequestion @javascript Scenario: I should not see the deleted questions in the base view Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin" - And I click on "First question" "checkbox" - And I click on "First question second" "checkbox" + And I click on "Question 1" "checkbox" + And I click on "Question 2" "checkbox" And I click on "With selected" "button" And I click on question bulk action "deleteselected" And I click on "Delete" "button" in the "Delete questions?" "dialogue" - Then I should not see "First question" - And I should not see "First question second" + Then I should not see "Question 1" + And I should not see "Question 2" @javascript Scenario: I should be able to delete a question when filtered using tags - Given I am on the "First question" "core_question > edit" page logged in as "admin" + Given I am on the "Question 1" "core_question > edit" page logged in as "admin" And I change window size to "large" And I set the following fields to these values: | Tags | foo | And I click on "Save changes" "button" And I am on the "Test quiz" "mod_quiz > question bank" page And I apply question bank filter "Tag" with value "foo" - And I click on "First question" "checkbox" + And I click on "Question 1" "checkbox" And I click on "With selected" "button" And I click on question bulk action "deleteselected" When I click on "Delete" "button" in the "Delete question?" "dialogue" @@ -80,15 +80,8 @@ Feature: Use the qbank plugin manager page for deletequestion @javascript Scenario: Questions can be bulk deleted from the question bank - Given the following "questions" exist: - | questioncategory | qtype | name | questiontext | - | Course questions | truefalse | Question 1 | Answer the first question | - | Course questions | missingtype | Question 2 | Write something | - | Course questions | essay | Question 3 | frog | - # Navigate to question bank. - And I am on the "Course 1" "core_question > course question bank" page logged in as teacher1 + Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1" # Select questions to be deleted. -# And I pause And I click on "Question 1" "checkbox" And I click on "Question 2" "checkbox" And I click on "With selected" "button"