Skip to content

Commit

Permalink
MDL-70153 qtype_essay: Add behat test for attachments max size
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Nov 18, 2020
1 parent d1af86f commit 98dac07
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions question/type/essay/tests/behat/max_file_size.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ I need to choose the appropriate maxbytes for attachments
| username | firstname | lastname | email |
| teacher1 | T1 | Teacher1 | teacher1@moodle.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| fullname | shortname | category | maxbytes |
| Course 1 | C1 | 0 | 1048576 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Expand All @@ -18,15 +18,24 @@ I need to choose the appropriate maxbytes for attachments
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | template | attachments | maxbytes |
| Test questions | essay | essay-1-20MB | editor | 1 | 20971520 |
| Test questions | essay | essay-1-512KB | editor | 1 | 524288 |
| Test questions | essay | essay-1-max | editor | 1 | 0 |
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Question bank" in current page administration

@javascript @_switch_window
Scenario: Preview an Essay question and see the allowed maximum file sizes and number of attachments.
When I choose "Preview" action for "essay-1-20MB" in the question bank
When I choose "Preview" action for "essay-1-512KB" in the question bank
And I switch to "questionpreview" window
And I should see "Please write a story about a frog."
And I should see "Maximum file size: 20MB, maximum number of files: 1"
And I should see "Maximum file size: 512KB, maximum number of files: 1"
And I switch to the main window

@javascript @_switch_window
Scenario: Preview an Essay question with Course upload limit and see the allowed maximum file size.
When I choose "Preview" action for "essay-1-max" in the question bank
And I switch to "questionpreview" window
And I should see "Please write a story about a frog."
And I should see "Maximum file size: 1MB, maximum number of files: 1"
And I switch to the main window

0 comments on commit 98dac07

Please sign in to comment.