From 6ad9dcae1c9cd767ba69ca821247f0c016459e41 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 27 Sep 2022 09:59:14 +0800 Subject: [PATCH] MDL-75830 behat: Book behat tests optimised Replace steps that manually add Book instances via the UI and use Behat generators. This improves the speed of the Behat test runs. Additionally, performed Behat cleanup and optimisation to affected files. --- blocks/tests/behat/manage_blocks.feature | 17 ++--- blocks/tests/behat/move_blocks.feature | 16 ++--- .../tests/behat/edit_delete_sections.feature | 2 +- .../tests/behat/edit_delete_sections.feature | 2 +- .../behat/book_activity_completion.feature | 3 - mod/book/tests/behat/create_chapters.feature | 22 +++---- .../behat/display_book_description.feature | 27 +++----- .../behat/edit_navigation_options.feature | 14 ++-- mod/book/tests/behat/edit_tags.feature | 2 - mod/book/tests/behat/log_entries.feature | 2 +- .../tests/behat/reorganize_chapters.feature | 39 +++-------- .../tests/behat/show_hide_chapters.feature | 38 +++-------- report/outline/tests/behat/filter.feature | 29 +++------ report/outline/tests/behat/outline.feature | 65 +++++-------------- .../tests/behat/filter_participation.feature | 22 ++----- .../tests/behat/message_participants.feature | 11 +--- 16 files changed, 91 insertions(+), 220 deletions(-) diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index e2a4c4e2c5d..9361fa4d64f 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -15,16 +15,13 @@ Feature: Block appearances | user | course | role | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | description | course | idnumber | section | template | - | survey | Test survey name | | C1 | survey1 | 1 | 4 | - | book | Test book name | Test book description | C1 | book1 | 1 | | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I follow "Test book name" - And I set the following fields to these values: - | Chapter title | Book title | - | Content | Book content test test | - And I press "Save changes" + | activity | name | course | idnumber | section | template | + | survey | Test survey name | C1 | survey1 | 1 | 4 | + | book | Test book name | C1 | book1 | 1 | | + And the following "mod_book > chapter" exists: + | book | Test book name | + | title | Book title | + | content | Book content test test | And I am on the "Course 1" course page logged in as teacher1 And I turn editing mode on And I add the "Comments" block diff --git a/blocks/tests/behat/move_blocks.feature b/blocks/tests/behat/move_blocks.feature index 21ee66f3244..8b7033b1e58 100644 --- a/blocks/tests/behat/move_blocks.feature +++ b/blocks/tests/behat/move_blocks.feature @@ -17,17 +17,11 @@ Feature: Block region moving And the following "activities" exist: | activity | name | course | template | | survey | Test survey name | C1 | 4 | - And I log in as "admin" - And I am on "Course 1" course homepage with editing mode on - And I add a "Book" to section "1" and I fill the form with: - | Name | Test book name | - | Description | Test book description | - And I follow "Test book name" - And I set the following fields to these values: - | Chapter title | Book title | - | Content | Book content test test | - And I press "Save changes" - And I log out + | book | Test book name | C1 | | + And the following "mod_book > chapter" exists: + | book | Test book name | + | title | Book title | + | content | Book content test test | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I add the "Comments" block diff --git a/course/format/topics/tests/behat/edit_delete_sections.feature b/course/format/topics/tests/behat/edit_delete_sections.feature index 573c7e50fcd..605fd177f4d 100644 --- a/course/format/topics/tests/behat/edit_delete_sections.feature +++ b/course/format/topics/tests/behat/edit_delete_sections.feature @@ -14,7 +14,7 @@ Feature: Sections can be edited and deleted in topics format And the following "activities" exist: | activity | name | intro | course | idnumber | section | | assign | Test assignment name | Test assignment description | C1 | assign1 | 0 | - | book | Test book name | Test book description | C1 | book1 | 1 | + | book | Test book name | | C1 | book1 | 1 | | chat | Test chat name | Test chat description | C1 | chat1 | 4 | | choice | Test choice name | Test choice description | C1 | choice1 | 5 | And the following "course enrolments" exist: diff --git a/course/format/weeks/tests/behat/edit_delete_sections.feature b/course/format/weeks/tests/behat/edit_delete_sections.feature index 6fdc14aef26..b2e328ab881 100644 --- a/course/format/weeks/tests/behat/edit_delete_sections.feature +++ b/course/format/weeks/tests/behat/edit_delete_sections.feature @@ -14,7 +14,7 @@ Feature: Sections can be edited and deleted in weeks format And the following "activities" exist: | activity | name | intro | course | idnumber | section | | assign | Test assignment name | Test assignment description | C1 | assign1 | 0 | - | book | Test book name | Test book description | C1 | book1 | 1 | + | book | Test book name | | C1 | book1 | 1 | | chat | Test chat name | Test chat description | C1 | chat1 | 4 | | choice | Test choice name | Test choice description | C1 | choice1 | 5 | And the following "course enrolments" exist: diff --git a/mod/book/tests/behat/book_activity_completion.feature b/mod/book/tests/behat/book_activity_completion.feature index 1f5534a7f8d..8722ab480cd 100644 --- a/mod/book/tests/behat/book_activity_completion.feature +++ b/mod/book/tests/behat/book_activity_completion.feature @@ -21,7 +21,6 @@ Feature: View activity completion information in the book activity | course | C1 | | idnumber | mh1 | | name | Music history | - | section | 1 | | completion | 2 | | completionview | 1 | @@ -32,7 +31,6 @@ Feature: View activity completion information in the book activity | content | Rudiments are important | And I am on the "Music history" "book activity" page logged in as teacher1 And "Music history" should have the "View" completion condition - And I log out # Student view. When I am on the "Music history" "book activity" page logged in as student1 Then the "View" completion condition of "Music history" is displayed as "done" @@ -50,7 +48,6 @@ Feature: View activity completion information in the book activity And I am on the "Music history" "book activity" page # Teacher view. And the manual completion button for "Music history" should be disabled - And I log out # Student view. Given I am on the "Music history" "book activity" page logged in as student1 Then the manual completion button of "Music history" is displayed as "Mark as done" diff --git a/mod/book/tests/behat/create_chapters.feature b/mod/book/tests/behat/create_chapters.feature index 970ce181ef4..c709ae302a0 100644 --- a/mod/book/tests/behat/create_chapters.feature +++ b/mod/book/tests/behat/create_chapters.feature @@ -15,18 +15,17 @@ Feature: In a book, create chapters and sub chapters | user | course | role | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | book | Test book | A book about dreams! | C1 | book1 | 1 | + | activity | name | course | idnumber | section | + | book | Test book | C1 | book1 | 1 | + And the following "mod_book > chapter" exists: + | book | Test book | + | title | Dummy first chapter | + | content | Dream is the start of a journey | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on Scenario: Create chapters and sub chapters and navigate between them - Given I follow "Test book" - And I should see "Add new chapter" - And I set the following fields to these values: - | Chapter title | Dummy first chapter | - | Content | Dream is the start of a journey | - And I press "Save changes" + Given I am on the "Test book" "book activity" page And I should see "1. Dummy first chapter" in the "Table of contents" "block" And I click on "Add new chapter after \"Dummy first chapter\"" "link" in the "Table of contents" "block" And I should see "Dummy first chapter" @@ -62,12 +61,7 @@ Feature: In a book, create chapters and sub chapters And I should see "1. Dummy first chapter" in the "strong" "css_element" Scenario: Change editing mode for an individual chapter - Given I follow "Test book" - And I should see "Add new chapter" - And I set the following fields to these values: - | Chapter title | Dummy first chapter | - | Content | Dream is the start of a journey | - And I press "Save changes" + Given I am on the "Test book" "book activity" page And I should see "1. Dummy first chapter" in the "Table of contents" "block" And "Edit chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block" And "Delete chapter \"1. Dummy first chapter\"" "link" should exist in the "Table of contents" "block" diff --git a/mod/book/tests/behat/display_book_description.feature b/mod/book/tests/behat/display_book_description.feature index de4307e8b33..f7e43ebb6fd 100644 --- a/mod/book/tests/behat/display_book_description.feature +++ b/mod/book/tests/behat/display_book_description.feature @@ -15,26 +15,19 @@ Feature: Display the book description in the book and optionally in the course | user | course | role | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | book | Test book | A book about dreams! | C1 | book1 | 1 | - And I log in as "teacher1" - And I am on "Course 1" course homepage - And I follow "Test book" - And I should see "Add new chapter" - And I set the following fields to these values: - | Chapter title | Dummy first chapter | - | Content | Dream is the start of a journey | - And I press "Save changes" + | activity | name | intro | course | idnumber | + | book | Test book | A book about dreams! | C1 | book1 | + And the following "mod_book > chapter" exists: + | book | Test book | + | title | Dummy first chapter | + | content | Dream is the start of a journey | Scenario: Description is displayed in the book - Given I am on "Course 1" course homepage - When I follow "Test book" + When I am on the "Test book" "book activity" page logged in as teacher1 Then I should see "A book about dreams!" Scenario: Show book description in the course homepage - Given I am on "Course 1" course homepage - And I follow "Test book" - And I navigate to "Edit settings" in current page administration + Given I am on the "Test book" "book activity editing" page logged in as teacher1 And the following fields match these values: | Display description on course page | | And I set the following fields to these values: @@ -44,9 +37,7 @@ Feature: Display the book description in the book and optionally in the course Then I should see "A book about dreams!" Scenario: Hide book description in the course homepage - Given I am on "Course 1" course homepage - And I follow "Test book" - And I navigate to "Edit settings" in current page administration + Given I am on the "Test book" "book activity editing" page logged in as teacher1 And the following fields match these values: | Display description on course page | | And I press "Save and return to course" diff --git a/mod/book/tests/behat/edit_navigation_options.feature b/mod/book/tests/behat/edit_navigation_options.feature index 10a45af2127..bc58f3cb434 100644 --- a/mod/book/tests/behat/edit_navigation_options.feature +++ b/mod/book/tests/behat/edit_navigation_options.feature @@ -18,16 +18,14 @@ Feature: In a book, change the navigation options Scenario: Change navigation options Given the following "activities" exist: - | activity | name | intro | course | idnumber | section | navstyle | - | book | Test book | A book about lorem ipsum | C1 | book1 | 1 | 0 | + | activity | name | course | idnumber | navstyle | + | book | Test book | C1 | book1 | 0 | + And the following "mod_book > chapter" exists: + | book | Test book | + | title | Test chapter 1 | + | content | Lorem ipsum dolor sit amet | And I am on "Course 1" course homepage with editing mode on And I follow "Test book" - And I should see "Add new chapter" - And I set the following fields to these values: - | Chapter title | Test chapter 1 | - | Content | Lorem ipsum dolor sit amet | - And I press "Save changes" - And I should see "Test book" And I should see "1. Test chapter 1" And I click on "Add new chapter" "link" in the "Table of contents" "block" And I set the following fields to these values: diff --git a/mod/book/tests/behat/edit_tags.feature b/mod/book/tests/behat/edit_tags.feature index d1b3cc2fa57..2e3658e282f 100644 --- a/mod/book/tests/behat/edit_tags.feature +++ b/mod/book/tests/behat/edit_tags.feature @@ -17,7 +17,6 @@ Feature: Edited book chapters handle tags correctly | course | C1 | | idnumber | book1 | | name | Test book | - | description | A book about dreams | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | @@ -47,7 +46,6 @@ Feature: Edited book chapters handle tags correctly And I follow "Add standard tags" And I set the field "Enter comma-separated list of new tags" to "OT1, OT2, OT3" And I press "Continue" - And I log out And I am on the "Test book" "book activity" page logged in as teacher1 And I open the autocomplete suggestions list And I should see "OT1" in the ".form-autocomplete-suggestions" "css_element" diff --git a/mod/book/tests/behat/log_entries.feature b/mod/book/tests/behat/log_entries.feature index 2ad4a8a06cf..79366ba6820 100644 --- a/mod/book/tests/behat/log_entries.feature +++ b/mod/book/tests/behat/log_entries.feature @@ -13,7 +13,7 @@ Feature: In a book, verify log entries | course | C1 | | activity | book | | name | Test book | - And I am on the "Course 1" course page logged in as admin + And I log in as "admin" And I am on "Course 1" course homepage with editing mode on And I am on the "Test book" "book activity" page And I set the following fields to these values: diff --git a/mod/book/tests/behat/reorganize_chapters.feature b/mod/book/tests/behat/reorganize_chapters.feature index be0c0883248..2383b4b1dd8 100644 --- a/mod/book/tests/behat/reorganize_chapters.feature +++ b/mod/book/tests/behat/reorganize_chapters.feature @@ -15,39 +15,18 @@ Feature: In a book, chapters and subchapters can be rearranged | user | course | role | | teacher1 | C1 | editingteacher | And the following "activities" exist: - | activity | name | intro | course | idnumber | section | - | book | Test book | A book about rearrangements! | C1 | book1 | 1 | + | activity | name | course | idnumber | + | book | Test book | C1 | book1 | + And the following "mod_book > chapters" exist: + | book | title | content | pagenum |subchapter | + | Test book | Originally first chapter | #1 chapter content | 1 | 0 | + | Test book | A great second chapter | #2 chapter content | 2 | 0 | + | Test book | Second chapter, subchapter 1 | #21 subchapter content | 3 | 1 | + | Test book | Second chapter, subchapter 2 | #22 subchapter content | 4 | 1 | + | Test book | There aren't 2 without 3 | #3 subchapter content | 5 | 0 | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I follow "Test book" - And I should see "Add new chapter" - And I set the following fields to these values: - | Chapter title | Originally first chapter | - | Content | #1 chapter content | - And I press "Save changes" - And I click on "Add new chapter after \"Originally first chapter\"" "link" - And I set the following fields to these values: - | Chapter title | A great second chapter | - | Content | #2 chapter content | - And I press "Save changes" - And I click on "Add new chapter after \"A great second chapter\"" "link" - And I set the following fields to these values: - | Chapter title | Second chapter, subchapter 1 | - | Content | #21 subchapter content | - | Subchapter | 1 | - And I press "Save changes" - And I click on "Add new chapter after \"Second chapter, subchapter 1\"" "link" - And I set the following fields to these values: - | Chapter title | Second chapter, subchapter 2 | - | Content | #22 subchapter content | - | Subchapter | 1 | - And I press "Save changes" - And I click on "Add new chapter after \"Second chapter, subchapter 2\"" "link" - And I set the following fields to these values: - | Chapter title | There aren't 2 without 3 | - | Content | #3 subchapter content | - | Subchapter | 0 | - And I press "Save changes" Scenario: Moving chapters down rearranges them properly Given I click on "Move chapter down \"1. Originally first chapter\"" "link" diff --git a/mod/book/tests/behat/show_hide_chapters.feature b/mod/book/tests/behat/show_hide_chapters.feature index ed5e5ec0db4..498ee046688 100644 --- a/mod/book/tests/behat/show_hide_chapters.feature +++ b/mod/book/tests/behat/show_hide_chapters.feature @@ -20,34 +20,17 @@ Feature: Book activity chapter visibility management | course | C1 | | activity | book | | name | Test book | - And I am on the "Test book" "book activity" page logged in as teacher1 - And I set the following fields to these values: - | Chapter title | First chapter | - | Content | First chapter | - And I press "Save changes" + And the following "mod_book > chapters" exist: + | book | title | content | pagenum |subchapter | + | Test book | First chapter | First chapter | 1 | 0 | + | Test book | Second chapter | Second chapter | 2 | 0 | + | Test book | Sub chapter | Sub chapter | 3 | 1 | + | Test book | Third chapter | Third chapter | 4 | 0 | + | Test book | Fourth chapter | Fourth chapter | 5 | 0 | + And I am on the "Course 1" course page logged in as teacher1 And I turn editing mode on - And I click on "Add new chapter after \"First chapter\"" "link" - And I set the following fields to these values: - | Chapter title | Second chapter | - | Content | Second chapter | - And I press "Save changes" - And I click on "Add new chapter after \"Second chapter\"" "link" - And I set the following fields to these values: - | Chapter title | Sub chapter | - | subchapter | 1 | - | Content | Sub chapter | - And I press "Save changes" - And I click on "Add new chapter after \"Sub chapter\"" "link" - And I set the following fields to these values: - | Chapter title | Third chapter | - | subchapter | 0 | - | Content | Third chapter | - And I press "Save changes" - And I click on "Add new chapter after \"Third chapter\"" "link" - And I set the following fields to these values: - | Chapter title | Fourth chapter | - | Content | Fourth chapter | - And I press "Save changes" + And I am on the "Test book" "book activity" page + And I click on "4. Fourth chapter" "link" in the "Table of contents" "block" @javascript Scenario: Show/hide chapters and subchapters @@ -68,7 +51,6 @@ Feature: Book activity chapter visibility management And I follow "Next" And I should see "Fourth chapter" in the ".book_content" "css_element" And I follow "Exit book" - And I log out And I am on the "Test book" "book activity" page logged in as student1 And I should not see "Second chapter" in the "Table of contents" "block" And I should not see "Third chapter" in the "Table of contents" "block" diff --git a/report/outline/tests/behat/filter.feature b/report/outline/tests/behat/filter.feature index bc6d355b91c..ed48dde4d44 100644 --- a/report/outline/tests/behat/filter.feature +++ b/report/outline/tests/behat/filter.feature @@ -21,30 +21,23 @@ Feature: Filter an outline report And the following "activities" exist: | activity | name | description | course | idnumber | section | | forum | Forum name | Forum description | C1 | FORUM01 | 1 | - | book | Book name | Book description | C1 | BOOK01 | 1 | - When I log in as "admin" - And I am on "Course 1" course homepage + | book | Book name | | C1 | BOOK01 | 1 | + When I am on the "Course 1" course page logged in as admin Scenario: Filter the outline report by start date Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And the log timestamp for "student1" and "FORUM01" is set to "12 June 2017 12:49:00" And I am on "Course 1" course homepage And I follow "Book name" And the log timestamp for "student1" and "BOOK01" is set to "10 June 2017 14:01:00" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Book name" And the log timestamp for "student2" and "BOOK01" is set to "14 June 2017 11:02:00" - And I log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as admin And I navigate to "Reports > Activity report" in current page administration And I should see "2 views by 2 users" in the "Book name" "table_row" And I should see "1 views by 1 users" in the "Forum name" "table_row" @@ -61,22 +54,16 @@ Feature: Filter an outline report Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And the log timestamp for "student1" and "FORUM01" is set to "12 June 2017 12:49:00" And I am on "Course 1" course homepage And I follow "Book name" And the log timestamp for "student1" and "BOOK01" is set to "10 June 2017 14:01:00" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Book name" And the log timestamp for "student2" and "BOOK01" is set to "14 June 2017 11:02:00" - And I log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as admin And I navigate to "Reports > Activity report" in current page administration And I should see "2 views by 2 users" in the "Book name" "table_row" And I should see "1 views by 1 users" in the "Forum name" "table_row" diff --git a/report/outline/tests/behat/outline.feature b/report/outline/tests/behat/outline.feature index 9d47dc58e43..e0809c6505b 100644 --- a/report/outline/tests/behat/outline.feature +++ b/report/outline/tests/behat/outline.feature @@ -21,9 +21,8 @@ Feature: View an outline report And the following "activities" exist: | activity | name | intro | course | idnumber | | forum | Forum name | Forum description | C1 | forum1 | - | book | Book name | Book description | C1 | book1 | - When I log in as "admin" - And I am on "Course 1" course homepage + | book | Book name | | C1 | book1 | + When I am on the "Course 1" course page logged in as admin Scenario: View the outline report when only the legacy log reader is enabled Given I navigate to "Plugins > Logging > Manage log stores" in site administration @@ -31,19 +30,13 @@ Feature: View an outline report And I click on "Disable" "link" in the "Standard log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Book name" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Book name" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 When I navigate to "Reports > Activity report" in current page administration Then I should see "2 views by 2 users" in the "Book name" "table_row" And I should see "1 views by 1 users" in the "Forum name" "table_row" @@ -52,19 +45,13 @@ Feature: View an outline report Given I navigate to "Plugins > Logging > Manage log stores" in site administration And "Enable" "link" should exist in the "Legacy log" "table_row" And "Disable" "link" should exist in the "Standard log" "table_row" - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Book name" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Book name" - And I log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as admin When I navigate to "Reports > Activity report" in current page administration Then I should see "2 views by 2 users" in the "Book name" "table_row" And I should see "1 views by 1 users" in the "Forum name" "table_row" @@ -75,19 +62,13 @@ Feature: View an outline report And "Disable" "link" should exist in the "Standard log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I log out - And I log in as "student1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Book name" - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Book name" - And I log out - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 When I navigate to "Reports > Activity report" in current page administration Then I should see "2 views by 2 users" in the "Book name" "table_row" And I should see "1 views by 1 users" in the "Forum name" "table_row" @@ -101,52 +82,40 @@ Feature: View an outline report Then I should see "No log reader enabled" Scenario: Multiple views from a single user are identified as not distinct - Given I log out - And I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on site homepage - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity report" in current page administration Then I should see "3 views by 1 users" in the "Forum name" "table_row" And I should see "-" in the "Book name" "table_row" Scenario: Multiple views from multiple users are identified as not distinct - Given I log out - And I log in as "student1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as student1 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on site homepage - And I log out - And I log in as "student2" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as student2 And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on "Course 1" course homepage And I follow "Forum name" And I am on site homepage - And I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity report" in current page administration Then I should see "6 views by 2 users" in the "Forum name" "table_row" And I should see "-" in the "Book name" "table_row" Scenario: No views from any users - Given I log out - When I log in as "teacher1" - And I am on "Course 1" course homepage + When I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Activity report" in current page administration Then I should see "-" in the "Forum name" "table_row" And I should see "-" in the "Book name" "table_row" diff --git a/report/participation/tests/behat/filter_participation.feature b/report/participation/tests/behat/filter_participation.feature index dbabdf9c03b..5b6060e78da 100644 --- a/report/participation/tests/behat/filter_participation.feature +++ b/report/participation/tests/behat/filter_participation.feature @@ -20,13 +20,12 @@ Feature: In a participation report, admin can filter student actions | course | C1 | | activity | book | | name | Test book name | - | description | Test book | | idnumber | book1 | + And the following "mod_book > chapter" exists: + | book | Test book name | + | title | Test chapter | + | content | Test chapter content | And I am on the "Test book name" "book activity" page logged in as teacher1 - And I set the following fields to these values: - | Chapter title | Test chapter | - | Content | Test chapter content | - And I log out @javascript Scenario: Filter participation report when only legacy log reader is enabled @@ -36,10 +35,8 @@ Feature: In a participation report, admin can filter student actions And I click on "Enable" "link" in the "Legacy log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I log out And I am on the "Test book name" "book activity" page logged in as student1 - And I log out When I am on the "Course 1" course page logged in as admin When I navigate to "Reports > Course participation" in current page administration @@ -56,21 +53,16 @@ Feature: In a participation report, admin can filter student actions And I click on "Enable" "link" in the "Legacy log" "table_row" And the following config values are set as admin: | loglegacy | 1 | logstore_legacy | - And I log out And I am on the "Test book name" "book 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 log out And I am on the "Test book name" "book activity" page logged in as student1 - And I log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as admin When I navigate to "Reports > Course participation" in current page administration And I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student" @@ -80,10 +72,8 @@ Feature: In a participation report, admin can filter student actions @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 log out - And I log in as "admin" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as admin When I navigate to "Reports > Course participation" in current page administration And I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student" diff --git a/report/participation/tests/behat/message_participants.feature b/report/participation/tests/behat/message_participants.feature index 4b376aa4848..21172307695 100644 --- a/report/participation/tests/behat/message_participants.feature +++ b/report/participation/tests/behat/message_participants.feature @@ -25,14 +25,11 @@ Feature: Use the particiaption report to message groups of students | activity | book | | name | Test book name | | idnumber | Test book name | - | description | Test book | | idnumber | book1 | And I am on the "Test book name" "book activity" page logged in as student1 - And I log out Scenario: Message all students from the participation report - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Course participation" in current page administration And I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student" @@ -45,8 +42,7 @@ Feature: Use the particiaption report to message groups of students And I should see "Message sent to 3 people" Scenario: Message students who have not participated in book - Given I log in as "teacher1" - And I am on "Course 1" course homepage + Given I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Course participation" in current page administration And I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student" @@ -64,8 +60,7 @@ Feature: Use the particiaption report to message groups of students Scenario: Ensure no message options when messaging is disabled Given the following config values are set as admin: | messaging | 0 | - And I log in as "teacher1" - And I am on "Course 1" course homepage + And I am on the "Course 1" course page logged in as teacher1 And I navigate to "Reports > Course participation" in current page administration When I set the field "instanceid" to "Test book name" And I set the field "roleid" to "Student"