1 |
efrain |
1 |
@mod @mod_book
|
|
|
2 |
Feature: In a book, chapters and subchapters can be rearranged
|
|
|
3 |
In order to rearrange chapters and subchapters
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to move chapters and subchapters up and down.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
And the following "courses" exist:
|
|
|
12 |
| fullname | shortname | format |
|
|
|
13 |
| Course 1 | C1 | topics |
|
|
|
14 |
And the following "course enrolments" exist:
|
|
|
15 |
| user | course | role |
|
|
|
16 |
| teacher1 | C1 | editingteacher |
|
|
|
17 |
And the following "activities" exist:
|
|
|
18 |
| activity | name | course | idnumber |
|
|
|
19 |
| book | Test book | C1 | book1 |
|
|
|
20 |
And the following "mod_book > chapters" exist:
|
|
|
21 |
| book | title | content | pagenum |subchapter |
|
|
|
22 |
| Test book | Originally first chapter | #1 chapter content | 1 | 0 |
|
|
|
23 |
| Test book | A great second chapter | #2 chapter content | 2 | 0 |
|
|
|
24 |
| Test book | Second chapter, subchapter 1 | #21 subchapter content | 3 | 1 |
|
|
|
25 |
| Test book | Second chapter, subchapter 2 | #22 subchapter content | 4 | 1 |
|
|
|
26 |
| Test book | There aren't 2 without 3 | #3 subchapter content | 5 | 0 |
|
|
|
27 |
And I log in as "teacher1"
|
|
|
28 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
29 |
And I follow "Test book"
|
|
|
30 |
|
|
|
31 |
Scenario: Moving chapters down rearranges them properly
|
|
|
32 |
Given I click on "Move chapter down \"1. Originally first chapter\"" "link"
|
|
|
33 |
When I am on the "Test book" "book activity" page
|
|
|
34 |
Then I should see "1. A great second chapter"
|
|
|
35 |
And I should see "#2 chapter content"
|
|
|
36 |
And I should see "1.1. Second chapter, subchapter 1"
|
|
|
37 |
And I should see "1.2. Second chapter, subchapter 2"
|
|
|
38 |
And I should see "2. Originally first chapter"
|
|
|
39 |
And I should see "3. There aren't 2 without 3"
|
|
|
40 |
|
|
|
41 |
Scenario: Moving chapters up rearranges them properly
|
|
|
42 |
Given I click on "Move chapter up \"3. There aren't 2 without 3\"" "link"
|
|
|
43 |
When I am on the "Test book" "book activity" page
|
|
|
44 |
Then I should see "1. Originally first chapter"
|
|
|
45 |
And I should see "#1 chapter content"
|
|
|
46 |
And I should see "2. There aren't 2 without 3"
|
|
|
47 |
And I should see "3. A great second chapter"
|
|
|
48 |
And I should see "3.1. Second chapter, subchapter 1"
|
|
|
49 |
And I should see "3.2. Second chapter, subchapter 2"
|
|
|
50 |
|
|
|
51 |
Scenario: Moving subchapters down within chapter rearranges them properly
|
|
|
52 |
Given I click on "Move chapter down \"2.1. Second chapter, subchapter 1\"" "link"
|
|
|
53 |
When I should see "2.1. Second chapter, subchapter 2"
|
|
|
54 |
Then I should see "2.2. Second chapter, subchapter 1"
|
|
|
55 |
|
|
|
56 |
Scenario: Moving subchapters down out of chapter rearranges them properly
|
|
|
57 |
Given I click on "Move chapter down \"2.2. Second chapter, subchapter 2\"" "link"
|
|
|
58 |
When I should see "3.1. Second chapter, subchapter 2"
|
|
|
59 |
Then I click on "Move chapter down \"3. There aren't 2 without 3\"" "link"
|
|
|
60 |
And I should not see "4. There aren't 2 without 3"
|
|
|
61 |
And I should see "3. There aren't 2 without 3"
|
|
|
62 |
And I should see "3.1. Second chapter, subchapter 2"
|
|
|
63 |
|
|
|
64 |
Scenario: Moving subchapters up within chapter rearranges them properly
|
|
|
65 |
Given I click on "Move chapter up \"2.2. Second chapter, subchapter 2\"" "link"
|
|
|
66 |
When I should see "2.1. Second chapter, subchapter 2"
|
|
|
67 |
Then I should see "2.2. Second chapter, subchapter 1"
|
|
|
68 |
|
|
|
69 |
Scenario: Moving subchapters up out of chapter rearranges them properly
|
|
|
70 |
Given I click on "Move chapter up \"2.1. Second chapter, subchapter 1\"" "link"
|
|
|
71 |
When I should see "1.1. Second chapter, subchapter 1"
|
|
|
72 |
Then I click on "Move chapter up \"1.1. Second chapter, subchapter 1\"" "link"
|
|
|
73 |
And I should not see "1.1. Second chapter, subchapter 1"
|
|
|
74 |
And I should see "1. Second chapter, subchapter 1"
|
|
|
75 |
And I should see "2. Originally first chapter"
|