MDL-68483 contentbank: improve search API
[moodle.git] / contentbank / tests / behat / events.feature
CommitLineData
f2e02ea9
AA
1@core @core_contentbank @_file_upload @_switch_iframe @javascript
2Feature: Confirm content bank events are triggered
3 In order to log content bank actions
4 As an admin
5 I need to be able to check triggered events
6
7 Background:
8 And the following "courses" exist:
9 | fullname | shortname | category |
10 | Course 1 | C1 | 0 |
11 And the following "contentbank content" exist:
12 | course | contenttype | user | contentname |
13 | C1 | contenttype_h5p | admin | Existing |
14 And I log in as "admin"
15 And I follow "Manage private files..."
16 And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Files" filemanager
17 And I click on "Save changes" "button"
18 And I am on "Course 1" course homepage with editing mode on
19 And I add the "Navigation" block if not present
20
21 Scenario: Content created and uploaded events when uploading a content file
22 Given I navigate to "Reports > Live logs" in site administration
23 And I should not see "Content uploaded"
24 And I should not see "Content created"
25 And I am on "Course 1" course homepage
26 And I expand "Site pages" node
27 And I click on "Content bank" "link"
28 When I click on "Upload" "link"
29 And I click on "Choose a file..." "button"
30 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
31 And I click on "filltheblanks.h5p" "link"
32 And I click on "Select this file" "button"
33 And I click on "Save changes" "button"
34 And I navigate to "Reports > Live logs" in site administration
35 Then I should see "Content uploaded"
36 And I should see "Content created"
37
38 Scenario: Content viewed event
39 Given I navigate to "Reports > Live logs" in site administration
40 And I should not see "Content viewed"
41 And I am on "Course 1" course homepage
42 And I expand "Site pages" node
43 And I click on "Content bank" "link"
44 When I click on "Existing" "link"
45 And I navigate to "Reports > Live logs" in site administration
46 Then I should see "Content viewed"
47
48 Scenario: Content deleted event
49 Given I navigate to "Reports > Live logs" in site administration
50 And I should not see "Content deleted"
51 And I am on "Course 1" course homepage
52 And I expand "Site pages" node
53 And I click on "Content bank" "link"
54 And I click on "Existing" "link"
55 And I open the action menu in "region-main-settings-menu" "region"
56 When I choose "Delete" in the open action menu
57 And I click on "Delete" "button" in the "Delete content" "dialogue"
58 And I navigate to "Reports > Live logs" in site administration
59 Then I should see "Content deleted"
60
61 Scenario: Content updated event when renaming
62 Given I navigate to "Reports > Live logs" in site administration
63 And I should not see "Content updated"
64 And I am on "Course 1" course homepage
65 And I expand "Site pages" node
66 And I click on "Content bank" "link"
67 And I click on "Existing" "link"
68 And I open the action menu in "region-main-settings-menu" "region"
69 When I choose "Rename" in the open action menu
70 And I set the field "Content name" to "New name"
71 And I click on "Rename" "button"
72 And I navigate to "Reports > Live logs" in site administration
7afd16ad 73 Then I should see "Content updated"