Merge branch 'MDL-69116-38' of git://github.com/rezaies/moodle into MOODLE_38_STABLE
[moodle.git] / repository / tests / behat / create_shortcut.feature
blob1cac3cbc3b2f4cfc1d2a9d69a643f3847835ea49
1 @core @core_filepicker @repository @repository_user @_file_upload
2 Feature: Create shortcuts
3   In order to automatically synchronize copies of the file with the source
4   As a teacher
5   I need to be able to pick file as a shortcut
7   @javascript @_bug_phantomjs
8   Scenario: Upload a file as a copy and as a shortcut in filemanager
9     Given the following "users" exist:
10       | username | firstname | lastname | email |
11       | teacher1 | Terry | Teacher | teacher1@example.com |
12     And the following "courses" exist:
13       | fullname | shortname | category |
14       | Course 1 | C1 | 0 |
15     And the following "course enrolments" exist:
16       | user | course | role |
17       | teacher1 | C1 | editingteacher |
18     When I log in as "teacher1"
19     And I follow "Manage private files"
20     And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
21     Then I should see "empty.txt" in the "div.fp-content" "css_element"
22     And I press "Save changes"
23     And I am on "Course 1" course homepage with editing mode on
24     And I add a "Folder" to section "1"
25     And I set the following fields to these values:
26       | Name        | Test folder             |
27       | Description | Test folder description |
28     And I add "empty.txt" file from "Private files" to "Files" filemanager
29     And I should see "1" elements in "Files" filemanager
30     And I should see "empty.txt" in the ".fp-content .fp-file" "css_element"
31     And ".fp-content .fp-file.fp-isreference" "css_element" should not exist
32     And I add "empty.txt" file from "Private files" to "Files" filemanager as:
33       | Save as | empty_ref.txt |
34       | Create an alias/shortcut to the file | 1 |
35     And I should see "2" elements in "Files" filemanager
36     And I should see "empty_ref.txt" in the ".fp-content .fp-file.fp-isreference" "css_element"
37     And I press "Save and display"
38     And I should see "empty.txt"
39     And I should see "empty_ref.txt"
40     And I press "Edit"
41     And I should see "2" elements in "Files" filemanager
42     And I should see "empty_ref.txt" in the ".fp-content .fp-file.fp-isreference" "css_element"
43     # ------ Overwriting the reference with a non-reference ---------
44     And I add and overwrite "empty.txt" file from "Private files" to "Files" filemanager as:
45       | Save as | empty_ref.txt |
46     And I should see "2" elements in "Files" filemanager
47     And ".fp-content .fp-file.fp-isreference" "css_element" should not exist
48     And I press "Save changes"
49     And I should see "empty.txt"
50     And I should see "empty_ref.txt"
51     And I press "Edit"
52     And I should see "2" elements in "Files" filemanager
53     And ".fp-content .fp-file.fp-isreference" "css_element" should not exist
54     # ------ Overwriting non-reference with a reference ---------
55     And I add and overwrite "empty.txt" file from "Private files" to "Files" filemanager as:
56       | Save as | empty_ref.txt |
57       | Create an alias/shortcut to the file | 1 |
58     And I should see "2" elements in "Files" filemanager
59     And I should see "empty_ref.txt" in the ".fp-content .fp-file.fp-isreference" "css_element"
60     And I press "Save changes"
61     And I should see "empty.txt"
62     And I should see "empty_ref.txt"
63     And I press "Edit"
64     And I should see "2" elements in "Files" filemanager
65     And I should see "empty_ref.txt" in the ".fp-content .fp-file.fp-isreference" "css_element"