1 |
efrain |
1 |
@tool @tool_availabilityconditions
|
|
|
2 |
Feature: Manage availability conditions
|
|
|
3 |
In order to control availability restrictions
|
|
|
4 |
As an administrator
|
|
|
5 |
I need to see the list of restrictions and hide or show them
|
|
|
6 |
|
|
|
7 |
@javascript
|
|
|
8 |
Scenario: Display list of availability conditions
|
|
|
9 |
# Check the report doesn't show when not enabled.
|
|
|
10 |
Given the following config values are set as admin:
|
|
|
11 |
| unaddableblocks | | theme_boost|
|
|
|
12 |
And I log in as "admin"
|
|
|
13 |
And I turn editing mode on
|
|
|
14 |
And I add the "Administration" block if not present
|
|
|
15 |
And the following config values are set as admin:
|
|
|
16 |
| enableavailability | 0 |
|
|
|
17 |
And I expand "Site administration" node
|
|
|
18 |
When I expand "Plugins" node
|
|
|
19 |
Then I should not see "Availability restrictions"
|
|
|
20 |
|
|
|
21 |
# Enable it and check I can now see and click on it.
|
|
|
22 |
And the following config values are set as admin:
|
|
|
23 |
| enableavailability | 1 |
|
|
|
24 |
And I am on homepage
|
|
|
25 |
And I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration
|
|
|
26 |
|
|
|
27 |
# Having clicked on it, I should also see the list of plugins.
|
|
|
28 |
And I should see "Restriction by date"
|
|
|
29 |
And I should see "Restriction by grades"
|
|
|
30 |
|
|
|
31 |
@javascript
|
|
|
32 |
Scenario: Hide and show conditions
|
|
|
33 |
# Get to the right page
|
|
|
34 |
Given the following "courses" exist:
|
|
|
35 |
| fullname | shortname | format |
|
|
|
36 |
| Course 1 | C1 | topics |
|
|
|
37 |
And the following "activity" exists:
|
|
|
38 |
| activity | page |
|
|
|
39 |
| course | C1 |
|
|
|
40 |
| name | P1 |
|
|
|
41 |
And I log in as "admin"
|
|
|
42 |
When I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration
|
|
|
43 |
|
|
|
44 |
# Check the icon is there (it should be a Hide icon, meaning is currently visible).
|
|
|
45 |
Then "Hide" "icon" should exist in the "Restriction by date" "table_row"
|
|
|
46 |
|
|
|
47 |
# Click the icon. It should toggle to hidden (title=Show).
|
|
|
48 |
And I click on "Hide" "icon" in the "Restriction by date" "table_row"
|
|
|
49 |
And "Show" "icon" should exist in the "Restriction by date" "table_row"
|
|
|
50 |
|
|
|
51 |
# Toggle it back to visible (title=Hide).
|
|
|
52 |
And I click on "Show" "icon" in the "Restriction by date" "table_row"
|
|
|
53 |
And "Hide" "icon" should exist in the "Restriction by date" "table_row"
|
|
|
54 |
|
|
|
55 |
# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
|
|
|
56 |
And I click on "Hide" "icon" in the "Restriction by grade" "table_row"
|
|
|
57 |
And I am on the "P1" "page activity editing" page
|
|
|
58 |
And I expand all fieldsets
|
|
|
59 |
And I click on "Add restriction..." "button"
|
|
|
60 |
And "Add restriction..." "dialogue" should be visible
|
|
|
61 |
And "Date" "button" should exist in the "Add restriction..." "dialogue"
|
|
|
62 |
And "Grade" "button" should not exist in the "Add restriction..." "dialogue"
|