MDL-51172 core_files: Added Behat test to automate MDLQA-8166
[moodle.git] / files / tests / behat / add_custom_file_type.feature
CommitLineData
202203e3
RD
1@core @core_files @test
2Feature: Add a new custom file type
3 In order to add files of a custom type
4 As an admin
5 I need to add a new custom file type
6
7
8 @javascript
9 Scenario: Add custom file type
10 Given the following "courses" exist:
11 | fullname | shortname | category | legacyfiles |
12 | Course 1 | C1 | 0 | 2 |
13 And the following "users" exist:
14 | username | firstname | lastname | email |
15 | teacher1 | Teacher | 1 | teacher1@example.com |
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 And I log in as "admin"
20 And I navigate to "File types" node in "Site administration>Server"
21 And I press "Add a new file type"
22 And I set the following fields to these values:
23 | Extension | mobi |
24 | MIME type | application/x-mobipocket-ebook |
25 | File icon | document |
26 | Description type | Custom description specified in this form |
27 | Custom description | Kindle ebook |
28 And I press "Save changes"
29 And I should see "mobi"
30 And I log out
31 And I log in as "teacher1"
32 And I follow "Course 1"
33 And I turn editing mode on
34 When I add a "File" to section "1" and I fill the form with:
35 | Name | Test file |
36 | Select files | files/tests/fixtures/custom_filetype.mobi |
37 | Show type | 1 |
38 | Display resource description | 1 |
39 And I follow "Course 1"
40 Then I should see "Test file"
41 And I should see "Kindle ebook" in the "span.resourcelinkdetails" "css_element"