Skip to content

Commit

Permalink
MDL-46878 my: Behat tests to cover reset of all customised pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Sep 18, 2015
1 parent ad347f6 commit 0807070
Showing 1 changed file with 129 additions and 0 deletions.
129 changes: 129 additions & 0 deletions my/tests/behat/reset_all_pages.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
@core @core_my
Feature: Reset all personalised pages to default
In order to reset everyone's personalised pages
As an admin
I need to press a button on the pages to customise the default pages

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And I log in as "admin"
And I set the following system permissions of "Authenticated user" role:
| block/myprofile:addinstance | Allow |
| moodle/block:edit | Allow |
And I log out

And I log in as "student1"
And I follow "Dashboard" in the user menu
And I press "Customise this page"
And I add the "Comments" block
And I press "Stop customising this page"
And I should see "Comments"
And I log out

And I log in as "student2"
And I follow "Profile" in the user menu
And I should not see "Logged in user"
And I press "Customise this page"
And I add the "Logged in user" block
And I press "Stop customising this page"
And I should see "Logged in user"
And I log out

And I log in as "student3"
And I follow "Dashboard" in the user menu
And I should not see "Comments"
And I follow "Profile" in the user menu
And I should not see "Logged in user"
And I log out

Scenario: Reset Dashboard for all users
Given I log in as "admin"
And I navigate to "Default Dashboard page" node in "Site administration > Appearance"
And I press "Blocks editing on"
And I add the "Latest news" block
And I open the "Online users" blocks action menu
And I follow "Delete Online users"
And I press "Yes"
And I press "Blocks editing off"
And I log out

And I log in as "student1"
And I follow "Dashboard" in the user menu
And I should not see "Latest news"
And I should see "Online users"
And I log out

And I log in as "student3"
And I follow "Dashboard" in the user menu
And I should not see "Latest news"
And I should see "Online users"
And I log out

And I log in as "admin"
And I navigate to "Default Dashboard page" node in "Site administration > Appearance"
When I press "Reset Dashboard for all users"
And I follow "Continue"
And I log out

And I log in as "student1"
And I follow "Dashboard" in the user menu
Then I should see "Latest news"
And I should not see "Comments"
And I should not see "Online users"
And I log out

And I log in as "student3"
And I follow "Dashboard" in the user menu
And I should see "Latest news"
And I should not see "Online users"
And I log out

# Check that this did not affect the customised profiles.
And I log in as "student2"
And I follow "Profile" in the user menu
And I should see "Logged in user"
And I should not see "Latest news"

Scenario: Reset profile for all users
Given I log in as "admin"
And I navigate to "Default profile page" node in "Site administration > Appearance"
And I press "Blocks editing on"
And I add the "Latest news" block
And I log out

And I log in as "student2"
And I follow "Profile" in the user menu
And I should not see "Latest news"
And I log out

And I log in as "student3"
And I follow "Profile" in the user menu
And I should not see "Latest news"
And I log out

And I log in as "admin"
And I navigate to "Default profile page" node in "Site administration > Appearance"
When I press "Reset profile for all users"
And I follow "Continue"
And I log out

And I log in as "student2"
And I follow "Profile" in the user menu
Then I should see "Latest news"
And I should not see "Logged in user"
And I log out

And I log in as "student3"
And I follow "Profile" in the user menu
And I should see "Latest news"
And I log out

# Check that this did not affect the customised dashboards.
And I log in as "student1"
And I follow "Dashboard" in the user menu
And I should see "Comments"
And I should not see "Latest news"

0 comments on commit 0807070

Please sign in to comment.