From 310b9324827a7b5c3882dc514fbf87af5ca7859e Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 26 Apr 2024 15:08:33 +0100 Subject: [PATCH] MDL-79149 report_participation: more resilient activity access test. Use the "Forum" module rather than the "Book" module, because the latter emits two events when a student views it - if these two events happened either side of a single second, then the report would count two distinct views (when it was trying to assert only one). --- .../tests/behat/filter_participation.feature | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/report/participation/tests/behat/filter_participation.feature b/report/participation/tests/behat/filter_participation.feature index 058ba0e3a3c..c648a85978f 100644 --- a/report/participation/tests/behat/filter_participation.feature +++ b/report/participation/tests/behat/filter_participation.feature @@ -20,13 +20,9 @@ Feature: In a participation report, admin can filter student actions | student1 | C1 | student | And the following "activity" exists: | course | C1 | - | activity | book | - | name | Test book name | - | idnumber | book1 | - And the following "mod_book > chapter" exists: - | book | Test book name | - | title | Test chapter | - | content | Test chapter content | + | activity | forum | + | name | Test forum name | + | idnumber | forum1 | @javascript Scenario: Filter participation report when standard log reader is enabled later @@ -35,34 +31,39 @@ Feature: In a participation report, admin can filter student actions And I click on "Disable" "link" in the "Standard log" "table_row" And I log out - And I am on the "Test book name" "book activity" page logged in as student1 + And I am on the "Test forum name" "forum activity" page logged in as student1 And I log out And I log in as "admin" And I navigate to "Plugins > Logging > Manage log stores" in site administration And I click on "Enable" "link" in the "Standard log" "table_row" - And I am on the "Test book name" "book activity" page logged in as student1 + And I am on the "Test forum name" "forum activity" page logged in as student1 And I am on the "Course 1" course page logged in as admin When I navigate to "Reports" in current page administration And I click on "Course participation" "link" - And I set the field "instanceid" to "Test book name" - And I set the field "roleid" to "Student" + And I set the following fields to these values: + | Activity module | Test forum name | + | Show only | Student | And I press "Go" - Then I should see "Yes (1)" + Then the following should exist in the "reporttable" table: + | -1- | All actions | + | Student 1 | Yes (1) | @javascript Scenario: Filter participation report when only standard log reader is enabled by default - Given I am on the "Test book name" "book activity" page logged in as student1 - - And I am on the "Course 1" course page logged in as admin + Given I am on the "Test forum name" "forum activity" page logged in as student1 + When I am on the "Course 1" course page logged in as admin And I navigate to "Reports" in current page administration And I click on "Course participation" "link" - And I set the field "instanceid" to "Test book name" - And I set the field "roleid" to "Student" + And I set the following fields to these values: + | Activity module | Test forum name | + | Show only | Student | And I press "Go" - Then I should see "Yes (1)" + Then the following should exist in the "reporttable" table: + | -1- | All actions | + | Student 1 | Yes (1) | @javascript Scenario Outline: Filter participation report by viewable roles @@ -72,8 +73,8 @@ Feature: In a participation report, admin can filter student actions # Teacher role cannot see Manager by default. Then "Manager" "option" should not exist in the "Show only" "select" And I set the following fields to these values: - | Activity module | Test book name | - | Show only | | + | Activity module | Test forum name | + | Show only | | And I press "Go" And I should see "" in the "reporttable" "table" And I should not see "" in the "reporttable" "table"