1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-02 23:12:32 +02:00

MDL-83778 quiz: prevent page caching for quiz view page

This commit is contained in:
Khoa Nguyen 2024-11-22 10:54:21 +07:00
parent 505a85eb9a
commit 93289564e0
2 changed files with 19 additions and 0 deletions

@ -104,3 +104,20 @@ Feature: The various checks that may happen when an attept is started
And I press "Cancel"
Then I should see "Quiz 1 description"
And "Attempt quiz" "button" should be visible
@javascript
Scenario: Quiz attempt page reloads upon navigating back using the browser's back button
Given the following "activities" exist:
| activity | name | intro | course | idnumber | timelimit |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | 3600 |
And quiz "Quiz 1" contains the following questions:
| question | page |
| TF1 | 1 |
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
And I press "Attempt quiz"
And I should see "Your attempt will have a time limit of 1 hour. When you " in the "Start attempt" "dialogue"
And I start watching to see if a new page loads
And I click on "Start attempt" "button" in the "Start attempt" "dialogue"
And I press the "back" button in the browser
Then a new page should have loaded since I started watching
And I should see "Continue your attempt"

@ -68,6 +68,8 @@ quiz_view($quiz, $course, $cm, $context);
// Initialize $PAGE, compute blocks.
$PAGE->set_url('/mod/quiz/view.php', ['id' => $cm->id]);
// On the quiz view page, the browser back/forwards buttons should force a reload.
$PAGE->set_cacheable(false);
// Create view object which collects all the information the renderer will need.
$viewobj = new view_page();