From 66f526f8788b93afa4f3433bc70dc7014ccdde7a Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 16 Jul 2024 12:51:13 +0800 Subject: [PATCH] MDL-82373 question: Make window larger in behat tests I would suggest that this is a stop gap to solve some failing tests. We really need to look at whether we can improve the usability of this interface on smaller displays as a longer-term fix. --- mod/quiz/tests/behat/behat_mod_quiz.php | 3 +++ question/tests/behat/behat_core_question.php | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mod/quiz/tests/behat/behat_mod_quiz.php b/mod/quiz/tests/behat/behat_mod_quiz.php index 435da0958c2..555ded957a1 100644 --- a/mod/quiz/tests/behat/behat_mod_quiz.php +++ b/mod/quiz/tests/behat/behat_mod_quiz.php @@ -145,6 +145,9 @@ class behat_mod_quiz extends behat_question_base { return new moodle_url('/mod/quiz/review.php', ['attempt' => $attempt->id]); case 'question bank': + // The question bank does not handle fields at the edge of the viewport well. + // Increase the size to avoid this. + $this->execute('behat_general::i_change_window_size_to', ['window', 'large']); return new moodle_url('/question/edit.php', [ 'cmid' => $this->get_cm_by_quiz_name($identifier)->id, ]); diff --git a/question/tests/behat/behat_core_question.php b/question/tests/behat/behat_core_question.php index 03be434dcef..d2476c12da7 100644 --- a/question/tests/behat/behat_core_question.php +++ b/question/tests/behat/behat_core_question.php @@ -68,8 +68,12 @@ class behat_core_question extends behat_question_base { protected function resolve_page_instance_url(string $type, string $identifier): moodle_url { switch (strtolower($type)) { case 'course question bank': - return new moodle_url('/question/edit.php', - ['courseid' => $this->get_course_id($identifier)]); + // The question bank does not handle fields at the edge of the viewport well. + // Increase the size to avoid this. + $this->execute('behat_general::i_change_window_size_to', ['window', 'large']); + return new moodle_url('/question/edit.php', [ + 'courseid' => $this->get_course_id($identifier), + ]); case 'course question categories': return new moodle_url('/question/bank/managecategories/category.php',