diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index a8109226c4b..45106bfea41 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -140,7 +140,9 @@ $headtags = $attemptobj->get_html_head_contributions($page); $PAGE->set_title($attemptobj->attempt_page_title($page)); $PAGE->add_body_class('limitedwidth'); $PAGE->set_heading($attemptobj->get_course()->fullname); -$PAGE->activityheader->disable(); +if ($PAGE->pagelayout !== 'secure') { + $PAGE->activityheader->disable(); +} if ($attemptobj->is_last_page($page)) { $nextpage = -1; } else { diff --git a/mod/quiz/tests/behat/attempt_basic.feature b/mod/quiz/tests/behat/attempt_basic.feature index 466fa63cb2d..04ebd106617 100644 --- a/mod/quiz/tests/behat/attempt_basic.feature +++ b/mod/quiz/tests/behat/attempt_basic.feature @@ -234,25 +234,3 @@ Feature: Attempt a quiz And I press "Continue your attempt" Then I should see "First question" And I should not see "First question version 2" - - @javascript - Scenario: User image in the quiz navigation in normal mode. - Given I am on the "Quiz 1" "quiz activity editing" page logged in as "admin" - And I expand all fieldsets - And I set the field "Show the user's picture" to "Large image" - And I press "Save and return to course" - And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student" - And I press "Attempt quiz" - Then "Student One" "link" should exist in the "Quiz navigation" "block" - - @javascript - Scenario: User image in the quiz navigation in secure layout. - Given I am on the "Quiz 1" "quiz activity editing" page logged in as "admin" - And I expand all fieldsets - And I set the field "Show the user's picture" to "Large image" - And I set the field "Browser security" to "Full screen pop-up with some JavaScript security" - And I press "Save and return to course" - And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student" - And I press "Attempt quiz" - And I switch to a second window - Then "Student One" "link" should not exist in the "Quiz navigation" "block" diff --git a/mod/quiz/tests/behat/attempt_secure_layout.feature b/mod/quiz/tests/behat/attempt_secure_layout.feature new file mode 100644 index 00000000000..9f863a5cd2c --- /dev/null +++ b/mod/quiz/tests/behat/attempt_secure_layout.feature @@ -0,0 +1,44 @@ +@mod @mod_quiz +Feature: Attempt a quiz in secure layout + As a student + In order to demonstrate what I know + I need to be able to attempt quizzes in secure layout + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student | Student | One | student@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | student | C1 | student | + And the following "activities" exist: + | activity | name | intro | course | idnumber | grade | navmethod | browsersecurity | showuserpicture | + | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | 100 | free | securewindow | 2 | + And the following "question categories" exist: + | contextlevel | reference | name | + | Activity module | quiz1 | Test questions | + And the following "questions" exist: + | questioncategory | qtype | name | questiontext | + | Test questions | truefalse | TF1 | First question | + | Test questions | truefalse | TF2 | Second question | + And quiz "Quiz 1" contains the following questions: + | question | page | maxmark | + | TF1 | 1 | | + | TF2 | 1 | 3.0 | + + @javascript + Scenario: Large user image in the quiz navigation in secure layout + Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student" + And I press "Attempt quiz" + And I switch to a second window + Then "Student One" "link" should not exist in the "Quiz navigation" "block" + + Scenario: A quiz page on the secure layout shows both the course name and the quiz name + Given I am on the "Quiz 1" "mod_quiz > View" page logged in as "student" + When I press "Attempt quiz" + Then I should see "Course 1" + And I should see "Quiz 1" + And I should see "Quiz 1 description"