Skip to content

Commit

Permalink
MDL-72092 behat: Add private files block where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed Mar 1, 2022
1 parent f456c34 commit b0532ae
Show file tree
Hide file tree
Showing 31 changed files with 113 additions and 20 deletions.
3 changes: 3 additions & 0 deletions blocks/badges/tests/behat/block_badges_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Feature: Enable Block Badges on the dashboard and view awarded badges
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| badges | System | 1 | my-index | side-post |
And I log in as "teacher1"
And I am on "Course 1" course homepage
# Issue badge 1 of 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Feature: H5P file upload to content bank for admins
I need to be able to upload a new .h5p file to content bank

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Feature: H5P file upload to content bank for non admins
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "teacher1"
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
Expand Down
5 changes: 4 additions & 1 deletion contentbank/tests/behat/delete_content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Feature: Delete H5P file from the content bank
I need to be able to delete any H5P content from the content bank

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
And I click on "Save changes" "button"
Expand Down
5 changes: 4 additions & 1 deletion contentbank/tests/behat/edit_content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Feature: Content bank use editor feature
I need to be able to access the edition options

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I am on site homepage
And I turn editing mode on
And the following config values are set as admin:
Expand Down
5 changes: 4 additions & 1 deletion contentbank/tests/behat/events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Feature: Confirm content bank events are triggered
I need to be able to check triggered events

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I navigate to "H5P > Manage H5P content types" in site administration
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "H5P content type" filemanager
And I click on "Upload H5P content types" "button" in the "#fitem_id_uploadlibraries" "css_element"
Expand Down
5 changes: 4 additions & 1 deletion contentbank/tests/behat/view_preferences.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Feature: Store the content bank view preference
I need to be able to store my view preference

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files..."
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
And I upload "h5p/tests/fixtures/greeting-card-887.h5p" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions customfield/field/textarea/tests/behat/default_value.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Feature: Default value for the textarea custom field can contain images
And the following "custom field categories" exist:
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
# Upload an image into the private files.
And I log in as "admin"
And I follow "Manage private files"
Expand Down
3 changes: 3 additions & 0 deletions customfield/tests/behat/edit_fields_settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Feature: Teachers can edit course custom fields
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

Scenario: Display custom fields on course edit form
When I log in as "teacher1"
Expand Down
5 changes: 5 additions & 0 deletions files/tests/behat/license_help_modal.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Feature: View licence links
As a user
I need to be able to navigate to a page containing licence terms from the file manager

Background:
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript
Scenario: Uploading a file displays licence list modal
Given I log in as "admin"
Expand Down
3 changes: 3 additions & 0 deletions filter/displayh5p/tests/behat/h5p_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Feature: Render H5P content using filters
| activity | name | intro | introformat | course | content | contentformat | idnumber |
| page | PageName1 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
| page | PageName2 | PageDesc1 | 1 | C1 | H5Ptest | 1 | 1 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And the "displayh5p" filter is "on"
And the following config values are set as admin:
| allowedsources | https://moodle.h5p.com/content/[id]/embed | filter_displayh5p |
Expand Down
3 changes: 3 additions & 0 deletions filter/displayh5p/tests/behat/inline_editing_content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Feature: Inline editing H5P content anywhere
| capability | permission | role | contextlevel | reference |
| moodle/course:update | Allow | teacher | System | |
| moodle/course:update | Allow | student | System | |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript @mod @mod_page
Scenario: Edit H5P content from a page using link to private file
Expand Down
3 changes: 3 additions & 0 deletions lib/editor/atto/plugins/h5p/tests/behat/h5p.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Feature: Add h5ps to Atto
And the "displayh5p" filter is "on"
And the following config values are set as admin:
| allowedsources | https://moodle.h5p.com/content/[id] | filter_displayh5p |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript @external
Scenario: Insert an embedded h5p
Expand Down
5 changes: 4 additions & 1 deletion lib/editor/atto/plugins/image/tests/behat/image.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Feature: Add images to Atto

@javascript
Scenario: Insert an image
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "Save changes" "button"
Expand Down
5 changes: 4 additions & 1 deletion lib/editor/atto/plugins/link/tests/behat/link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Feature: Add links to Atto

@javascript
Scenario: Insert a links
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
And I click on "Save changes" "button"
Expand Down
5 changes: 4 additions & 1 deletion lib/editor/atto/plugins/media/tests/behat/media.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ Feature: Add media to Atto
To write rich text - I need to add media.

Background:
Given I log in as "admin"
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I change window size to "large"
And I follow "Manage private files..."
And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions lib/editor/atto/tests/behat/autosave.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Feature: Atto Autosave
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I navigate to "Plugins > Text editors > Atto HTML editor > Atto toolbar settings" in site administration
And I set the field "Autosave frequency" to "3"
Expand Down
3 changes: 3 additions & 0 deletions mod/h5pactivity/tests/behat/contentbank_link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Feature: Content bank link in the activity settings form
And the following "contentbank content" exist:
| contextlevel | reference | contenttype | user | contentname | filepath |
| Course | C1 | contenttype_h5p | admin | filltheblanks.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript
Scenario: The content bank link should go to the course Content bank
Expand Down
3 changes: 3 additions & 0 deletions mod/h5pactivity/tests/behat/inline_editing_content.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Feature: Inline editing H5P content
And the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/h5p:updatelibraries | Allow | editingteacher | System | |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript
Scenario: Add H5P activity using link to content bank file
Expand Down
3 changes: 3 additions & 0 deletions mod/lesson/tests/behat/duplicate_lesson_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Feature: In a lesson activity, a teacher can duplicate a lesson page
| course | C1 |
| activity | lesson |
| name | Test lesson name |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "teacher1"
And I follow "Manage private files"
And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions mod/lesson/tests/behat/questions_images.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ
| course | C1 |
| activity | lesson |
| name | Test lesson name |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "teacher1"
And I follow "Manage private files"
And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions mod/quiz/tests/behat/manually_mark_question.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Feature: Teachers can override the grade for any question
And quiz "Quiz 1" contains the following questions:
| question | page |
| TF1 | 1 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "student1"
And I follow "Attempt quiz"
And I follow "Finish attempt ..."
Expand Down
3 changes: 3 additions & 0 deletions mod/workshop/tests/behat/embedded_images.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Feature: Teachers can embed images into instructions and conclusion fields
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "teacher1"
# Upload an image into the private files.
And I follow "Manage private files"
Expand Down
3 changes: 3 additions & 0 deletions question/type/essay/tests/behat/file_type_restriction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ I need to limit the submittable file types
And quiz "Quiz 1" contains the following questions:
| question | page |
| TF1 | 1 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
Given I am on the "Quiz 1" "mod_quiz > edit" page logged in as teacher1
And I click on "Edit question TF1" "link"
And I set the field "Allow attachments" to "1"
Expand Down
3 changes: 3 additions & 0 deletions repository/recent/tests/behat/add_recent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Feature: Recent files repository lists the recently used files
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions repository/tests/behat/cancel_add_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Feature: A selected file can be cancelled
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"
And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Expand Down
3 changes: 3 additions & 0 deletions repository/tests/behat/create_shortcut.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Feature: Create shortcuts
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
When I log in as "teacher1"
And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Expand Down
5 changes: 5 additions & 0 deletions repository/tests/behat/delete_files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Feature: Delete files and folders from the file manager
As a user
I need to delete files from file areas

Background:
Given the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |

@javascript @_bug_phantomjs
Scenario: Delete a file and a folder
Given I log in as "admin"
Expand Down
13 changes: 7 additions & 6 deletions repository/tests/behat/edit_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Feature: Edit file feature
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"

@javascript
Scenario: Select file from "Files" filemanager using "icons" view and edit the name
Given I log in as "admin"
And I follow "Manage private files"
Given I follow "Manage private files"
And I click on "Display folder with file icons" "link" in the ".filemanager" "css_element"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I should see "empty.txt" in the ".fp-content .fp-file" "css_element"
Expand All @@ -26,8 +29,7 @@ Feature: Edit file feature

@javascript
Scenario: Select file from "Files" filemanager using "list" view and edit the name
Given I log in as "admin"
And I follow "Manage private files"
Given I follow "Manage private files"
And I click on "Display folder with file details" "link" in the ".filemanager" "css_element"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I should see "empty.txt" in the ".fp-content .fp-filename" "css_element"
Expand All @@ -41,8 +43,7 @@ Feature: Edit file feature

@javascript
Scenario: Select file from "Files" filemanager using "tree" view and edit the name
Given I log in as "admin"
And I follow "Manage private files"
Given I follow "Manage private files"
And I click on "Display folder as file tree" "link" in the ".filemanager" "css_element"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I should see "empty.txt" in the ".fp-content .fp-hascontextmenu .fp-filename" "css_element"
Expand Down
3 changes: 3 additions & 0 deletions repository/tests/behat/overwrite_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Feature: Overwrite file feature
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
When I log in as "teacher1"
And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Expand Down
13 changes: 7 additions & 6 deletions repository/tests/behat/select_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Feature: Select file feature
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "blocks" exist:
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
| private_files | System | 1 | my-index | side-post |
And I log in as "admin"

@javascript
Scenario: Select a file from the "Recent files" repository using "icons" view
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Given I am on "Course 1" course homepage with editing mode on
And I add a "Folder" to section "1"
And I set the following fields to these values:
| Name | Test folder |
Expand All @@ -32,8 +35,7 @@ Feature: Select file feature

@javascript
Scenario: Select a file from the "Recent files" repository using "list" view
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Given I am on "Course 1" course homepage with editing mode on
And I add a "Folder" to section "1"
And I set the following fields to these values:
| Name | Test folder |
Expand All @@ -53,8 +55,7 @@ Feature: Select file feature

@javascript
Scenario: Select a file from the "Recent files" repository using "tree" view
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Given I am on "Course 1" course homepage with editing mode on
And I add a "Folder" to section "1"
And I set the following fields to these values:
| Name | Test folder |
Expand Down

0 comments on commit b0532ae

Please sign in to comment.