Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7c5ab2ffbf
Fetching contributors…

Cannot retrieve contributors at this time

executable file 284 lines (234 sloc) 9.905 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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
@admin
Feature: Admin tasks

Scenario: admin cannot log in as an ordinary user - it is a different type of account
Given the following admin exists
| login | password |
| Zooey | secret |
When I go to the home page
And I fill in "user_session_login" with "Zooey"
And I fill in "user_session_password" with "secret"
And I press "Log in"
Then I should see "The password or user name you entered doesn't match our records"
Scenario: Ordinary user cannot log in as admin
Given the following activated user exists
| login | password |
| dizmo | wrangulator |
And I have loaded the "roles" fixture
When I go to the admin_login page
And I fill in "admin_session_login" with "dizmo"
And I fill in "admin_session_password" with "wrangulator"
And I press "Log in as admin"
Then I should see "Authentication failed"
Scenario: Admin can log in
Given I have no users
And the following admin exists
| login | password |
| Zooey | secret |
And I have loaded the "roles" fixture
When I go to the admin_login page
And I fill in "admin_session_login" with "Zooey"
And I fill in "admin_session_password" with "secret"
And I press "Log in as admin"
Then I should see "Successfully logged in"
Scenario: admin can find users
Given I am logged in as "someone"
And I have loaded the "roles" fixture
When I am logged in as an admin
And I fill in "query" with "someone"
And I press "Find"
Then I should see "someone" within "#admin_users_table"
Scenario: Post a FAQ
When I go to the archive_faqs page
Then I should see "Some commonly asked questions about the Archive are answered here"
And I should not see "Some text"
When I am logged in as an admin
When I follow "Admin Posts"
And I follow "Archive FAQ" within "#main"
And I should not see "Some text"
When I follow "New FAQ Section"
And I fill in "content" with "Some text, that is sufficiently long to pass validation."
And I fill in "title" with "New subsection"
When I press "Post"
Then I should see "ArchiveFaq was successfully created"
When I go to the archive_faqs page
And I follow "New subsection"
Then I should see "Some text, that is sufficiently long to pass validation" within ".userstuff"
Scenario: Edit FAQ
Given I have posted a FAQ
When I follow "Admin Posts"
And I follow "Archive FAQ" within "#main"
And I follow "Edit"
And I fill in "content" with "Number 1 posted FAQ, this is, and Yoda approves."
And I press "Post"
Then I should see "ArchiveFaq was successfully updated"
And I should see "Yoda approves"

Scenario: Find users

Given the following activated user exists
| login | password |
| dizmo | wrangulator |
And I have loaded the "roles" fixture
When I am logged in as an admin

# change user email

When I fill in "query" with "dizmo"
And I press "Find"
Then I should see "dizmo" within "#admin_users_table"
When I fill in "user_email" with "dizmo@fake.com"
And I press "Update"
Then the "user_email" field should contain "dizmo@fake.com"

# Adding and removing roles
When I check "user_roles_1"
And I press "Update"
# Then show me the html
Then I should see "User was successfully updated"
And the "user_roles_1" checkbox should be checked
When I uncheck "user_roles_1"
And I press "Update"
Then I should see "User was successfully updated"
And the "user_roles_1" checkbox should not be checked

Scenario: Change some admin settings for performance - guest downloading and tag wrangling

Given the following activated tag wrangler exists
| login |
| dizmo |
And a character exists with name: "Ianto Jones", canonical: true

# post a work and download it as a guest

When I am logged in as "dizmo"
And I post the work "Storytime"
And I log out
And I view the work "Storytime"
Then I should see "Download"

# turn off guest downloading

When I am logged in as an admin
When I follow "Settings"
Then I should see "Turn off downloading for guests"
And I should see "Turn off tag wrangling for non-admins"
When I check "Turn off downloading for guests"
And I press "Update"
Then I should see "Setting banner back on for all users. This may take some time"
# Changing from null to empty string counts as a change to the banner

# Check guest downloading is off

When I log out
Then I should see "Successfully logged out"
When I view the work "Storytime"
And I follow "MOBI"
Then I should see "Due to current high load"

# Turn off tag wrangling

When I am logged in as an admin
When I follow "Settings"
And I check "Turn off tag wrangling for non-admins"
And I press "Update"
Then I should see "Archive settings were successfully updated."

# Check tag wrangling is off

When I log out
Then I should see "Successfully logged out"
When I am logged in as "dizmo"
And I edit the tag "Ianto Jones"
Then I should see "Wrangling is disabled at the moment. Please check back later."
And I should not see "Synonym of"

# Set them back to normal
Given I am logged out
Given guest downloading is on
Given I am logged out as an admin
Given tag wrangling is on

Scenario: Send out an admin notice to all users

Given I have no users
And the following admin exists
| login | password |
| Zooey | secret |
And the following activated user exists
| login | password | email |
| enigel | emailnotifications | e@e.org |
| otherfan | hatesnotifications | o@e.org |
And all emails have been delivered

# otherfan turns off notifications

When I am logged in as "otherfan" with password "hatesnotifications"
And I go to my preferences page
And I check "Turn off admin emails"
And I press "Update"
Then I should see "Your preferences were successfully updated"

# admin sends out notice to all users

When I am logged in as an admin
And I go to the admin-notices page
And I fill in "Subject" with "Hey, we did stuff"
And I fill in "Message" with "And it was awesome"
And I check "Notify All Users"
And I press "Send Notification"
Then 1 email should be delivered to webmaster@example.org
And the email should not contain "otherfan"
And the email should contain "enigel"
When the system processes jobs
# confirmation email to admin, and to one user
Then 1 email should be delivered to e@e.org
And the email should contain "Dear enigel"
And "Issue 2035" is fixed
# And the email should contain "Hey, we did stuff"
And the email should contain "And it was awesome"

Scenario: Mark a comment as spam

Given I have no works or comments
And the following activated users exist
| login | password |
| author | password |
| commenter | password |
And the following admin exists
| login | password |
| Zooey | secret |

# set up a work with a genuine comment

When I am logged in as "author" with password "password"
And I post the work "The One Where Neal is Awesome"
When I am logged out
And I am logged in as "commenter" with password "password"
And I view the work "The One Where Neal is Awesome"
And I fill in "Comment" with "I loved this!"
And I press "Comment"
Then I should see "Comment created!"
When I am logged out

# comment from registered user cannot be marked as spam.
# If registered user is spamming, this goes to Abuse team as ToS violation
When I am logged in as an admin
Then I should see "Successfully logged in"
When I view the work "The One Where Neal is Awesome"
And I follow "Comments (1)"
Then I should not see "Mark as spam"

# now mark a comment as spam
When I post the comment "Would you like a genuine rolex" on the work "The One Where Neal is Awesome" as a guest
And I am logged in as an admin
And I view the work "The One Where Neal is Awesome"
And I follow "Comments (2)"
Then I should see "rolex"
And I should see "Spam"
When I follow "Spam"
Then I should see "Not Spam"
When I follow "Hide Comments"
# TODO: Figure out if this is a defect or not, that it shows 2 instead of 1
# Then I should see "Comments (1)"

# comment should no longer be there
When I follow "Comments"
Then I should see "rolex"
And I should see "Not Spam"
When I am logged out as an admin
And I view the work "The One Where Neal is Awesome"
And I follow "Comments"
Then I should not see "rolex"
When I am logged in as "author" with password "password"
And I view the work "The One Where Neal is Awesome"
And I follow "Comments"
Then I should not see "rolex"

Scenario: admin goes to the Support page
Given I am logged in as an admin
When I go to the support page
Then I should see "Support and Feedback"
And I should see "testadmin@example.org" in the "feedback_email" input
Scenario: Post known issues
When I am logged in as an admin
And I follow "Admin Posts"
And I follow "Known Issues" within "#main"
And I follow "make a new known issues post"
And I fill in "known_issue_title" with "First known problem"
And I fill in "content" with "This is a bit of a problem"
# Suspect related to issue 2458
And I press "Post"
Then I should see "KnownIssue was successfully created"
Scenario: Edit known issues
# TODO
Given I have posted known issues
When I edit known issues
Then I should see "KnownIssue was successfully updated"
Something went wrong with that request. Please try again.