weekly release 4.5dev
[moodle.git] / admin / tool / task / tests / behat / manage_tasks.feature
blob8d0c0f34b4f216e07d2a8455b5b93eecff11b265
1 @tool @tool_task @javascript
2 Feature: Manage scheduled tasks
3   In order to configure scheduled tasks
4   As an admin
5   I need to be able to disable, enable, edit and reset to default scheduled tasks
7   Background:
8     Given I log in as "admin"
9     And I navigate to "Server > Tasks > Scheduled tasks" in site administration
11   Scenario: Disable scheduled task
12     When I click on "Edit task schedule: Log table cleanup" "link" in the "Log table cleanup" "table_row"
13     Then I should see "Edit task schedule: Log table cleanup"
14     And I set the following fields to these values:
15       | disabled             | 1 |
16     And I press "Save changes"
17     Then I should see "Changes saved"
18     And I should see "Task disabled" in the "Log table cleanup" "table_row"
19     And I should see "Log table cleanup" in the "tr.table-primary" "css_element"
21   Scenario: Enable scheduled task
22     When I click on "Edit task schedule: Log table cleanup" "link" in the "Log table cleanup" "table_row"
23     Then I should see "Edit task schedule: Log table cleanup"
24     And I set the following fields to these values:
25       | disabled             | 0 |
26     And I press "Save changes"
27     Then I should see "Changes saved"
28     And I should not see "Task disabled" in the "Log table cleanup" "table_row"
29     And I should see "Log table cleanup" in the "tr.table-primary" "css_element"
31   Scenario: Edit scheduled task
32     When I click on "Edit task schedule: Log table cleanup" "link" in the "Log table cleanup" "table_row"
33     Then I should see "Edit task schedule: Log table cleanup"
34     And I should see "\logstore_standard\task\cleanup_task"
35     And I should see "From component: Standard log"
36     And I should see "logstore_standard"
37     And I should see "Default: R" in the "Minute" "fieldset"
38     And I should see "Default: *" in the "Day" "fieldset"
39     And I set the following fields to these values:
40       | minute               | frog |
41     And I press "Save changes"
42     And I should see "Data submitted is invalid"
43     And I set the following fields to these values:
44       | minute               | */5 |
45       | hour                 | 1   |
46       | day                  | 2   |
47       | month                | 3   |
48       | dayofweek            | 4   |
49     And I press "Save changes"
50     And I should see "Changes saved"
51     And the following should exist in the "admintable" table:
52       | Component                      | Minute         | Hour         | Day          | Day of week  | Month        |
53       | Standard log logstore_standard | */5 Default: R | 1 Default: 4 | 2 Default: * | 4 Default: * | 3 Default: * |
54     And I should see "Log table cleanup" in the "tr.table-primary" "css_element"
55     And I should see "*/5 Default: R" in the "td.table-warning" "css_element"
57   Scenario: Reset scheduled task to default
58     When I click on "Edit task schedule: Log table cleanup" "link" in the "Log table cleanup" "table_row"
59     Then I should see "Edit task schedule: Log table cleanup"
60     And I set the following fields to these values:
61       | resettodefaults      | 1   |
62     And I press "Save changes"
63     Then I should see "Changes saved"
64     And the following should not exist in the "admintable" table:
65       | Name              | Minute | Hour | Day | Day of week | Month |
66       | Log table cleanup | */5    | 1    | 2   | 4           | 3     |
67     And I should see "Log table cleanup" in the "tr.table-primary" "css_element"
69   Scenario: Disabled plugin's tasks are labelled as disabled too
70     When "CAS users sync job \auth_cas\task\sync_task" row "Next run" column of "Scheduled tasks" table should contain "Plugin disabled"
71     Then "CAS users sync job \auth_cas\task\sync_task" row "Component" column of "Scheduled tasks" table should contain "Disabled"
72     And "Background processing for scheduled allocation \workshopallocation_scheduled\task\cron_task" row "Next run" column of "Scheduled tasks" table should not contain "Plugin disabled"
73     And "Background processing for scheduled allocation \workshopallocation_scheduled\task\cron_task" row "Component" column of "Scheduled tasks" table should not contain "Disabled"