1 |
efrain |
1 |
@mod @mod_book
|
|
|
2 |
Feature: Book activity chapter visibility management
|
|
|
3 |
In order to properly manage chapters in a book activity
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to show or hide chapters.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname | category | groupmode |
|
|
|
10 |
| Course 1 | C1 | 0 | 1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
14 |
| student1 | Student | 2 | student1@example.com |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activity" exists:
|
|
|
20 |
| course | C1 |
|
|
|
21 |
| activity | book |
|
|
|
22 |
| name | Test book |
|
|
|
23 |
And the following "mod_book > chapters" exist:
|
|
|
24 |
| book | title | content | pagenum |subchapter |
|
|
|
25 |
| Test book | First chapter | First chapter | 1 | 0 |
|
|
|
26 |
| Test book | Second chapter | Second chapter | 2 | 0 |
|
|
|
27 |
| Test book | Sub chapter | Sub chapter | 3 | 1 |
|
|
|
28 |
| Test book | Third chapter | Third chapter | 4 | 0 |
|
|
|
29 |
| Test book | Fourth chapter | Fourth chapter | 5 | 0 |
|
|
|
30 |
And I am on the "Course 1" course page logged in as teacher1
|
|
|
31 |
And I turn editing mode on
|
|
|
32 |
And I am on the "Test book" "book activity" page
|
|
|
33 |
And I click on "4. Fourth chapter" "link" in the "Table of contents" "block"
|
|
|
34 |
|
|
|
35 |
@javascript
|
|
|
36 |
Scenario: Show/hide chapters and subchapters
|
|
|
37 |
When I follow "Hide chapter \"2. Second chapter\""
|
|
|
38 |
And I follow "Hide chapter \"2. Third chapter\""
|
|
|
39 |
And I am on the "Test book" "book activity" page
|
|
|
40 |
And I am on "Course 1" course homepage
|
|
|
41 |
And I turn editing mode off
|
|
|
42 |
And I click on "Test book" "link" in the "region-main" "region"
|
|
|
43 |
Then the "class" attribute of "a[title='Second chapter']" "css_element" should contain "dimmed_text"
|
|
|
44 |
And the "class" attribute of "a[title='Third chapter']" "css_element" should contain "dimmed_text"
|
|
|
45 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
46 |
And I click on "Test book" "link" in the "region-main" "region"
|
|
|
47 |
And I follow "Next"
|
|
|
48 |
And I should see "Second chapter" in the ".book_content" "css_element"
|
|
|
49 |
And I follow "Next"
|
|
|
50 |
And I should see "Sub chapter" in the ".book_content" "css_element"
|
|
|
51 |
And I follow "Next"
|
|
|
52 |
And I should see "Third chapter" in the ".book_content" "css_element"
|
|
|
53 |
And I follow "Next"
|
|
|
54 |
And I should see "Fourth chapter" in the ".book_content" "css_element"
|
|
|
55 |
And I am on the "Test book" "book activity" page logged in as student1
|
|
|
56 |
And I should not see "Second chapter" in the "Table of contents" "block"
|
|
|
57 |
And I should not see "Third chapter" in the "Table of contents" "block"
|
|
|
58 |
And I follow "Next"
|
|
|
59 |
And I should see "Fourth chapter" in the ".book_content" "css_element"
|