mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
cleanup old selenium initializer stuff and migrate edit_a_todo
This commit is contained in:
parent
d193e21ee0
commit
d8b5c7d0d2
19 changed files with 501 additions and 191 deletions
3
Gemfile
3
Gemfile
|
|
@ -47,7 +47,10 @@ group :test do
|
|||
gem "thoughtbot-factory_girl"
|
||||
gem 'memory_test_fix', '~>0.1.3'
|
||||
gem "capybara", ">=0.3.5"
|
||||
gem "selenium-webdriver", '2.14.0' # locked to 2.14.0, see https://code.google.com/p/selenium/issues/detail?id=3075
|
||||
gem "capybara-webkit"
|
||||
gem "capybara-screenshot"
|
||||
gem "launchy"
|
||||
gem "database_cleaner", ">=0.5.0"
|
||||
gem "cucumber-rails", "~>0.3.2"
|
||||
end
|
||||
|
|
|
|||
60
Gemfile.lock
60
Gemfile.lock
|
|
@ -3,8 +3,8 @@ GEM
|
|||
remote: http://gems.github.com/
|
||||
specs:
|
||||
RedCloth (4.2.8)
|
||||
ZenTest (4.6.1)
|
||||
aasm (2.2.0)
|
||||
ZenTest (4.6.2)
|
||||
aasm (2.2.1)
|
||||
actionmailer (2.3.14)
|
||||
actionpack (= 2.3.14)
|
||||
actionpack (2.3.14)
|
||||
|
|
@ -16,6 +16,7 @@ GEM
|
|||
activesupport (= 2.3.14)
|
||||
activesupport (2.3.14)
|
||||
acts_as_list (0.1.4)
|
||||
addressable (2.2.6)
|
||||
bcrypt-ruby (2.1.4)
|
||||
builder (3.0.0)
|
||||
capybara (1.1.2)
|
||||
|
|
@ -25,48 +26,52 @@ GEM
|
|||
rack-test (>= 0.5.4)
|
||||
selenium-webdriver (~> 2.0)
|
||||
xpath (~> 0.1.4)
|
||||
capybara-webkit (0.8.0)
|
||||
capybara-screenshot (0.1.10)
|
||||
capybara (>= 1.0)
|
||||
capybara-webkit (0.9.0)
|
||||
capybara (>= 1.0.0, < 1.2)
|
||||
json
|
||||
cgi_multipart_eof_fix (2.5.0)
|
||||
childprocess (0.3.0)
|
||||
childprocess (0.3.1)
|
||||
ffi (~> 1.0.6)
|
||||
columnize (0.3.4)
|
||||
cucumber (1.0.2)
|
||||
columnize (0.3.6)
|
||||
cucumber (1.1.4)
|
||||
builder (>= 2.1.2)
|
||||
diff-lcs (>= 1.1.2)
|
||||
gherkin (~> 2.4.5)
|
||||
gherkin (~> 2.7.1)
|
||||
json (>= 1.4.6)
|
||||
term-ansicolor (>= 1.0.5)
|
||||
term-ansicolor (>= 1.0.6)
|
||||
cucumber-rails (0.3.2)
|
||||
cucumber (>= 0.8.0)
|
||||
daemons (1.1.4)
|
||||
database_cleaner (0.6.7)
|
||||
diff-lcs (1.1.2)
|
||||
daemons (1.1.8)
|
||||
database_cleaner (0.7.1)
|
||||
diff-lcs (1.1.3)
|
||||
fastthread (1.0.7)
|
||||
ffi (1.0.11)
|
||||
flexmock (0.9.0)
|
||||
gem_plugin (0.2.3)
|
||||
gherkin (2.4.11)
|
||||
gherkin (2.7.7)
|
||||
json (>= 1.4.6)
|
||||
has_many_polymorphs (2.13)
|
||||
activerecord
|
||||
highline (1.5.2)
|
||||
hoe (2.12.0)
|
||||
hoe (2.13.1)
|
||||
rake (~> 0.8)
|
||||
hpricot (0.8.4)
|
||||
htmlentities (4.3.0)
|
||||
httpclient (2.2.1)
|
||||
hpricot (0.8.6)
|
||||
htmlentities (4.3.1)
|
||||
httpclient (2.2.4)
|
||||
i18n (0.6.0)
|
||||
json (1.5.3)
|
||||
json (1.6.5)
|
||||
launchy (2.0.5)
|
||||
addressable (~> 2.2.6)
|
||||
linecache (0.46)
|
||||
rbx-require-relative (> 0.0.4)
|
||||
mail (2.3.0)
|
||||
mail (2.4.1)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
memory_test_fix (0.1.3)
|
||||
mime-types (1.16)
|
||||
mime-types (1.17.2)
|
||||
mongrel (1.1.5)
|
||||
cgi_multipart_eof_fix (>= 2.4)
|
||||
daemons (>= 1.0.3)
|
||||
|
|
@ -75,7 +80,7 @@ GEM
|
|||
multi_json (1.0.4)
|
||||
mysql (2.8.1)
|
||||
nokogiri (1.4.7)
|
||||
polyglot (0.3.2)
|
||||
polyglot (0.3.3)
|
||||
rack (1.1.0)
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
|
|
@ -104,18 +109,18 @@ GEM
|
|||
actionpack (~> 2.3.0)
|
||||
activerecord (~> 2.3.0)
|
||||
activesupport (~> 2.3.0)
|
||||
rubyzip (0.9.5)
|
||||
rubyzip (0.9.6.1)
|
||||
sanitize (1.2.1)
|
||||
nokogiri (~> 1.4.1)
|
||||
selenium-webdriver (2.17.0)
|
||||
childprocess (>= 0.2.5)
|
||||
selenium-webdriver (2.14.0)
|
||||
childprocess (>= 0.2.1)
|
||||
ffi (~> 1.0.9)
|
||||
multi_json (~> 1.0.4)
|
||||
rubyzip
|
||||
soap4r (1.5.8)
|
||||
httpclient (>= 2.1.1)
|
||||
sqlite3 (1.3.4)
|
||||
term-ansicolor (1.0.6)
|
||||
sqlite3 (1.3.5)
|
||||
term-ansicolor (1.0.7)
|
||||
test-unit (1.2.3)
|
||||
hoe (>= 1.5.1)
|
||||
thoughtbot-factory_girl (1.2.2)
|
||||
|
|
@ -125,7 +130,7 @@ GEM
|
|||
will_paginate (2.3.16)
|
||||
xpath (0.1.4)
|
||||
nokogiri (~> 1.3)
|
||||
yard (0.7.3)
|
||||
yard (0.7.5)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
|
@ -137,6 +142,7 @@ DEPENDENCIES
|
|||
acts_as_list (~> 0.1.4)
|
||||
bcrypt-ruby (~> 2.1.4)
|
||||
capybara (>= 0.3.5)
|
||||
capybara-screenshot
|
||||
capybara-webkit
|
||||
cucumber-rails (~> 0.3.2)
|
||||
database_cleaner (>= 0.5.0)
|
||||
|
|
@ -146,6 +152,7 @@ DEPENDENCIES
|
|||
hoe
|
||||
hpricot
|
||||
htmlentities (~> 4.3.0)
|
||||
launchy
|
||||
mail
|
||||
memory_test_fix (~> 0.1.3)
|
||||
mongrel
|
||||
|
|
@ -159,6 +166,7 @@ DEPENDENCIES
|
|||
rubycas-client (~> 2.2.1)
|
||||
rubyjedi-actionwebservice
|
||||
sanitize (~> 1.2.1)
|
||||
selenium-webdriver (= 2.14.0)
|
||||
soap4r (~> 1.5.8)
|
||||
sqlite3
|
||||
test-unit (= 1.2.3)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|||
<%= remote_toggle_checkbox(todo) %>
|
||||
<%= remote_edit_button(todo) unless suppress_edit_button %>
|
||||
<ul class="sf-menu sf-item-menu">
|
||||
<li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :id => "todo-submenu", :alt=> "" %>
|
||||
<li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :class => "todo-submenu", :alt=> "" %>
|
||||
<ul id="ul<%= dom_id(todo) %>">
|
||||
<li><%= remote_delete_menu_item(todo) %></li>
|
||||
<% unless todo.completed? || todo.deferred? -%>
|
||||
|
|
|
|||
26
config/environments/selenium.rb
Normal file
26
config/environments/selenium.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Edit at your own peril - it's recommended to regenerate this file
|
||||
# in the future when you upgrade to a newer version of Cucumber.
|
||||
|
||||
# IMPORTANT: Setting config.cache_classes to false is known to
|
||||
# break Cucumber's use_transactional_fixtures method.
|
||||
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
|
||||
config.cache_classes = true
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.action_controller.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Unique cookies
|
||||
config.action_controller.session = { :key => 'TracksSelenium' }
|
||||
|
||||
107
config/initializers/mongrel_workaround.rb
Normal file
107
config/initializers/mongrel_workaround.rb
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# adapted from https://gist.github.com/471663 and https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238
|
||||
|
||||
def check_mongrel_around_115
|
||||
begin
|
||||
# Gem.available? is deprecated from rubygems 1.8.2
|
||||
Gem::Specification::find_by_name "mongrel", "~>1.1.5"
|
||||
rescue
|
||||
if RUBY_VERSION[2] == "9"
|
||||
false
|
||||
else
|
||||
Gem.available?('mongrel', '~>1.1.5')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mongrel115 = check_mongrel_around_115
|
||||
|
||||
if Rails.version == '2.3.14' && mongrel115 && self.class.const_defined?(:Mongrel)
|
||||
|
||||
# Pulled right from latest rack. Old looked like this in 1.1.0 version.
|
||||
#
|
||||
# def [](k)
|
||||
# super(@names[k] ||= @names[k.downcase])
|
||||
# end
|
||||
#
|
||||
module Rack
|
||||
module Utils
|
||||
class HeaderHash < Hash
|
||||
def [](k)
|
||||
super(@names[k]) if @names[k]
|
||||
super(@names[k.downcase])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Code pulled from the ticket above.
|
||||
#
|
||||
class Mongrel::CGIWrapper
|
||||
def header_with_rails_fix(options = 'text/html')
|
||||
@head['cookie'] = options.delete('cookie').flatten.map { |v| v.sub(/^\n/,'') } if options.class != String and options['cookie']
|
||||
header_without_rails_fix(options)
|
||||
end
|
||||
alias_method_chain :header, :rails_fix
|
||||
end
|
||||
|
||||
# Pulled right from 2.3.10 ActionPack. Simple diff was
|
||||
#
|
||||
# if headers.include?('Set-Cookie')
|
||||
# headers['cookie'] = headers.delete('Set-Cookie').split("\n")
|
||||
# end
|
||||
#
|
||||
# to
|
||||
#
|
||||
# if headers['Set-Cookie']
|
||||
# headers['cookie'] = headers.delete('Set-Cookie').split("\n")
|
||||
# end
|
||||
#
|
||||
module ActionController
|
||||
class CGIHandler
|
||||
def self.dispatch_cgi(app, cgi, out = $stdout)
|
||||
env = cgi.__send__(:env_table)
|
||||
env.delete "HTTP_CONTENT_LENGTH"
|
||||
|
||||
cgi.stdinput.extend ProperStream
|
||||
|
||||
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
|
||||
|
||||
env.update({
|
||||
"rack.version" => [0,1],
|
||||
"rack.input" => cgi.stdinput,
|
||||
"rack.errors" => $stderr,
|
||||
"rack.multithread" => false,
|
||||
"rack.multiprocess" => true,
|
||||
"rack.run_once" => false,
|
||||
"rack.url_scheme" => ["yes", "on", "1"].include?(env["HTTPS"]) ? "https" : "http"
|
||||
})
|
||||
|
||||
env["QUERY_STRING"] ||= ""
|
||||
env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
|
||||
env["REQUEST_PATH"] ||= "/"
|
||||
env.delete "PATH_INFO" if env["PATH_INFO"] == ""
|
||||
|
||||
status, headers, body = app.call(env)
|
||||
begin
|
||||
out.binmode if out.respond_to?(:binmode)
|
||||
out.sync = false if out.respond_to?(:sync=)
|
||||
|
||||
headers['Status'] = status.to_s
|
||||
|
||||
if headers['Set-Cookie']
|
||||
headers['cookie'] = headers.delete('Set-Cookie').split("\n")
|
||||
end
|
||||
|
||||
out.write(cgi.header(headers))
|
||||
|
||||
body.each { |part|
|
||||
out.write part
|
||||
out.flush if out.respond_to?(:flush)
|
||||
}
|
||||
ensure
|
||||
body.close if body.respond_to?(:close)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@ Feature: Edit a next action from every page
|
|||
And I have logged in as "testuser" with password "secret"
|
||||
And I have a context called "@pc"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can toggle the star of a todo
|
||||
Given I have a todo "star me" in the context "@home"
|
||||
When I go to the home page
|
||||
|
|
@ -19,7 +19,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tag page for "starred"
|
||||
Then I should see "star me"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
Scenario: I can delete a todo
|
||||
Given I have a todo "delete me" in the context "@home"
|
||||
When I go to the home page
|
||||
|
|
@ -27,8 +27,10 @@ Feature: Edit a next action from every page
|
|||
When I delete the action "delete me"
|
||||
Then I should not see "delete me"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
Scenario: Removing the last todo in context will hide context
|
||||
# the go to home page before the last delete was necessary because webkit was not able to
|
||||
# hit the submenu arrow
|
||||
Given I have a todo "delete me" in the context "@home"
|
||||
When I go to the home page
|
||||
Then I should see the container for context "@home"
|
||||
|
|
@ -40,12 +42,15 @@ Feature: Edit a next action from every page
|
|||
Then I should see the container for context "@home"
|
||||
When I edit the context of "delete me" to "@pc"
|
||||
Then I should not see the container for context "@home"
|
||||
When I delete the todo "delete me"
|
||||
And I should see the container for context "@pc"
|
||||
And I should see "delete me" in the context container for "@pc"
|
||||
When I go to the home page
|
||||
And I delete the todo "delete me"
|
||||
Then I should not see "delete me"
|
||||
And I should not see the container for context "@home"
|
||||
And I should not see the container for context "@pc"
|
||||
|
||||
@selenium
|
||||
@javascript @selenium_only
|
||||
Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo
|
||||
Given I have a context called "@home"
|
||||
And I have a project "my project" that has the following todos
|
||||
|
|
@ -53,91 +58,91 @@ Feature: Edit a next action from every page
|
|||
| @home | first action | test, bla |
|
||||
| @home | second action | bla |
|
||||
When I go to the <page>
|
||||
Then I should not see "<empty message>"
|
||||
Then I should not see empty message for <page type> todos
|
||||
And I should see "first action"
|
||||
When I delete the todo "first action"
|
||||
Then I should not see "<empty message>"
|
||||
Then I should not see empty message for <page type> todos
|
||||
When I delete the todo "second action"
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| "my project" project | Currently there are no incomplete actions in this project |
|
||||
| context page for "@home" | Currently there are no incomplete actions in this context |
|
||||
| tag page for "bla" | No actions found |
|
||||
| page | page type |
|
||||
| "my project" project | project |
|
||||
| context page for "@home" | context |
|
||||
| tag page for "bla" | tag |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can mark an active todo complete and it will update empty messages
|
||||
Given I have a context called "visible context"
|
||||
And I have a project called "visible project"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
When I submit a new action with description "visible todo" to project "visible project" with tags "starred" in the context "visible context"
|
||||
Then I should see "visible todo"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> todos
|
||||
When I mark "visible todo" as complete
|
||||
And I should see "<empty message>"
|
||||
And I should see empty message for <page type> todos
|
||||
And I should see "visible todo" in the completed container
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| "visible project" project | Currently there are no incomplete actions in this project |
|
||||
| home page | Currently there are no incomplete actions |
|
||||
| tag page for "starred" | No actions found |
|
||||
| context page for "visible context" | Currently there are no incomplete actions in this context |
|
||||
| page | page type |
|
||||
| "visible project" project | project |
|
||||
| home page | home |
|
||||
| tag page for "starred" | tag |
|
||||
| context page for "visible context" | context |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can mark a deferred todo complete and it will update empty messages
|
||||
Given I have a context called "visible context"
|
||||
And I have a project called "visible project"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> deferred todos
|
||||
When I submit a new deferred action with description "visible todo" to project "visible project" with tags "starred" in the context "visible context"
|
||||
Then I should see "visible todo"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> deferred todos
|
||||
When I mark "visible todo" as complete
|
||||
And I should see "<empty message>"
|
||||
And I should see empty message for <page type> deferred todos
|
||||
And I should see "visible todo" in the completed container
|
||||
|
||||
Scenarios:
|
||||
| page | empty message |
|
||||
| tag page for "starred" | Currently there are no deferred or pending actions |
|
||||
| "visible project" project | Currently there are no deferred or pending actions |
|
||||
| page | page type |
|
||||
| tag page for "starred" | tag |
|
||||
| "visible project" project | project |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can mark a completed todo active and it will update empty messages and context containers
|
||||
Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
And I should not see the container for context "visible context"
|
||||
And I should not see "<empty completed message>"
|
||||
And I should not see empty message for <page type> completed todos
|
||||
When I mark the complete todo "visible todo" active
|
||||
Then I should see the container for context "visible context"
|
||||
And I should see "<empty completed message>"
|
||||
And I should see empty message for <page type> completed todos
|
||||
And I should see "visible todo" in the context container for "visible context"
|
||||
And I should not see "<empty message>"
|
||||
And I should not see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message | empty completed message |
|
||||
| tag page for "starred" | No actions found | Currently there are no completed actions |
|
||||
| home page | No actions found | Currently there are no completed actions |
|
||||
| page | page type |
|
||||
| tag page for "starred" | tag |
|
||||
| home page | home |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without context containers
|
||||
Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context"
|
||||
When I go to the <page>
|
||||
Then I should see "<empty message>"
|
||||
And I should not see "<empty completed message>"
|
||||
Then I should see empty message for <page type> todos
|
||||
And I should not see empty message for <page type> completed todos
|
||||
When I mark the complete todo "visible todo" active
|
||||
And I should see "<empty completed message>"
|
||||
And I should not see "<empty message>"
|
||||
And I should see empty message for <page type> completed todos
|
||||
And I should not see empty message for <page type> todos
|
||||
|
||||
Scenarios:
|
||||
| page | empty message | empty completed message |
|
||||
| context page for "visible context" | Currently there are no incomplete actions in this context | Currently there are no completed actions |
|
||||
| "visible project" project | Currently there are no incomplete actions in this project | Currently there are no completed actions |
|
||||
| page | page type |
|
||||
| context page for "visible context" | context |
|
||||
| "visible project" project | project |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can edit a todo to change its description
|
||||
# do for more pages, see #1094
|
||||
Given I have a todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context" that is due next week
|
||||
|
|
@ -154,7 +159,7 @@ Feature: Edit a next action from every page
|
|||
| tag page for "starred" |
|
||||
| calendar page |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: I can edit a todo to move it to another context
|
||||
Given I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following todos
|
||||
|
|
@ -172,7 +177,7 @@ Feature: Edit a next action from every page
|
|||
| home page |
|
||||
| tag page for "bla" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to another context in tickler page
|
||||
Given I have a context called "@laptop"
|
||||
And I have a project "my project" that has the following deferred todos
|
||||
|
|
@ -185,7 +190,7 @@ Feature: Edit a next action from every page
|
|||
Then I should not see "first action" in the context container for "@pc"
|
||||
Then I should see "first action" in the context container for "@laptop"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to another project
|
||||
Given I have a project called "project one"
|
||||
And I have a project "project two" with 1 todos
|
||||
|
|
@ -195,7 +200,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the "project one" project
|
||||
Then I should see "todo 1"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit a todo to move it to the tickler
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
|
|
@ -204,7 +209,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can defer a todo
|
||||
When I go to the home page
|
||||
And I submit a new action with description "start later" in the context "@pc"
|
||||
|
|
@ -213,7 +218,7 @@ Feature: Edit a next action from every page
|
|||
When I go to the tickler page
|
||||
Then I should see "start later"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can make a project from a todo
|
||||
When I go to the home page
|
||||
And I submit a new action with description "buy mediacenter" in the context "@pc"
|
||||
|
|
@ -223,16 +228,16 @@ Feature: Edit a next action from every page
|
|||
When I go to the projects page
|
||||
Then I should see "buy mediacenter"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can show the notes of a todo
|
||||
Given I have a todo "read the notes" with notes "several things to read"
|
||||
When I go to the home page
|
||||
Then I should see "read the notes"
|
||||
And I should not see "several things to read"
|
||||
And I should not see the notes of "read the notes"
|
||||
When I open the notes of "read the notes"
|
||||
Then I should see "several things to read"
|
||||
Then I should see the notes of "read the notes"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can tag a todo
|
||||
Given I have a todo "tag me"
|
||||
When I go to the home page
|
||||
|
|
@ -248,7 +253,7 @@ Feature: Edit a next action from every page
|
|||
When I follow "taga"
|
||||
Then I should be on the tag page for "taga"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: I can edit the tags of a todo
|
||||
Given I have a todo "tag you are it" in context "@tags" with tags "taga, tagb"
|
||||
When I go to the home page
|
||||
|
|
@ -258,7 +263,7 @@ Feature: Edit a next action from every page
|
|||
And I should see "tagb"
|
||||
And I should see "tagc"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario Outline: Editing the context of a todo to a new context will show new context
|
||||
Given I have a todo "moving" in context "@pc" with tags "tag"
|
||||
When I go to the <page>
|
||||
|
|
@ -270,14 +275,14 @@ Feature: Edit a next action from every page
|
|||
| home page |
|
||||
| tag page for "tag" |
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Editing the context of a todo in the tickler to a new context will show new context
|
||||
Given I have a deferred todo "moving" in context "@pc" with tags "tag"
|
||||
When I go to the tickler page
|
||||
And I edit the context of "moving" to "@new"
|
||||
And I should see the container for context "@new"
|
||||
|
||||
@selenium
|
||||
@javascript
|
||||
Scenario: Making an error when editing a todo will show error message
|
||||
Given I have a todo "test"
|
||||
When I go to the home page
|
||||
|
|
|
|||
|
|
@ -19,24 +19,19 @@ Then /^I should not see the context "([^"]*)"$/ do |context_name|
|
|||
context.should_not be_nil
|
||||
|
||||
xpath = "//div[@id='c#{context.id}']"
|
||||
|
||||
if selenium.is_element_present(xpath) # only check visibility if it is present
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_visible("xpath=#{xpath}")
|
||||
end
|
||||
end
|
||||
page.should_not have_xpath(xpath, :visible => true)
|
||||
end
|
||||
|
||||
Then /^I should not see the container for context "([^"]*)"$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should not see the context container for "([^"]*)"$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^the container for the context "([^"]*)" should not be visible$/ do |context_name|
|
||||
Then "I should not see the context \"#{context_name}\""
|
||||
step "I should not see the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should see the container for context "([^"]*)"$/ do |context_name|
|
||||
|
|
@ -48,7 +43,7 @@ Then /^I should see the container for context "([^"]*)"$/ do |context_name|
|
|||
end
|
||||
|
||||
Then /^the container for the context "([^"]*)" should be visible$/ do |context_name|
|
||||
Then "I should see the container for context \"#{context_name}\""
|
||||
step "I should see the container for context \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_description, context_name|
|
||||
|
|
@ -57,7 +52,7 @@ Then /^I should see "([^"]*)" in the context container for "([^"]*)"$/ do |todo_
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
xpath = "//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
page.should have_xpath(xpath)
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +62,7 @@ Then /^I should not see "([^"]*)" in the context container for "([^"]*)"$/ do |t
|
|||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
xpath = "//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
|
||||
page.should_not have_xpath(xpath)
|
||||
end
|
||||
|
||||
|
|
@ -168,7 +163,7 @@ Then /^I should see "([^"]*)" in the active recurring todos container$/ do |repe
|
|||
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
|
||||
selenium.is_visible(xpath).should be_true
|
||||
else
|
||||
Then "I should not see \"#{repeat_pattern}\""
|
||||
step "I should not see \"#{repeat_pattern}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -180,7 +175,7 @@ Then /^I should not see "([^"]*)" in the completed recurring todos container$/ d
|
|||
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
|
||||
selenium.is_visible(xpath).should be_true
|
||||
else
|
||||
Then "I should not see \"#{repeat_pattern}\""
|
||||
step "I should not see \"#{repeat_pattern}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Given /^there exists an active context called "([^"]*)" for user "([^"]*)"$/ do
|
|||
end
|
||||
|
||||
Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{login}\""
|
||||
end
|
||||
|
||||
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
|
||||
|
|
@ -20,20 +20,20 @@ Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |
|
|||
end
|
||||
|
||||
Given /^I have a context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have an active context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have a hidden context called "([^\"]*)"$/ do |context_name|
|
||||
Given "there exists a hidden context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a hidden context called \"#{context_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have the following contexts:$/ do |table|
|
||||
table.hashes.each do |context|
|
||||
Given 'I have a context called "'+context[:context]+'"'
|
||||
step 'I have a context called "'+context[:context]+'"'
|
||||
@context.hide = context[:hide] == "true" unless context[:hide].blank?
|
||||
# acts_as_list puts the last added context at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
|
|
@ -43,7 +43,7 @@ Given /^I have the following contexts:$/ do |table|
|
|||
end
|
||||
|
||||
Given /^I have the following contexts$/ do |table|
|
||||
Given("I have the following contexts:", table)
|
||||
step("I have the following contexts:", table)
|
||||
end
|
||||
|
||||
Given /^I have a context "([^\"]*)" with (.*) actions$/ do |context_name, number_of_actions|
|
||||
|
|
@ -60,13 +60,29 @@ When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
|
|||
end
|
||||
|
||||
Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
|
||||
Then "I should see \"#{context_name}\""
|
||||
step "I should see \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^he should see that a context named "([^\"]*)" is present$/ do |context_name|
|
||||
Then "I should see \"#{context_name}\""
|
||||
step "I should see \"#{context_name}\""
|
||||
end
|
||||
|
||||
Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name|
|
||||
Then "I should not see \"#{context_name} (\""
|
||||
end
|
||||
step "I should not see \"#{context_name} (\""
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for context todos/ do
|
||||
find("div#c#{@context.id}empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for context todos/ do
|
||||
find("div#c#{@context.id}empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for context completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
When /^I should see empty message for context completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password|
|
||||
When "I go to the login page"
|
||||
step "I go to the login page"
|
||||
fill_in "Login", :with => username
|
||||
fill_in "Password", :with => password
|
||||
uncheck "Stay logged in:"
|
||||
|
|
@ -28,5 +28,5 @@ When /^my session expires$/ do
|
|||
end
|
||||
|
||||
When /^I log out of Tracks$/ do
|
||||
When "I go to the logout page"
|
||||
step "I go to the logout page"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Given /^I have a project "([^\"]*)" with ([0-9]+) todos$/ do |project_name, num_
|
|||
end
|
||||
|
||||
Given /^I have a project "([^\"]*)" with ([0-9]+) deferred todos$/ do |project_name, num_todos|
|
||||
Given "I have a project \"#{project_name}\" with #{num_todos} todos"
|
||||
step "I have a project \"#{project_name}\" with #{num_todos} todos"
|
||||
@todos.each do |todo|
|
||||
todo.show_from = Time.zone.now + 1.week
|
||||
todo.save!
|
||||
|
|
@ -39,15 +39,15 @@ end
|
|||
|
||||
Given /^there exists a project called "([^"]*)" for user "([^"]*)"$/ do |project_name, login|
|
||||
# TODO: regexp change to integrate this with the previous since only 'called' is different
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{login}\""
|
||||
end
|
||||
|
||||
Given /^I have a project called "([^"]*)"$/ do |project_name|
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" with a default context of "([^"]*)"$/ do |project_name, context_name|
|
||||
Given "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
step "there exists a project \"#{project_name}\" for user \"#{@current_user.login}\""
|
||||
context = @current_user.contexts.create!(:name => context_name)
|
||||
@project.default_context = context
|
||||
@project.save!
|
||||
|
|
@ -55,7 +55,7 @@ end
|
|||
|
||||
Given /^I have the following projects:$/ do |table|
|
||||
table.hashes.each do |project|
|
||||
Given 'I have a project called "'+project[:project_name]+'"'
|
||||
step 'I have a project called "'+project[:project_name]+'"'
|
||||
# acts_as_list puts the last added project at the top, but we want it
|
||||
# at the bottom to be consistent with the table in the scenario
|
||||
@project.move_to_bottom
|
||||
|
|
@ -64,7 +64,7 @@ Given /^I have the following projects:$/ do |table|
|
|||
end
|
||||
|
||||
Given /^I have a completed project called "([^"]*)"$/ do |project_name|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "I have a project called \"#{project_name}\""
|
||||
@project.complete!
|
||||
@project.reload
|
||||
assert @project.completed?
|
||||
|
|
@ -72,7 +72,7 @@ end
|
|||
|
||||
Given /^I have (\d+) completed projects$/ do |number_of_projects|
|
||||
1.upto number_of_projects.to_i do |i|
|
||||
Given "I have a completed project called \"Project #{i}\""
|
||||
step "I have a completed project called \"Project #{i}\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -166,6 +166,30 @@ When /^I edit the default context to "([^"]*)"$/ do |default_context|
|
|||
end
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project todos/ do
|
||||
find("div#p#{@project.id}empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for project todos/ do
|
||||
find("div#p#{@project.id}empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project deferred todos/ do
|
||||
find("div#tickler-empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for project deferred todos/ do
|
||||
find("div#tickler-empty-nd").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for project completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
When /^I should see empty message for project completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I edit the default tags to "([^"]*)"$/ do |default_tags|
|
||||
click_link "link_edit_project_#{@project.id}"
|
||||
|
||||
|
|
@ -188,13 +212,13 @@ end
|
|||
When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
|
||||
@project = @current_user.projects.find_by_name(project_current_name)
|
||||
@project.should_not be_nil
|
||||
When "I edit the project name to \"#{project_new_name}\""
|
||||
step "I edit the project name to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
|
||||
@project = @current_user.projects.find_by_name(project_current_name)
|
||||
@project.should_not be_nil
|
||||
When "I try to edit the project name to \"#{project_new_name}\""
|
||||
step "I try to edit the project name to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name|
|
||||
|
|
@ -222,17 +246,17 @@ When /^I edit the project settings$/ do
|
|||
end
|
||||
|
||||
Then /^I should not be able to change the project name in place$/ do
|
||||
When "I click to edit the project name in place"
|
||||
found = selenium.element? "xpath=//div[@id='project_name']/form/input"
|
||||
!found
|
||||
step "I click to edit the project name in place"
|
||||
found = selenium.element? "xpath=//div[@id='project_name']/form/input"
|
||||
!found
|
||||
end
|
||||
|
||||
When /^I close the project settings$/ do
|
||||
@project.should_not be_nil
|
||||
click_link "Cancel"
|
||||
wait_for :wait_for => :effects , :javascript_framework => 'jquery' do
|
||||
true
|
||||
end
|
||||
@project.should_not be_nil
|
||||
click_link "Cancel"
|
||||
wait_for :wait_for => :effects , :javascript_framework => 'jquery' do
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -319,5 +343,5 @@ Then /^the project title should be "(.*)"$/ do |title|
|
|||
end
|
||||
|
||||
Then /^I should see the project name is "([^"]*)"$/ do |project_name|
|
||||
Then "the project title should be \"#{project_name}\""
|
||||
step "the project title should be \"#{project_name}\""
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, cont
|
|||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |description, context_name, tag_names|
|
||||
Given "I have a todo \"#{description}\" in the context \"#{context_name}\""
|
||||
step "I have a todo \"#{description}\" in the context \"#{context_name}\""
|
||||
@todo.tag_with(tag_names)
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -37,24 +37,24 @@ Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "
|
|||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)"$/ do |description|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
step "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
end
|
||||
|
||||
Given /^I have the following todos:$/ do |table|
|
||||
table.hashes.each do | todo |
|
||||
Given "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
|
||||
step "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
|
||||
end
|
||||
end
|
||||
|
||||
Given /^I have a todo "([^"]*)" with notes "([^"]*)"$/ do |description, notes|
|
||||
Given "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
step "I have a todo \"#{description}\" in the context \"Context A\""
|
||||
@todo.notes = notes
|
||||
@todo.save!
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) todos$/ do |count|
|
||||
count.to_i.downto 1 do |i|
|
||||
Given "I have a todo \"todo #{i}\" in the context \"Context A\""
|
||||
step "I have a todo \"todo #{i}\" in the context \"Context A\""
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags
|
|||
end
|
||||
|
||||
Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)" that is due next week$/ do |action_description, project_name, tags, context_name|
|
||||
Given "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
@todo.due = @current_user.time + 1.week
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -91,11 +91,11 @@ Given /^I have a deferred todo "([^"]*)" in the context "([^"]*)"$/ do |descript
|
|||
end
|
||||
|
||||
Given /^I have a deferred todo "([^"]*)"$/ do |description|
|
||||
Given "I have a deferred todo \"#{description}\" in the context \"context B\""
|
||||
step "I have a deferred todo \"#{description}\" in the context \"context B\""
|
||||
end
|
||||
|
||||
Given /^I have a deferred todo "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |action_description, context_name, tag_list|
|
||||
Given "I have a todo \"#{action_description}\" in context \"#{context_name}\" with tags \"#{tag_list}\""
|
||||
step "I have a todo \"#{action_description}\" in context \"#{context_name}\" with tags \"#{tag_list}\""
|
||||
@todo.show_from = @current_user.time + 1.week
|
||||
@todo.save!
|
||||
end
|
||||
|
|
@ -118,13 +118,13 @@ Given /^I have ([0-9]+) completed todos in project "([^"]*)" in context "([^"]*)
|
|||
end
|
||||
|
||||
Given /^I have a completed todo "([^"]*)" in project "([^"]*)" in context "([^"]*)"$/ do |action_description, project_name, context_name|
|
||||
Given "I have 1 completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
step "I have 1 completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
@todos[0].description = action_description
|
||||
@todos[0].save!
|
||||
end
|
||||
|
||||
Given /^I have (\d+) completed todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |count, project_name, context_name, tags|
|
||||
Given "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
step "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\""
|
||||
@todos.each { |t| t.tag_with(tags); t.save! }
|
||||
end
|
||||
|
||||
|
|
@ -139,29 +139,29 @@ Given /^I have ([0-9]+) completed todos in context "([^"]*)"$/ do |count, contex
|
|||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos$/ do |count|
|
||||
Given "I have a context called \"context D\""
|
||||
Given "I have #{count} completed todos in context \"context D\""
|
||||
step "I have a context called \"context D\""
|
||||
step "I have #{count} completed todos in context \"context D\""
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos with a note$/ do |count|
|
||||
Given "I have #{count} completed todos"
|
||||
step "I have #{count} completed todos"
|
||||
@todos.each { |t| t.notes = "note #{t.id}"; t.save!}
|
||||
end
|
||||
|
||||
Given /^I have ([0-9]+) completed todos with a note in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |count, project_name, context_name, tags|
|
||||
Given "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tags}\""
|
||||
step "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tags}\""
|
||||
@todos.each { |t| t.notes = "note #{t.id}"; t.save! }
|
||||
end
|
||||
|
||||
Given /^I have a completed todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |action_description, project_name, tags, context_name|
|
||||
Given "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\""
|
||||
@todo.complete!
|
||||
end
|
||||
|
||||
####### PROJECT WITH TODOS ######
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "I have a project called \"#{project_name}\""
|
||||
@project.should_not be_nil
|
||||
todos.hashes.each do |todo|
|
||||
context = @current_user.contexts.find_by_name(todo[:context])
|
||||
|
|
@ -181,7 +181,7 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
|
|||
end
|
||||
|
||||
Given /^I have a project "([^"]*)" that has the following deferred todos$/ do |project_name, todos|
|
||||
Given "I have a project called \"#{project_name}\""
|
||||
step "I have a project called \"#{project_name}\""
|
||||
@project.should_not be_nil
|
||||
todos.hashes.each do |todo|
|
||||
context = @current_user.contexts.find_by_name(todo[:context])
|
||||
|
|
@ -255,10 +255,9 @@ When /^I submit a new action with description "([^"]*)" to project "([^"]*)" wit
|
|||
end
|
||||
|
||||
When /^I submit a new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, context_name|
|
||||
When "I submit a new action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
step "I submit a new action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
|
||||
When /^I submit a new action with description "([^"]*)" in the context "([^"]*)"$/ do |description, context_name|
|
||||
fill_in "todo[description]", :with => description
|
||||
|
||||
|
|
@ -302,7 +301,7 @@ When /^I submit a new deferred action with description "([^"]*)" to project "([^
|
|||
end
|
||||
|
||||
When /^I submit a deferred new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, context_name|
|
||||
When "I submit a new deferred action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
step "I submit a new deferred action with description \"#{description}\" to project \"#{project_name}\" with tags \"\" in the context \"#{context_name}\""
|
||||
end
|
||||
|
||||
####### submitting using sidebar form: MULTIPLE ACTIONS #######
|
||||
|
|
@ -320,7 +319,7 @@ When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "(
|
|||
end
|
||||
|
||||
When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags|
|
||||
When "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\""
|
||||
step "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\""
|
||||
submit_multiple_next_action_form
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ When /^I mark "([^"]*)" as uncompleted$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
check "mark_complete_#{todo.id}"
|
||||
uncheck "mark_complete_#{todo.id}"
|
||||
|
||||
wait_for_ajax
|
||||
end
|
||||
|
||||
When /^I mark the complete todo "([^"]*)" active$/ do |action_description|
|
||||
When "I mark \"#{action_description}\" as uncompleted"
|
||||
step "I mark \"#{action_description}\" as uncompleted"
|
||||
end
|
||||
|
||||
####### (UN)STARRING #######
|
||||
|
|
@ -31,14 +31,15 @@ When /^I star the action "([^"]*)"$/ do |action_description|
|
|||
xpath_unstarred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']"
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
|
||||
|
||||
selenium.is_element_present(xpath_unstarred).should be_true
|
||||
page.should have_xpath(xpath_unstarred)
|
||||
|
||||
star_img = "//img[@id='star_img_#{todo.id}']"
|
||||
selenium.click(star_img, :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(xpath_starred)
|
||||
end
|
||||
page.find(:xpath, star_img).click
|
||||
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
|
||||
page.should have_xpath(xpath_starred)
|
||||
end
|
||||
|
||||
When /^I unstar the action "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -72,11 +73,11 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo
|
|||
end
|
||||
|
||||
When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |todo_name, context_new_name|
|
||||
When "I change the context_name field of \"#{todo_name}\" to \"#{context_new_name}\""
|
||||
step "I change the context_name field of \"#{todo_name}\" to \"#{context_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the project of "([^"]*)" to "([^"]*)"$/ do |todo_name, project_new_name|
|
||||
When "I change the project_name field of \"#{todo_name}\" to \"#{project_new_name}\""
|
||||
step "I change the project_name field of \"#{todo_name}\" to \"#{project_new_name}\""
|
||||
end
|
||||
|
||||
When /^I edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description|
|
||||
|
|
@ -92,7 +93,9 @@ When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_desc
|
|||
todo.should_not be_nil
|
||||
open_edit_form_for(todo)
|
||||
fill_in "todo_description", :with => new_description
|
||||
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
submit_button_xpath = "//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']"
|
||||
page.find(:xpath, submit_button_xpath).click
|
||||
wait_for_ajax
|
||||
# do not wait for form to disappear to be able to test failures
|
||||
end
|
||||
|
||||
|
|
@ -107,12 +110,12 @@ end
|
|||
|
||||
When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description|
|
||||
date = format_date(Time.zone.now + 1.day)
|
||||
When "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
step "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
end
|
||||
|
||||
When /^I edit the due date of "([^"]*)" to next month$/ do |action_description|
|
||||
date = format_date(Time.zone.now + 1.month)
|
||||
When "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
step "I edit the due date of \"#{action_description}\" to \"#{date}\""
|
||||
end
|
||||
|
||||
When /^I clear the due date of "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -141,23 +144,24 @@ When /^I remove the show from date from "([^"]*)"$/ do |action_description|
|
|||
todo.should_not be_nil
|
||||
|
||||
open_edit_form_for(todo)
|
||||
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
|
||||
page.find("//div[@id='edit_todo_#{todo.id}']//a[@id='show_from_x_todo_#{todo.id}']/img").click
|
||||
|
||||
submit_edit_todo_form(todo)
|
||||
end
|
||||
|
||||
When /^I clear the show from date of "([^"]*)"$/ do |action_description|
|
||||
When "I remove the show from date from \"#{action_description}\""
|
||||
step "I remove the show from date from \"#{action_description}\""
|
||||
end
|
||||
|
||||
When /^I defer "([^"]*)" for 1 day$/ do |action_description|
|
||||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
defer_todo_1day_button = "xpath=//a[@id='defer_1_todo_#{todo.id}']/img"
|
||||
selenium.click defer_todo_1day_button
|
||||
open_submenu_for(todo)
|
||||
click_link "defer_1_todo_#{todo.id}"
|
||||
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
When /^I edit the tags of "([^"]*)" to "([^"]*)"$/ do |action_description, tags|
|
||||
|
|
@ -173,19 +177,17 @@ When /^I make a project of "([^"]*)"$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
make_project_button = "xpath=//a[@id='to_project_todo_#{todo.id}']/img"
|
||||
selenium.click make_project_button
|
||||
open_submenu_for(todo)
|
||||
click_link "to_project_todo_#{todo.id}"
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
!selenium.is_element_present("//div[@id='line_todo_#{todo.id}']")
|
||||
end
|
||||
page.should have_no_css("div#line_todo_#{todo.id}")
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
####### THEN #######
|
||||
|
||||
Then /^I should see an error message$/ do
|
||||
error_block = "xpath=//form/div[@id='edit_error_status']"
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_element_present(error_block)
|
||||
end
|
||||
error_block = "//form/div[@id='edit_error_status']"
|
||||
page.find(:xpath, error_block).should_not be_nil
|
||||
end
|
||||
|
|
@ -6,7 +6,7 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
|
|||
|
||||
handle_js_confirm do
|
||||
open_submenu_for(todo)
|
||||
find("a#delete_todo_#{todo.id}").click
|
||||
click_link "delete_todo_#{todo.id}"
|
||||
end
|
||||
get_confirm_text.should == "Are you sure that you want to delete the action '#{todo.description}'?"
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ When /^I delete the action "([^"]*)"$/ do |action_description|
|
|||
end
|
||||
|
||||
When /^I delete the todo "([^"]*)"$/ do |action_description|
|
||||
When "I delete the action \"#{action_description}\""
|
||||
step "I delete the action \"#{action_description}\""
|
||||
end
|
||||
|
||||
####### Notes #######
|
||||
|
|
@ -24,11 +24,10 @@ When /^I open the notes of "([^"]*)"$/ do |action_description|
|
|||
todo = @current_user.todos.find_by_description(action_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
show_notes_img = "xpath=//div[@id='line_todo_#{todo.id}']/div/a/img"
|
||||
selenium.click show_notes_img
|
||||
page.find(:xpath, "//div[@id='line_todo_#{todo.id}']/div/a/img").click
|
||||
|
||||
wait_for :timeout => 5 do
|
||||
selenium.is_visible "//div[@id='notes_todo_#{todo.id}']"
|
||||
wait_until do
|
||||
page.find(:xpath, "//div[@id='notes_todo_#{todo.id}']").visible?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ Then /^I should see a starred "([^"]*)"$/ do |action_description|
|
|||
|
||||
xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']"
|
||||
|
||||
selenium.is_element_present(xpath_starred).should be_true
|
||||
page.should have_xpath(xpath_starred)
|
||||
end
|
||||
|
||||
Then /^I should see an unstarred "([^"]*)"$/ do |action_description|
|
||||
|
|
@ -178,3 +177,36 @@ Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |
|
|||
xpath = "//div[@id='completed_container']//a[@href='/todos/#{todo.id}.m']"
|
||||
response.should have_xpath xpath
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for home todos/ do
|
||||
find("div#no_todos_in_view").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for home todos/ do
|
||||
find("div#no_todos_in_view").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for home completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for home completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see the notes of "([^"]*)"$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
page.find("div#notes_todo_#{todo.id}").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see the notes of "([^"]*)"$/ do |todo_description|
|
||||
todo = @current_user.todos.find_by_description(todo_description)
|
||||
todo.should_not be_nil
|
||||
|
||||
page.find("div#notes_todo_#{todo.id}").should be_visible
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
Then /^I should not see empty message for tag todos/ do
|
||||
find("div#no_todos_in_view").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag todos/ do
|
||||
find("div#no_todos_in_view").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for tag completed todos$/ do
|
||||
find("div#empty-d").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag completed todos$/ do
|
||||
find("div#empty-d").should be_visible
|
||||
end
|
||||
|
||||
Then /^I should not see empty message for tag deferred todos$/ do
|
||||
find("div#tickler-empty-nd").should_not be_visible
|
||||
end
|
||||
|
||||
Then /^I should see empty message for tag deferred todos$/ do
|
||||
find("div#tickler-empty-nd").should be_visible
|
||||
end
|
||||
|
|
@ -31,6 +31,8 @@ end
|
|||
# steps to use the XPath syntax.
|
||||
Capybara.default_selector = :css
|
||||
|
||||
Capybara.prefer_visible_elements = true
|
||||
|
||||
# If you set this to false, any error raised from within your app will bubble
|
||||
# up to your step definition and out to cucumber unless you catch it somewhere
|
||||
# on the way. You can make Rails rescue errors and render error pages on a
|
||||
|
|
|
|||
|
|
@ -93,13 +93,16 @@ module NavigationHelpers
|
|||
feeds_path(options)
|
||||
when /the context page for "([^\"]*)" for user "([^\"]*)"/i
|
||||
@source_view = "context"
|
||||
context_path(User.find_by_login($2).contexts.find_by_name($1), options)
|
||||
@context = User.find_by_login($2).contexts.find_by_name($1)
|
||||
context_path(@context, options)
|
||||
when /the context page for "([^\"]*)"/i
|
||||
@source_view = "context"
|
||||
context_path(@current_user.contexts.find_by_name($1), options)
|
||||
@context = @current_user.contexts.find_by_name($1)
|
||||
context_path(@context, options)
|
||||
when /the "([^\"]*)" project for user "([^\"]*)"/i
|
||||
@source_view = "project"
|
||||
project_path(User.find_by_login($2).projects.find_by_name($1), options)
|
||||
@project = User.find_by_login($2).projects.find_by_name($1)
|
||||
project_path(@project, options)
|
||||
when /the "([^\"]*)" project/i
|
||||
@source_view = "project"
|
||||
@project = @current_user.projects.find_by_name($1)
|
||||
|
|
|
|||
19
features/support/selenium.rb
Normal file
19
features/support/selenium.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
if ENV["RAILS_ENV"] == "selenium"
|
||||
puts "Configuring to use Selenium with Webrat for Cucumber stories"
|
||||
Webrat.configure do |config|
|
||||
config.mode = :selenium
|
||||
|
||||
config.application_environment = :selenium
|
||||
# use only if you run a separate rails test server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.application_port = 3001
|
||||
|
||||
config.selenium_browser_startup_timeout = 30
|
||||
# use only if you run a separate selenium server instance and do not
|
||||
# want webrat to start one for you
|
||||
# config.selenium_server_address = "localhost"
|
||||
# config.selenium_server_port = "4444"
|
||||
end
|
||||
|
||||
Cucumber::Rails::World.use_transactional_fixtures = false
|
||||
end
|
||||
|
|
@ -7,7 +7,8 @@ module TracksStepHelper
|
|||
within("#todo-form-new-action") do
|
||||
click_button("todo_new_action_submit")
|
||||
end
|
||||
sleep(1)
|
||||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def submit_new_context_form
|
||||
|
|
@ -30,7 +31,6 @@ module TracksStepHelper
|
|||
click_button "submit_todo_#{todo.id}"
|
||||
end
|
||||
wait_for_form_to_go_away(todo)
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def format_date(date)
|
||||
|
|
@ -85,9 +85,17 @@ module TracksStepHelper
|
|||
end
|
||||
|
||||
def open_submenu_for(todo)
|
||||
within "div#line_todo_#{todo.id}" do
|
||||
find("img#todo-submenu").click
|
||||
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
||||
page.find(submenu_arrow).should be_visible
|
||||
|
||||
page.find(submenu_arrow).click
|
||||
|
||||
# wait for the submenu to be visible
|
||||
wait_until do
|
||||
page.find("div#line_todo_#{todo.id} ul#ultodo_#{todo.id}").visible?
|
||||
end
|
||||
|
||||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def context_list_find_index(context_name)
|
||||
|
|
|
|||
38
lib/tasks/cucumber-tracks.rake
Normal file
38
lib/tasks/cucumber-tracks.rake
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
||||
# It is recommended to regenerate this file in the future when you upgrade to a
|
||||
# newer version of cucumber-rails. Consider adding your own code to a new file
|
||||
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
||||
# files.
|
||||
|
||||
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
||||
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
||||
|
||||
begin
|
||||
require 'cucumber/rake/task'
|
||||
|
||||
namespace :cucumber do
|
||||
Cucumber::Rake::Task.new({:selenium => :env_to_selenium}, 'Run features that require selenium') do |t|
|
||||
t.binary = vendored_cucumber_bin
|
||||
t.fork = true # You may get faster startup if you set this to false
|
||||
t.profile = 'selenium'
|
||||
end
|
||||
|
||||
Cucumber::Rake::Task.new({:selenium_wip => :env_to_selenium}, 'Run unfinished features that require selenium') do |t|
|
||||
t.binary = vendored_cucumber_bin
|
||||
t.fork = true # You may get faster startup if you set this to false
|
||||
t.profile = 'selenium_wip'
|
||||
end
|
||||
|
||||
task :env_to_selenium => 'db:test:prepare' do
|
||||
ENV['RAILS_ENV'] = 'selenium'
|
||||
end
|
||||
|
||||
desc 'Run all features'
|
||||
task :all => [:ok, :wip, :selenium, :selenium_wip]
|
||||
end
|
||||
rescue LoadError
|
||||
desc 'cucumber rake task not available (cucumber not installed)'
|
||||
task :cucumber do
|
||||
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue