Skip to content

Commit

Permalink
MDl-43681 report_log: Added Behat test for report log
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Mar 24, 2014
1 parent ac8976c commit 9c5d3f9
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
60 changes: 60 additions & 0 deletions report/log/tests/behat/filter_log.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@report @report_log
Feature: In a report, admin can filter log data
In order to filter log data
As an admin
I need to log in with different user and go to log and apply filter

Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
And the following "course enrolments" exist:
| user | course | role |
| admin | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"

@javascript
Scenario: Filter log report for standard log reader
Given I navigate to "Manage log stores" node in "Site administration > Plugins > Logging"
And I click on "Enable" "link" in the "Standard log" "table_row"
And I follow "Home"
And I follow "Course 1"
And I navigate to "Participants" node in "Current course > C1"
And I follow "Student 1"
And I click on "Log in as" "link"
And I press "Continue"
And I log out
And I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "id" to "Site logs"
And I set the field "user" to "All participants"
And I set the field "logreader" to "Standard log"
And I press "Get these logs"
Then I should see "User logged in as another user"
And I set the field "logreader" to "Legacy log"
And I press "Get these logs"
And I should see "user login"
And I should not see "Nothing to display"

@javascript
Scenario: Filter log report for legacy log reader.
Given I set the following administration settings values:
| Log legacy data | 0 |
And I follow "Home"
And I follow "Course 1"
And I expand "Users" node
And I follow "Enrolled users"
And I follow "Student 1"
And I click on "Log in as" "link"
And I press "Continue"
And I log out
And I log in as "admin"
When I navigate to "Logs" node in "Site administration > Reports"
And I set the field "id" to "Site logs"
And I set the field "user" to "All participants"
And I press "Get these logs"
Then I should see "user login"
50 changes: 50 additions & 0 deletions report/log/tests/behat/user_log.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@report @report_log
Feature: User can view activity log.
In order to view user log
As an teacher
I need to view user today's and all report

Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And I set the following administration settings values:
| Log legacy data | 1 |
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I log out
And I log in as "teacher1"

@javascript
Scenario: View Todays' and all log report for user
Given I follow "Course 1"
And I navigate to "Participants" node in "Current course > C1"
And I follow "Student 1"
When I navigate to "Today's logs" node in "Profile settings for Student 1 > Activity reports"
And I should see "Assignment: Test assignment name"
And I navigate to "All logs" node in "Profile settings for Student 1 > Activity reports"
And I should see "Assignment: Test assignment name"

0 comments on commit 9c5d3f9

Please sign in to comment.