mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-54579 Behat: tests for the private_files block
- Loading branch information
Showing
5 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
blocks/private_files/tests/behat/block_private_files_activity.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@block @block_private_files @file_upload @javascript | ||
Feature: The private files block allows users to store files privately in moodle | ||
In order to store a private file in moodle | ||
As a teacher | ||
I can upload the file to my private files area using the private files block in an activity | ||
|
||
Scenario: Upload a file to the private files block in an activity | ||
Given the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
And the following "activities" exist: | ||
| activity | course | idnumber | name | intro | | ||
| page | C1 | page1 | Test page name | Test page description | | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I follow "Test page name" | ||
And I add the "Private files" block | ||
And I should see "No files available" in the "Private files" "block" | ||
When I follow "Manage private files..." | ||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager | ||
And I press "Save changes" | ||
Then I should see "testfile.txt" in the "Private files" "block" |
25 changes: 25 additions & 0 deletions
25
blocks/private_files/tests/behat/block_private_files_course.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@block @block_private_files @file_upload @javascript | ||
Feature: The private files block allows users to store files privately in moodle | ||
In order to store a private file in moodle | ||
As a teacher | ||
I can upload the file to my private files area using the private files block in a course | ||
|
||
Scenario: Upload a file to the private files block from a course | ||
Given the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I add the "Private files" block | ||
And I should see "No files available" in the "Private files" "block" | ||
When I follow "Manage private files..." | ||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager | ||
And I press "Save changes" | ||
Then I should see "testfile.txt" in the "Private files" "block" |
17 changes: 17 additions & 0 deletions
17
blocks/private_files/tests/behat/block_private_files_dashboard.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@block @block_private_files @file_upload @javascript | ||
Feature: The private files block allows users to store files privately in moodle | ||
In order to store a private file in moodle | ||
As a user | ||
I can upload the file to my private files area using the private files block on the dashboard | ||
|
||
Scenario: Upload a file to the private files block from the dashboard | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And I log in as "teacher1" | ||
And "Private files" "block" should exist | ||
And I should see "No files available" in the "Private files" "block" | ||
When I follow "Manage private files..." | ||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager | ||
And I press "Save changes" | ||
Then I should see "testfile.txt" in the "Private files" "block" |
34 changes: 34 additions & 0 deletions
34
blocks/private_files/tests/behat/block_private_files_frontpage.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@block @block_private_files @file_upload | ||
Feature: The private files block allows users to store files privately in moodle | ||
In order to store a private file in moodle | ||
As a teacher | ||
I can upload the file to my private files area using the private files block from the front page | ||
|
||
Background: | ||
Given the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
And I log in as "admin" | ||
And I am on site homepage | ||
And I navigate to "Turn editing on" node in "Front page settings" | ||
And I add the "Private files" block | ||
And I log out | ||
|
||
Scenario: Try to view the private files block as a guest | ||
Given I log in as "guest" | ||
When I am on site homepage | ||
Then "Private files" "block" should not exist | ||
|
||
@javascript | ||
Scenario: Upload a file to the private files block from the frontpage | ||
Given I log in as "teacher1" | ||
And I am on site homepage | ||
And "Private files" "block" should exist | ||
And I should see "No files available" in the "Private files" "block" | ||
When I follow "Manage private files..." | ||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager | ||
And I press "Save changes" | ||
Then I should see "testfile.txt" in the "Private files" "block" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a test file |