MDL-79248 mod_quiz: Behat scenario interacts incorrectly with select

This test was using the click operator to select an option value, rather
than selecting the value with form field steps.

In addition I found that sometimes the way in which a WS is used to
make the change before a refresh leads to a random failure if the page
navigation happens too slowly.
This commit is contained in:
Andrew Nicols
2023-09-04 11:57:04 +08:00
parent 206c3a66e7
commit c5227b336f
4 changed files with 6 additions and 4 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -28,6 +28,7 @@ import * as Fragment from 'core/fragment';
import * as Templates from 'core/templates';
import * as FormChangeChecker from 'core_form/changechecker';
import {call as fetchMany} from 'core/ajax';
import Pending from 'core/pending';
const SELECTORS = {
EXISTING_CATEGORY_CONTAINER: '[data-region="existing-category-container"]',
@@ -318,6 +319,8 @@ export default class ModalAddRandomQuestion extends Modal {
newcategory,
parentcategory
) {
// We do not need to resolve this Pending because the form submission will result in a page redirect.
new Pending('mod-quiz/modal_add_random_questions');
const call = {
methodname: 'mod_quiz_add_random_questions',
args: {
@@ -282,8 +282,7 @@ Feature: Edit quiz page - remove multiple questions
# Delete all questions in page. Page contains multiple questions.
When I open the "last" add to quiz menu
And I follow "a random question"
And I click on "menurandomcount" "select"
And I click on "3" "option"
And I set the field "Number of random questions" to "3"
And I press "Add random question"
And I click on "Select multiple items" "button"
And I press "Select all"