Skip to content
This repository
tree: 3412470949
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 221 lines (204 sloc) 8.543 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
@works
Feature: Edit chapters
In order to have an work full of chapters
As a humble user
I want to add and remove chapters

Scenario: Add chapters to an existing work, delete chapters, edit chapters, post chapters in the wrong order, use rearrange page, create draft chapter

Given the following activated user exists
| login | password |
| epicauthor | password |
And basic tags
When I go to epicauthor's user page
Then I should see "There are no works"
When I am logged in as "epicauthor" with password "password"
# create a basic single-chapter work
When I follow "post new"
Then I should see "Post New Work"
When I select "Not Rated" from "Rating"
And I check "No Archive Warnings Apply"
And I fill in "Fandoms" with "New Fandom"
And I fill in "Work Title" with "New Epic Work"
And I fill in "content" with "Well, maybe not so epic."
And I press "Preview"
Then I should see "Draft was successfully created"
And I should see "1/1"
When I press "Post"
Then I should not see "Chapter 1"
And I should see "Well, maybe not so epic"
And I should see "Words:5"
# add chapters to a single-chapter work
When I follow "Add Chapter"
And I fill in "chapter_position" with "2"
And I fill in "chapter_wip_length" with "100"
And I fill in "content" with "original chapter two"
And I press "Preview"
Then I should see "This is a preview of what this chapter will look like"
When I press "Post Chapter"
Then I should see "2/100"
And I should see "Words:8"
When I follow "Add Chapter"
And I fill in "chapter_position" with "3"
And I fill in "chapter_wip_length" with "50"
And I fill in "content" with "entering chapter three"
And I press "Preview"
Then I should see "Chapter 3"
When I press "Post Chapter"
Then I should see "3/50"
And I should see "Words:11"
# add chapters in the wrong order
When I follow "Add Chapter"
And I fill in "chapter_position" with "17"
And I fill in "chapter_wip_length" with "17"
And I fill in "content" with "entering fourth chapter out of order"
And I press "Preview"
Then I should see "Chapter 4"
When I press "Post Chapter"
And I should see "4/17"
And I should see "Words:17"
# delete a chapter
When I follow "Edit"
And I follow "2"
And I press "Preview"
And I follow "Delete Chapter"
Then I should see "The chapter was successfully deleted."
And I should see "3/17"
And I should see "Words:14"
# fill in the missing chapter
When I follow "Add Chapter"
And I fill in "chapter_position" with "2"
And I fill in "content" with "entering second chapter out of order"
And I press "Preview"
When I press "Post Chapter"
Then I should see "4/17"
And I should see "Words:20"
# edit an existing chapter
When I follow "Edit"
And I follow "3"
And I fill in "chapter_position" with "4"
And I fill in "chapter_wip_length" with "4"
And I fill in "content" with "last chapter"
And I press "Preview"
Then I should see "Chapter 4"
When I press "Update"
Then I should see "Chapter was successfully updated"
And I should see "Chapter 4"
And I should see "4/4"
And I should see "Words:19"
When I follow "Edit"
And I follow "Manage Chapters"
Then I should see "Drag chapters to change their order."
# view chapters in the right order
When I am logged out
And I go to epicauthor's works page
And I follow "New Epic Work"
And I follow "Entire Work"
Then I should see "Chapter 1"
And I should see "Well, maybe not so epic." within "#chapter-1"
And I should see "Chapter 2"
And I should see "entering second chapter out of order" within "#chapter-2"
And I should see "Chapter 3"
And I should see "entering fourth chapter out of order" within "#chapter-3"
And I should see "Chapter 4"
And I should see "last chapter" within "#chapter-4"
And I should not see "original chapter two"
When I follow "View chapter by chapter"
And I follow "Chapter Index"
Then I should see "Chapter Index for New Epic Work by epicauthor"
And I should see "Chapter 1"
And I should see "Chapter 2"
And I should see "Chapter 3"
And I should see "Chapter 4"
# move chapters around using rearrange page
When I am logged in as "epicauthor" with password "password"
And I view the work "New Epic Work"
And I follow "Edit"
And I follow "Manage Chapters"
Then I should see "Drag chapters to change their order."
When I fill in "chapters_1" with "4"
And I fill in "chapters_2" with "3"
And I fill in "chapters_3" with "2"
And I fill in "chapters_4" with "1"
And I press "Update Positions"
Then I should see "Chapter order has been successfully updated."
When I am logged out
And I go to epicauthor's works page
And I follow "New Epic Work"
And I follow "Entire Work"
Then I should see "Chapter 1"
And I should see "Well, maybe not so epic." within "#chapter-4"
And I should see "Chapter 2"
And I should see "second chapter" within "#chapter-3"
And I should see "Chapter 3"
And I should see "fourth chapter" within "#chapter-2"
And I should see "Chapter 4"
And I should see "last chapter" within "#chapter-1"

# create a draft chapter and post it
When I am logged in as "epicauthor" with password "password"
And I view the work "New Epic Work"
And I follow "Add Chapter"
And I fill in "Chapter title" with "My title"
And I fill in "content" with "some more epic context"
And I press "Preview"
And I view the work "New Epic Work"
And I follow "Edit"
Then I should see "5 (Draft)"
When I view the work "New Epic Work"
Then I should see "4/5"
When I select "5. My title" from "selected_id"
And I press "Go"
Then I should see "This chapter is a draft and hasn't been posted yet!"
When I press "Post Chapter"
Then I should see "5/5"
When I follow "Edit"
Then I should not see "Draft"
And I should not see "draft"
When I view the work "New Epic Work"
And I select "5. My title" from "selected_id"
And I press "Go"
Then I should not see "Draft"
And I should not see "draft"

# create a draft chapter, preview it, edit it and then post it without preview
When I am logged in as "epicauthor" with password "password"
And I view the work "New Epic Work"
And I follow "Add Chapter"
And I fill in "Chapter title" with "6(66) The Number of the Beast"
And I fill in "content" with "Even more awesomely epic context"
And I press "Preview"
Then I should see "This is a preview of what this chapter will look like"
When I follow "Edit Chapter"
And I fill in "content" with "Even more awesomely epic context. Plus bonus epicness"
And I press "Post without preview"
Then I should see "Chapter was successfully updated."
And I should not see "This chapter is a draft and hasn't been posted yet!"

# create a draft chapter, preview it, edit it, preview it again and then post it
When I am logged in as "epicauthor" with password "password"
And I view the work "New Epic Work"
And I follow "Add Chapter"
And I fill in "Chapter title" with "6(66) The Number of the Beast"
And I fill in "content" with "Even more awesomely epic context"
And I press "Preview"
Then I should see "This is a preview of what this chapter will look like"
When I follow "Edit Chapter"
And I fill in "content" with "Even more awesomely epic context. Plus bonus epicness"
And I press "Preview"
Then I should see "Even more awesomely epic context. Plus bonus epicness"
When I press "Post"
Then I should see "Chapter was successfully updated."
And I should not see "This chapter is a draft and hasn't been posted yet!"


Scenario: view chapter title info pop up
Given the following activated user exists
| login | password |
| epicauthor | password |
And basic tags
When I am logged in as "epicauthor"
And I go to epicauthor's user page
And I follow "post new"
And I select "Not Rated" from "Rating"
And I check "No Archive Warnings Apply"
And I fill in "Fandoms" with "New Fandom"
And I fill in "Work Title" with "New Epic Work"
And I fill in "content" with "Well, maybe not so epic."
And I press "Post"
And I follow "Add Chapter"
And I follow "Chapter title"
Then I should see "You can add a chapter title"
Something went wrong with that request. Please try again.