diff --git a/.gitignore b/.gitignore index c7069277..43a6ebc4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ /log/*.log /public/assets/ /tmp -config/database.yml config/deploy.rb config/site.yml db/data.yml diff --git a/.travis.yml b/.travis.yml index 89a6a66e..d58dddc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,21 @@ -language: ruby -sudo: false -cache: bundler -rvm: - - 1.9.3 - - 2.0.0 - - 2.1 - - 2.2 -addons: - firefox: 45.8.0esr +sudo: true +services: + - docker env: - - DATABASE_URL=mysql2://localhost/tracks_test - - DATABASE_URL=sqlite3:db/test.sqlite3 -bundler_args: --without development --jobs=3 --retry=3 -before_script: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" - - "cp config/site.yml.tmpl config/site.yml" -script: "if [[ $DATABASE_URL == mysql* ]]; then bundle exec rake ci:full; else bundle exec rake ci:lite; fi" + - DOCKER_COMPOSE_VERSION=1.21.0 +before_install: + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + - chmod 0755 docker-compose + - sudo mv docker-compose /usr/local/bin +install: true +script: "script/cibuild" +addons: + apt: + packages: + - docker-ce notifications: email: false - irc: - channels: "chat.freenode.net#tracks" - skip_join: true + #irc: + #channels: "chat.freenode.net#tracks" + #skip_join: true diff --git a/Dockerfile b/Dockerfile index 777369fc..e262e54b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,14 @@ -FROM phusion/passenger-ruby22:0.9.18 +FROM ruby:2.3 -WORKDIR /home/app/tracks +WORKDIR /app -# Install gems -COPY Gemfile Gemfile.lock ./ -RUN bundle install --without development test mysql therubyracer --jobs=3 +RUN touch /etc/app-env -# Install and configure the app -ENV RAILS_ENV=production -ENV DATABASE_URL=sqlite3:/var/tracks/database.sqlite3 -RUN mkdir /var/tracks && chmod 777 /var/tracks -RUN touch /var/tracks/database.sqlite3 && chown app.app /var/tracks/database.sqlite3 -COPY . ./ -COPY config/site.yml.tmpl /etc/tracks/config/site.yml -RUN ln -sf /etc/tracks/config/site.yml config/site.yml -RUN bundle exec rake assets:precompile -RUN chown -R app.app . +COPY Gemfile* /app/ +RUN bundle install -# Configure nginx -RUN echo "env DATABASE_URL;" > /etc/nginx/main.d/env.conf -RUN echo "\ -server {\n\ - listen 80 default_server;\n\ - server_name _;\n\ - root /home/app/tracks/public;\n\ - passenger_enabled on;\n\ - passenger_user app;\n\ - passenger_ruby /usr/bin/ruby2.2;\n\ -}" > /etc/nginx/sites-enabled/tracks.conf -RUN rm /etc/nginx/sites-enabled/default -RUN rm -f /etc/service/nginx/down +RUN mkdir /app/log -# Migrate the database on startup -RUN echo "#!/bin/sh\nbundle exec rake db:migrate" > /etc/my_init.d/90_tracks.sh -RUN chmod +x /etc/my_init.d/90_tracks.sh +COPY . /app/ -VOLUME ["/etc/tracks", "/var/tracks"] - -# Default command for baseimage-docker -CMD ["/sbin/my_init"] +EXPOSE 3000 diff --git a/Dockerfile.passenger b/Dockerfile.passenger new file mode 100644 index 00000000..777369fc --- /dev/null +++ b/Dockerfile.passenger @@ -0,0 +1,41 @@ +FROM phusion/passenger-ruby22:0.9.18 + +WORKDIR /home/app/tracks + +# Install gems +COPY Gemfile Gemfile.lock ./ +RUN bundle install --without development test mysql therubyracer --jobs=3 + +# Install and configure the app +ENV RAILS_ENV=production +ENV DATABASE_URL=sqlite3:/var/tracks/database.sqlite3 +RUN mkdir /var/tracks && chmod 777 /var/tracks +RUN touch /var/tracks/database.sqlite3 && chown app.app /var/tracks/database.sqlite3 +COPY . ./ +COPY config/site.yml.tmpl /etc/tracks/config/site.yml +RUN ln -sf /etc/tracks/config/site.yml config/site.yml +RUN bundle exec rake assets:precompile +RUN chown -R app.app . + +# Configure nginx +RUN echo "env DATABASE_URL;" > /etc/nginx/main.d/env.conf +RUN echo "\ +server {\n\ + listen 80 default_server;\n\ + server_name _;\n\ + root /home/app/tracks/public;\n\ + passenger_enabled on;\n\ + passenger_user app;\n\ + passenger_ruby /usr/bin/ruby2.2;\n\ +}" > /etc/nginx/sites-enabled/tracks.conf +RUN rm /etc/nginx/sites-enabled/default +RUN rm -f /etc/service/nginx/down + +# Migrate the database on startup +RUN echo "#!/bin/sh\nbundle exec rake db:migrate" > /etc/my_init.d/90_tracks.sh +RUN chmod +x /etc/my_init.d/90_tracks.sh + +VOLUME ["/etc/tracks", "/var/tracks"] + +# Default command for baseimage-docker +CMD ["/sbin/my_init"] diff --git a/Gemfile b/Gemfile index 5a1a30f4..d12339e6 100644 --- a/Gemfile +++ b/Gemfile @@ -14,8 +14,8 @@ gem 'therubyracer', group: :therubyracer gem 'uglifier', '>=1.3.0' -gem 'jquery-rails' -gem 'jquery-ui-rails' +gem 'jquery-rails' , '~> 3.1.3' +gem 'jquery-ui-rails' , '~>5.0.5' # you may comment out the database driver(s) you will not be using. # This will prevent a native build of the driver. Building native drivers is not @@ -28,7 +28,7 @@ gem "RedCloth" gem "sanitize", ">=3.0.0" gem "will_paginate" gem "acts_as_list" -gem "aasm" +gem "aasm", '~> 3.4.0' gem "htmlentities" gem "swf_fu" gem "rails_autolink" @@ -49,7 +49,6 @@ gem "font-awesome-sass", "~> 4.5.0" group :development do gem "spring" - gem "spring-commands-cucumber" gem "yard" gem 'tolk', '~> 1.9.3' @@ -61,24 +60,21 @@ end group :development, :test do gem 'pry' - gem "rubocop", "~> 0.41.2", require: false + gem "rubocop", "~> 0.49", require: false end group :test do # Pull in the fix for rails-dom-testing issue #42 # TODO: Remove with Rails 5 and rails-dom-testing 2.x - gem 'rails-dom-testing', github: 'rails/rails-dom-testing', ref: 'a64f30514ee65f172c43f42cfd4500b5e11a561a' + gem 'rails-dom-testing', git: 'https://github.com/rails/rails-dom-testing', ref: 'a64f30514ee65f172c43f42cfd4500b5e11a561a' - gem "factory_girl_rails" - gem "capybara" - gem "cucumber-rails", :require => false + + gem "factory_bot_rails" gem "rspec-expectations" gem "database_cleaner" gem "mocha", :require => false gem "minitest-stub-const" - gem "aruba", ">=0.5.4", :require => false - gem "selenium-webdriver", "~> 2.53" # uncomment to use the webkit option. This depends on Qt being installed @@ -90,5 +86,5 @@ group :test do gem "simplecov" # get test coverage info on codeclimate - gem "codeclimate-test-reporter", group: :test, require: nil + gem "codeclimate-test-reporter", "1.0.7", group: :test, require: nil end diff --git a/Gemfile.lock b/Gemfile.lock index 4042a10c..80dc4a14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GIT - remote: git://github.com/rails/rails-dom-testing.git + remote: https://github.com/rails/rails-dom-testing revision: a64f30514ee65f172c43f42cfd4500b5e11a561a ref: a64f30514ee65f172c43f42cfd4500b5e11a561a specs: @@ -11,7 +11,7 @@ GIT GEM remote: https://rubygems.org/ specs: - RedCloth (4.2.9) + RedCloth (4.3.2) aasm (3.4.0) actionmailer (4.2.10) actionpack (= 4.2.10) @@ -26,8 +26,8 @@ GEM rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionpack-xml_parser (1.0.1) - actionpack (>= 4.0.0.rc1) + actionpack-xml_parser (1.0.2) + actionpack (>= 4.0.0, < 5) actionview (4.2.10) activesupport (= 4.2.10) builder (~> 3.1) @@ -49,129 +49,103 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts_as_list (0.7.2) + acts_as_list (0.9.15) activerecord (>= 3.0) arel (6.0.4) - aruba (0.6.1) - childprocess (>= 0.3.6) - cucumber (>= 1.1.1) - rspec-expectations (>= 2.7.0) - ast (2.3.0) - autoprefixer-rails (5.1.0) + ast (2.4.0) + autoprefixer-rails (8.6.5) execjs - json - bcrypt (3.1.9) + bcrypt (3.1.12) bootstrap-sass (3.3.3) autoprefixer-rails (>= 5.0.0.1) sass (>= 3.2.19) builder (3.2.3) - bullet (4.14.0) + bullet (5.7.5) activesupport (>= 3.0.0) - uniform_notifier (>= 1.6.0) - capybara (2.4.4) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - childprocess (0.6.2) + uniform_notifier (~> 1.11.0) + childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) - climate_control (0.0.3) - activesupport (>= 3.0) - cocaine (0.5.7) - climate_control (>= 0.0.3, < 1.0) - codeclimate-test-reporter (0.4.1) - simplecov (>= 0.7.1, < 1.0.0) - coderay (1.1.0) - coffee-rails (4.1.0) + climate_control (0.2.0) + codeclimate-test-reporter (1.0.7) + simplecov + coderay (1.1.2) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) + coffee-script-source (1.12.2) concurrent-ruby (1.0.5) - crass (0.2.1) - cucumber (1.3.18) - builder (>= 2.1.2) - diff-lcs (>= 1.1.3) - gherkin (~> 2.12) - multi_json (>= 1.7.5, < 2.0) - multi_test (>= 0.1.1) - cucumber-rails (1.4.2) - capybara (>= 1.1.2, < 3) - cucumber (>= 1.3.8, < 2) - mime-types (>= 1.16, < 3) - nokogiri (~> 1.5) - rails (>= 3, < 5) - daemons (1.1.9) - database_cleaner (1.3.0) - diff-lcs (1.2.5) - docile (1.1.5) + crass (1.0.4) + daemons (1.2.6) + database_cleaner (1.7.0) + diff-lcs (1.3) + docile (1.3.1) erubis (2.7.0) - eventmachine (1.2.0.1) - execjs (2.6.0) - factory_girl (4.5.0) + eventmachine (1.2.7) + execjs (2.7.0) + factory_bot (4.10.0) activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) + factory_bot_rails (4.10.0) + factory_bot (~> 4.10.0) railties (>= 3.0.0) - ffi (1.9.18) + ffi (1.9.25) font-awesome-sass (4.5.0) sass (>= 3.2) - gherkin (2.12.2) - multi_json (~> 1.3) globalid (0.4.1) activesupport (>= 4.2.0) - htmlentities (4.3.3) - i18n (0.9.3) + htmlentities (4.3.4) + i18n (0.9.5) concurrent-ruby (~> 1.0) - jquery-rails (3.1.3) + jaro_winkler (1.5.1) + jquery-rails (3.1.5) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.5) railties (>= 3.2.16) json (2.1.0) - libv8 (3.16.14.7) - loofah (2.0.3) + libv8 (3.16.14.19) + loofah (2.2.2) + crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) mini_mime (>= 0.1.1) metaclass (0.0.4) - method_source (0.8.2) - mime-types (2.99.3) - mimemagic (0.3.0) + method_source (0.9.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mimemagic (0.3.2) mini_mime (1.0.0) mini_portile2 (2.1.0) - minitest (5.11.1) - minitest-stub-const (0.5) - mocha (1.1.0) + minitest (5.11.3) + minitest-stub-const (0.6) + mocha (1.6.0) metaclass (~> 0.0.1) - multi_json (1.11.2) - multi_test (0.1.1) - mysql2 (0.3.20) + mysql2 (0.3.21) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) - nokogumbo (1.1.12) + nokogumbo (1.5.0) nokogiri - paperclip (4.3.0) - activemodel (>= 3.2.0) - activesupport (>= 3.2.0) - cocaine (~> 0.5.5) + paperclip (6.1.0) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) mime-types - mimemagic (= 0.3.0) - parser (2.3.1.4) - ast (~> 2.2) - powerpack (0.1.1) - pry (0.10.1) + mimemagic (~> 0.3.0) + terrapin (~> 0.6.0) + parallel (1.12.1) + parser (2.5.1.2) + ast (~> 2.4.0) + powerpack (0.1.2) + pry (0.11.3) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - rack (1.6.8) - rack-dev-mark (0.7.3) - rack (>= 1.1) - rack-mini-profiler (0.9.2) - rack (>= 1.1.3) + method_source (~> 0.9.0) + rack (1.6.10) + rack-dev-mark (0.7.7) + rack (>= 1.1, < 2.1) + rack-mini-profiler (1.0.0) + rack (>= 1.2.0) rack-test (0.6.3) rack (>= 1.0) rails (4.2.10) @@ -187,8 +161,8 @@ GEM sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) rails_autolink (1.1.6) rails (> 3.1) railties (4.2.10) @@ -196,29 +170,38 @@ GEM activesupport (= 4.2.10) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.1.0) - rake (12.3.0) - ref (1.0.5) - rspec-expectations (3.1.2) + rainbow (3.0.0) + rake (12.3.1) + rb-fsevent (0.10.3) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + ref (2.0.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - rubocop (0.41.2) - parser (>= 2.3.1.1, < 3.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.1) + rubocop (0.58.2) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) + rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) + ruby-progressbar (1.9.0) rubyzip (1.2.1) safe_yaml (1.0.4) - sanitize (3.0.3) - crass (~> 0.2.0) + sanitize (4.6.6) + crass (~> 1.0.2) nokogiri (>= 1.4.4) - nokogumbo (= 1.1.12) - sass (3.4.22) - sass-rails (5.0.4) - railties (>= 4.0.0, < 5.0) + nokogumbo (~> 1.4) + sass (3.5.7) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) + railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) @@ -227,74 +210,68 @@ GEM childprocess (~> 0.5) rubyzip (~> 1.0) websocket (~> 1.0) - simplecov (0.9.1) - docile (~> 1.1.0) - multi_json (~> 1.0) - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - slop (3.6.0) - spring (1.1.3) - spring-commands-cucumber (1.0.1) - spring (>= 0.9.1) - sprockets (3.7.1) + simplecov (0.16.1) + docile (~> 1.1) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + spring (2.0.2) + activesupport (>= 4.2) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.10) + sqlite3 (1.3.13) swf_fu (2.0.4) coffee-script rails (>= 3.1) - therubyracer (0.12.1) - libv8 (~> 3.16.14.0) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) ref - thin (1.6.3) + thin (1.7.2) daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0) - rack (~> 1.0) + eventmachine (~> 1.0, >= 1.0.4) + rack (>= 1, < 3) thor (0.20.0) thread_safe (0.3.6) - tilt (2.0.4) + tilt (2.0.8) tolk (1.9.3) rails (>= 4.0, < 4.3) safe_yaml (>= 0.8.6) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) - unicode-display_width (1.1.1) - uniform_notifier (1.6.2) - websocket (1.2.4) - will_paginate (3.0.7) - xpath (2.0.0) - nokogiri (~> 1.3) - yard (0.8.7.6) + uglifier (4.1.17) + execjs (>= 0.3.0, < 3) + unicode-display_width (1.4.0) + uniform_notifier (1.11.0) + websocket (1.2.8) + will_paginate (3.1.6) + yard (0.9.15) PLATFORMS ruby DEPENDENCIES RedCloth - aasm + aasm (~> 3.4.0) actionpack-xml_parser (>= 1.0.1) acts_as_list - aruba (>= 0.5.4) bcrypt (~> 3.1.7) bootstrap-sass (= 3.3.3) bullet - capybara - codeclimate-test-reporter + codeclimate-test-reporter (= 1.0.7) coffee-rails (~> 4.1.0) - cucumber-rails database_cleaner - factory_girl_rails + factory_bot_rails font-awesome-sass (~> 4.5.0) htmlentities - jquery-rails - jquery-ui-rails + jquery-rails (~> 3.1.3) + jquery-ui-rails (~> 5.0.5) minitest-stub-const mocha mysql2 (~> 0.3.17) @@ -306,13 +283,12 @@ DEPENDENCIES rails-dom-testing! rails_autolink rspec-expectations - rubocop (~> 0.41.2) + rubocop (~> 0.49) sanitize (>= 3.0.0) sass-rails (~> 5.0) selenium-webdriver (~> 2.53) simplecov spring - spring-commands-cucumber sqlite3 swf_fu therubyracer @@ -323,4 +299,4 @@ DEPENDENCIES yard BUNDLED WITH - 1.16.0 + 1.16.2 diff --git a/app/assets/javascripts/disable_fx_in_test.js.erb b/app/assets/javascripts/disable_fx_in_test.js.erb index 89064c9d..174c1ddb 100644 --- a/app/assets/javascripts/disable_fx_in_test.js.erb +++ b/app/assets/javascripts/disable_fx_in_test.js.erb @@ -1,3 +1,3 @@ -<% if Rails.env.test? || Rails.env.cucumber? %> +<% if Rails.env.test? %> $.fx.off = true; <% end %> diff --git a/bin/bundle b/bin/bundle index 66e9889e..414e0c9a 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,6 @@ #!/usr/bin/env ruby +if ENV["RAILS_ENV"] != "production" + exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env") +end ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/cucumber b/bin/cucumber deleted file mode 100755 index 12971cdc..00000000 --- a/bin/cucumber +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError -end -require 'bundler/setup' -load Gem.bin_path('cucumber', 'cucumber') diff --git a/bin/rails b/bin/rails index 5191e692..3ea4cfa0 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,8 @@ #!/usr/bin/env ruby +if ENV["RAILS_ENV"] != "production" + exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env") +end + APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 17240489..36d60756 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,7 @@ #!/usr/bin/env ruby +if ENV["RAILS_ENV"] != "production" + exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env") +end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/setup b/bin/setup index acdb2c13..3eb1ec60 100755 --- a/bin/setup +++ b/bin/setup @@ -1,4 +1,7 @@ #!/usr/bin/env ruby +if ENV["RAILS_ENV"] != "production" + exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env") +end require 'pathname' # path to your application root. diff --git a/bin/spring b/bin/spring index 253ec37c..3d225a65 100755 --- a/bin/spring +++ b/bin/spring @@ -1,4 +1,7 @@ #!/usr/bin/env ruby +if ENV["RAILS_ENV"] != "production" + exec("#{__dir__}/../script/docker-environment", $PROGRAM_NAME, *ARGV) unless File.exist?("/etc/app-env") +end # This file loads spring without using Bundler, in order to be fast # It gets overwritten when you run the `spring binstub` command diff --git a/config/cucumber.yml b/config/cucumber.yml deleted file mode 100644 index 0ccd3618..00000000 --- a/config/cucumber.yml +++ /dev/null @@ -1,8 +0,0 @@ -<% -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip" -%> -default: <%= std_opts %> features -wip: --tags @wip:15 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 00000000..757be5fe --- /dev/null +++ b/config/database.yml @@ -0,0 +1,32 @@ +development: + adapter: mysql2 + database: tracks + # set this if you are storing utf8 in your mysql database to handle strings + # like "Réné". Not needed for sqlite. For PostgreSQL use encoding: unicode + # encoding: utf8 + host: db + username: root + password: + +test: + adapter: mysql2 + database: tracks_test + # set this if you are storing utf8 in your mysql database to handle strings + # like "Réné". Not needed for sqlite. For PostgreSQL use encoding: unicode + # encoding: utf8 + host: db + username: root + password: + +# Production config is disabled by default +# +# production: +# adapter: mysql2 +# database: tracks +# # set this if you are storing utf8 in your mysql database to handle strings +# # like "Réné".Not needed for sqlite. For PostgreSQL use encoding: unicode +# # encoding: utf8 +# host: localhost +# username: root +# password: + diff --git a/config/database.yml.tmpl b/config/database.yml.tmpl index 915d2ce8..56233f39 100644 --- a/config/database.yml.tmpl +++ b/config/database.yml.tmpl @@ -35,6 +35,3 @@ test: &TEST database: tracks_test username: root encoding: utf8 - -cucumber: - <<: *TEST diff --git a/config/environments/cucumber.rb b/config/environments/cucumber.rb deleted file mode 100644 index 8b8aba15..00000000 --- a/config/environments/cucumber.rb +++ /dev/null @@ -1,42 +0,0 @@ -Rails.application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = 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 - - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr - - # Unique cookies and use cookies for session - # config.action_controller.session_store :cookie_store, :key => 'TracksCucumber' - - config.time_zone = 'UTC' -end diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..82fbb252 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3' +services: + db: + image: mysql:5.7 + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: '1' + volumes: + - "db-data:/var/lib/mysql" + web: + build: . + volumes: + - "${VOLUME:-.:/app/workdir}" + ports: + - "3000:3000" + depends_on: + - db +volumes: + db-data: + diff --git a/features/add_todo_from_cli.feature b/features/add_todo_from_cli.feature deleted file mode 100644 index 442f74e5..00000000 --- a/features/add_todo_from_cli.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Add a todo to Tracks on console - In order to be able to add a todo from the command line - As a user who has installed Tracks with console access - I want to run the script to add a todo - - These scenarios are tagged javascript so that there is a Tracks server running - to use from the command line script - - Background: - Given the following user records - | login | password | is_admin | - | testuser | secret | false | - | admin | secret | true | - And I have logged in as "testuser" with password "secret" - And I have a context called "Context A" - And I have a project called "Project A" - - @javascript @aruba - Scenario: Create a single todo - Given a console input that looks like - """ - a new todo - """ - When I execute the add-todo script - Then I should have 1 todo in project "Project A" - - @javascript @aruba - Scenario: Create multiple todos - Given a console input that looks like - """ - todo 1 - todo 2 - - """ - When I execute the add-todo script - Then I should have 2 todos in project "Project A" diff --git a/features/calendar.feature b/features/calendar.feature deleted file mode 100644 index bf96eb8a..00000000 --- a/features/calendar.feature +++ /dev/null @@ -1,58 +0,0 @@ -Feature: Show all due actions in a calendar view - As a Tracks user - In order to keep overview of my due todos - I want to manage due todos in a calendar view - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "@calendar" - - @javascript - Scenario: Setting due date of a todo will show it in the calendar - When I submit a new action with description "something new" in the context "@calendar" - And I go to the calendar page - Then the badge should show 0 - And I should not see the todo "something new" - When I go to the home page - Then I should see the todo "something new" - When I edit the due date of "something new" to tomorrow - And I go to the calendar page - Then I should see the todo "something new" - And the badge should show 1 - - @javascript @wip - Scenario: Clearing the due date of a todo will remove it from the calendar - When I go to the home page - And I submit a new action with description "something new" in the context "@calendar" - And I edit the due date of "something new" to tomorrow - And I go to the calendar page - Then I should see the todo "something new" - When I clear the due date of "something new" - Then I should not see the todo "something new" - - @javascript @wip - Scenario: Marking a todo complete will remove it from the calendar - Given I have a todo "something new" in the context "@calendar" which is due tomorrow - When I go to the calendar page - Then I should see the todo "something new" - When I clear the due date of "something new" - Then I should not see the todo "something new" - - @javascript - Scenario: Deleting a todo will remove it from the calendar - Given I have a todo "something new" in the context "@calendar" which is due tomorrow - When I go to the calendar page - Then I should see the todo "something new" - When I delete the action "something new" - Then I should not see the todo "something new" - - @javascript - Scenario: Changing due date of a todo will move it in the calendar - Given I have a todo "something new" in the context "@calendar" which is due tomorrow - When I go to the calendar page - Then I should see the todo "something new" - When I edit the due date of "something new" to next month - Then I should see "something new" in the due next month container diff --git a/features/context_edit.feature b/features/context_edit.feature deleted file mode 100644 index 99a9eb6d..00000000 --- a/features/context_edit.feature +++ /dev/null @@ -1,120 +0,0 @@ -Feature: Edit a context - In order to work on todos in a context - As a Tracks user - I want to manage todos in a context - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "@pc" - And I have a project called "test project" - And I have 2 todos in project "test project" in context "@pc" with tags "starred" prefixed by "test_project " - - @javascript - Scenario: In place edit of context name - When I go to the context page for "@pc" - And I edit the context name in place to be "OutAndAbout" - Then I should see the context name is "OutAndAbout" - When I go to the contexts page - Then I should see that a context named "Errands" is not present - And I should see that a context named "OutAndAbout" is present - - # Ticket #1796 - @javascript - Scenario: I can change the name of the context and it should update the new todo form - When I go to the context page for "@pc" - And I edit the context name in place to be "OutAndAbout" - Then the context field of the new todo form should contain "OutAndAbout" - - # Ticket #1789 - @javascript - Scenario: I can change the name of the context and it should still allow me to add new actions - When I go to the context page for "@pc" - And I edit the context name in place to be "OutAndAbout" - And I submit a new action with description "a new next action" - Then I should see the todo "a new next action" - - @javascript - Scenario: Editing the context of a todo will remove the todo - When I go to the the context page for "@pc" - Then the badge should show 2 - When I edit the context of "test_project todo 1" to "@laptop" - Then I should not see the todo "todo 1" - And the badge should show 1 - - @javascript - Scenario: Editing the description of a a todo will update that todo - When I go to the the context page for "@pc" - And I edit the description of "test_project todo 1" to "changed" - Then I should not see the todo "test_project todo 1" - And I should see "changed" - - @javascript @wip - Scenario: Editing the context of the last todo will remove the todo and show empty message - When I go to the the context page for "@pc" - And I edit the context of "test_project todo 1" to "@laptop" - Then I should not see the todo "test_project todo 1" - And the badge should show 1 - When I edit the context of "test_project todo 2" to "@laptop" - Then I should not see the todo "test_project todo 2" - And the badge should show 0 - And I should see empty message for todos of context - - @javascript - Scenario: Adding a todo to a hidden project will not show the todo - Given I have a hidden project called "hidden project" - When I go to the the context page for "@pc" - And I edit the project of "test_project todo 1" to "hidden project" - Then I should not see the todo "test_project todo 1" - When I submit a new action with description "todo X" to project "hidden project" in the context "@pc" - Then I should not see the todo "todo X" - When I go to the "hidden project" project - Then I should see the todo "test_project todo 1" - And I should see the todo "todo X" - And the badge should show 2 - - @javascript - Scenario: Adding a todo to a hidden context will show that todo - Given I have a hidden context called "@personal" - When I go to the the context page for "@pc" - And I edit the context of "test_project todo 1" to "@personal" - Then I should not see the todo "test_project todo 1" - When I go to the context page for "@personal" - Then I should see the todo "test_project todo 1" - When I submit a new action with description "todo X" to project "test project" in the context "@personal" - Then I should see the todo "todo X" - - @javascript - Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages - Given I have a context "test" with 1 todos - When I go to the "test" context - Then I should see "todo 1" in the action container - And I should see empty message for deferred todos of context - And I should see empty message for completed todos of context - When I defer "todo 1" for 1 day - Then I should see "todo 1" in the deferred container - And I should not see empty message for deferred todos of context - And I should see empty message for completed todos of context - And I should see empty message for todos of context - - @javascript - Scenario: Moving the todo out of the tickler will move todo to active container and update empty messages - Given I have a context "test" with 1 deferred todos - When I go to the "test" context - Then I should see "deferred todo 1" in the deferred container - And I should see empty message for todos of context - And I should not see empty message for deferred todos of context - When I clear the show from date of "deferred todo 1" - Then I should see "deferred todo 1" in the action container - And I should see empty message for deferred todos of context - And I should not see empty message for todos of context - - @javascript - Scenario: Making all deferred todos inactive will show empty message - Given I have a context "test" with 1 deferred todos - When I go to the "test" context - And I mark "deferred todo 1" as complete - Then I should see empty message for todos of context - And I should see empty message for deferred todos of context diff --git a/features/context_list.feature b/features/context_list.feature deleted file mode 100644 index 2d07207b..00000000 --- a/features/context_list.feature +++ /dev/null @@ -1,140 +0,0 @@ -Feature: Manage the list of contexts - In order to keep track and manage all of my contexts - As a Tracks user - I want to manage my list of contexts - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - Scenario: The list of contexts contain all contexts - Given I have the following contexts - | context | hide | - | @ipad | false | - | @home | false | - | @boss | false | - When I go to the contexts page - Then I should see "@ipad" - And I should see "@home" - And I should see "@boss" - And the badge should show 3 - - Scenario: Clicking on a context takes me to the context page - Given I have a context called "@computer" - When I go to the contexts page - And I follow "@computer" - Then I should be on the context page for "@computer" - - Scenario: The context view shows all todos - Given I have a todo "foo" in the context "@bar" which is due tomorrow - Given I have a deferred todo "foo2" in the context "@bar" - Given I have a todo "foo3" in the context "@bar" - When I go to the contexts page - And I follow "@bar" - Then I should be on the context page for "@bar" - And the badge should show 3 - - @javascript - Scenario: Delete context from context page should update badge - Given I have a context called "@computer" - And I have a context called "@ipad" - When I go to the contexts page - Then the badge should show 2 - And the context list badge for active contexts should show 2 - When I delete the context "@computer" - Then I should see that a context named "@computer" is not present - And the badge should show 1 - And the context list badge for active contexts should show 1 - - @javascript - Scenario: Delete last context from context page should remove the contexts container - Given I have a context called "@computer" - And I have a hidden context called "@ipad" - And I have a closed context called "@ibm-pc" - When I go to the contexts page - And I should see that the context container for active contexts is present - And I should see that the context container for hidden contexts is present - And I should see that the context container for closed contexts is present - When I delete the context "@computer" - Then I should see that a context named "@computer" is not present - And I should see empty message for active contexts - When I delete the context "@ipad" - Then I should see that a context named "@ipad" is not present - And I should see empty message for hidden contexts - When I delete the context "@ibm-pc" - Then I should see that a context named "@ibm-pc" is not present - And I should see empty message for closed contexts - - @javascript - Scenario: Delete context from context page right after an edit - Given I have a context called "@computer" - When I go to the contexts page - And I edit the context to rename it to "@laptop" - When I delete the context "@laptop" - Then he should see that a context named "@laptop" is not present - And the badge should show 0 - - @javascript - Scenario: Edit context from context twice - Given I have a context called "@computer" - When I go to the contexts page - And I edit the context to rename it to "@laptop" - And I edit the context to rename it to "@ipad" - Then he should see that a context named "@computer" is not present - And he should see that a context named "@laptop" is not present - And he should see that a context named "@ipad" is present - And the badge should show 1 - - @javascript - Scenario Outline: Showing a new context with state - Given I have the following contexts - | context | hide | - | @ipad | true | - | @home | false | - When I go to the contexts page - And I add a new context "" - Then I should see the context "" under "" - - Examples: - | state | name | - | active | @phone | - | hidden | @hidden | - - @javascript - Scenario: Showing a new context with state - When I go to the contexts page - Then I should see empty message for active contexts - And I should see empty message for hidden contexts - And I should see empty message for closed contexts - When I add a new active context "@active" - Then I should see the context "@active" under "active" - And I should not see empty message for active contexts - When I add a new hidden context "@hidden" - Then I should see the context "@hidden" under "hidden" - And I should not see empty message for hidden contexts - When I edit the state of context "@hidden" to closed - Then I should not see empty message for closed contexts - And I should see the context "@hidden" under "closed" - - @javascript - Scenario: I can drag and drop to order the contexts - Given I have the following contexts - | context | - | @ipad | - | @home | - | @boss | - When I go to the contexts page - Then context "@ipad" should be above context "@home" - When I drag context "@home" above context "@ipad" - Then context "@home" should be above context "@ipad" - - @javascript - Scenario: Hiding and unhiding the new context form - When I go to the contexts page - Then the new context form should be visible - When I follow "Hide form" - Then the new context form should not be visible - When I follow "Create a new context" - Then the new context form should be visible \ No newline at end of file diff --git a/features/create_admin.feature b/features/create_admin.feature deleted file mode 100644 index cc56c6d5..00000000 --- a/features/create_admin.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Signup new users - In order to be able to administer Tracks - As a user who just installed Tracks - I want to create an admin account - - Background: - Given the following user records - | login | password | is_admin | - | testuser | secret | false | - | admin | secret | true | - - Scenario: Successful signup - Given no users exists - When I go to the homepage - Then I should be redirected to the signup page - When I submit the signup form with username "admin", password "secret" and confirm with "secret" - Then I should be on the homepage - And I should be an admin - - @wip - Scenario: Signup should be refused when password and confirmation is not the same - Given no users exists - When I go to the signup page - And I submit the signup form with username "admin", password "secret" and confirm with "error" - Then I should be redirected to the signup page - And I should see "Password doesn't match confirmation" - - Scenario: With public signups turned off, signup should be refused when an admin user exists - Given public signups are turned off - When I go to the signup page - Then I should see "You don't have permission to sign up for a new account." - - Scenario: With public signups turned on, signup should possible when an admin user exists - Given public signups are turned on - When I go to the signup page - Then I should see "Sign up a new user" diff --git a/features/dependencies.feature b/features/dependencies.feature deleted file mode 100644 index 8c91e04f..00000000 --- a/features/dependencies.feature +++ /dev/null @@ -1,176 +0,0 @@ -Feature: dependencies - As a Tracks user - In order to keep track of complex todos that are dependent on each other - I want to assign and manage todo dependencies - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - @javascript - Scenario: Adding dependency to dependency by drag and drop - Given I have a project "dependencies" with 3 todos - And "todo 2" depends on "todo 1" - When I go to the "dependencies" project - And I drag "todo 3" to "todo 2" - Then the successors of "todo 1" should include "todo 2" - And the successors of "todo 2" should include "todo 3" - When I expand the dependencies of "todo 1" - Then I should see "todo 2" within the dependencies of "todo 1" - And I should see "todo 3" within the dependencies of "todo 1" - When I expand the dependencies of "todo 2" - Then I should see "todo 3" within the dependencies of "todo 2" - - @javascript @wip - Scenario: I can edit a todo to add the todo as a dependency to another - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | - | test 1 | @pc | - | test 2 | @pc | - | test 3 | @pc | - When I go to the "dependencies" project - When I edit the dependency of "test 1" to add "test 2" as predecessor - Then I should see "test 1" within the dependencies of "test 2" - And I should see "test 1" in the deferred container - When I edit the dependency of "test 1" to add "test 3" as predecessor - Then I should see "test 1" within the dependencies of "test 2" - Then I should see "test 1" within the dependencies of "test 3" - When I edit the dependency of "test 1" to remove "test 3" as predecessor - And I edit the dependency of "test 2" to add "test 3" as predecessor - Then I should see "test 1" within the dependencies of "test 3" - Then I should see "test 2" within the dependencies of "test 3" - - @javascript - Scenario: I can remove a dependency by editing the todo - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | - | test 1 | @pc | - | test 2 | @pc | - And "test 1" depends on "test 2" - When I go to the "dependencies" project - Then I should see "test 1" in the deferred container - When I edit the dependency of "test 1" to remove "test 2" as predecessor - Then I should not see "test 1" within the dependencies of "test 2" - And I should not see "test 1" in the deferred container - - @javascript - Scenario: Completing a predecessor will activate successors - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | - | test 1 | @pc | - | test 2 | @pc | - | test 3 | @pc | - And "test 2" depends on "test 1" - When I go to the "dependencies" project - Then I should see "test 2" in the deferred container - And I should see "test 1" in the context container for "@pc" - When I mark "test 1" as complete - Then I should see "test 1" in the completed container - And I should see "test 2" in the context container for "@pc" - And I should not see "test 2" in the deferred container - And I should see empty message for deferred todos of project - - @javascript - Scenario: Deleting a predecessor will activate successors - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | - | test 1 | @pc | - | test 2 | @pc | - | test 3 | @pc | - And "test 2" depends on "test 1" - When I go to the "dependencies" project - Then I should see "test 2" in the deferred container - And I should see "test 1" in the context container for "@pc" - When I delete the action "test 1" - Then I should see "test 2" in the context container for "@pc" - And I should not see "test 2" in the deferred container - And I should see empty message for deferred todos of project - - @javascript - Scenario: Deleting a successor will update predecessor - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | - | test 1 | @pc | - | test 2 | @pc | - | test 3 | @pc | - And "test 2" depends on "test 1" - And "test 3" depends on "test 1" - When I go to the "dependencies" project - And I expand the dependencies of "test 1" - Then I should see "test 2" within the dependencies of "test 1" - And I should see "test 3" within the dependencies of "test 1" - When I delete the action "test 2" - And I expand the dependencies of "test 1" - Then I should see "test 3" within the dependencies of "test 1" - And I should not see "test 2" - - @javascript - Scenario: Dragging an action to a completed action will not add it as a dependency - Given I have a context called "@pc" - And I have a project "dependencies" that has the following todos - | description | context | completed | - | test 1 | @pc | no | - | test 2 | @pc | no | - | test 3 | @pc | yes | - When I go to the "dependencies" project - And I drag "test 1" to "test 3" - Then I should see an error flash message saying "Cannot add this action as a dependency to a completed action!" - And I should see "test 1" in the context container for "@pc" - - @javascript - Scenario Outline: Marking a successor as complete will update predecessor - Given I have a context called "@pc" - And I have selected the view for group by - And I have a project "dependencies" that has the following todos - | description | context | completed | tags | - | test 1 | @pc | no | bla | - | test 2 | @pc | no | bla | - | test 3 | @pc | yes | bla | - When I go to the - And I drag "test 1" to "test 2" - When I expand the dependencies of "test 2" - Then I should see "test 1" within the dependencies of "test 2" - And I should see "test 1" in the deferred container - When I mark "test 1" as complete - Then I should see that "test 2" does not have dependencies - And I should see "test 1" in the completed container - - Scenarios: - | page | grouping | - | "dependencies" project | project | - | tag page for "bla" | context | - | tag page for "bla" | project | - - @javascript - Scenario Outline: Marking a successor as active will update predecessor - Given I have a context called "@pc" - And I have selected the view for group by - And I have a project "dependencies" that has the following todos - | description | context | completed | tags | - | test 1 | @pc | no | bla | - | test 2 | @pc | no | bla | - | test 3 | @pc | yes | bla | - When I go to the - And I drag "test 1" to "test 2" - Then I should see "test 1" in the deferred container - When I mark "test 1" as complete - And I should see "test 1" in the completed container - And I should see that "test 2" does not have dependencies - When I mark the completed todo "test 1" active - Then I should not see "test 1" in the completed container - And I should see "test 1" in the deferred container - And I should see "test 1" within the dependencies of "test 2" - - Scenarios: - | page | grouping | - | "dependencies" project | project | - | "dependencies" project | context | - | tag page for "bla" | context | - | tag page for "bla" | project | diff --git a/features/edit_a_todo.feature b/features/edit_a_todo.feature deleted file mode 100644 index c3d0faf7..00000000 --- a/features/edit_a_todo.feature +++ /dev/null @@ -1,352 +0,0 @@ -Feature: Edit a next action from every page - In order to manage a next action - As a Tracks user - I want to to be able to change the next action from every page - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "@pc" - - @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 - And I star the action "star me" - Then I should see a starred "star me" - When I go to the tag page for "starred" - Then I should see "star me" - - @javascript - Scenario Outline: I can delete a todo - Given I have a todo "delete me" in the context "@home" - And I have selected the view for group by - When I go to the home page - Then I should see "delete me" - When I delete the action "delete me" - Then I should not see "delete me" - - Scenarios: - | grouping | - | context | - | project | - - @javascript - Scenario Outline: Removing the last todo in container will hide that container - Given I have a todo "delete me" in the context "@home" in the project "do it!" - And I have selected the view for group by - When I go to the home page - Then I should see the - And I should see "delete me" in the - When I mark "delete me" as complete - Then I should not see the - And I should see "delete me" in the completed container - When I mark "delete me" as uncompleted - Then I should see the - And I should see "delete me" in the - - Scenarios: - | grouping | container | - | context | container for context "@home" | - | project | container for project "do it!" | - - @javascript - Scenario Outline: Changing container of the todo in that container will hide it - Given I have a todo "delete me" in the context "@home" in the project "do it" - And I have a project "go for it" - And I have selected the view for group by - When I go to the home page - And I edit the of "delete me" to - Then I should not see the - And I should see the - And I should see "delete me" in the - When I delete the todo "delete me" - Then I should not see the todo "delete me" - And I should not see the - And I should not see the - - Scenarios: - | grouping | container | new_grouping | new_container | - | context | container for context "@home" | "@pc" | container for context "@pc" | - | project | container for project "do it" | "go for it" | container for project "go for it" | - - @javascript - 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 selected the view for group by - And I have a project "my project" that has the following todos - | context | description | tags | - | @home | first action | test, bla | - | @home | second action | bla | - When I go to the - Then I should not see empty message for todos of - And I should see "first action" - When I delete the todo "first action" - Then I should not see empty message for todos of - When I delete the todo "second action" - Then I should see empty message for todos of - - Scenarios: - | page | page type | grouping | - | "my project" project | project | project | - | "my project" project | project | context | - | context page for "@home" | context | context | - | context page for "@home" | context | project | - | tag page for "bla" | tag | context | - | tag page for "bla" | tag | project | - - @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 - Then I should see empty message for todos of - 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 for todos of - When I mark "visible todo" as complete - And I should see empty message for todos of - And I should see "visible todo" in the completed container - - Scenarios: - | page | page type | - | home page | home | - | "visible project" project | project | - | tag page for "starred" | tag | - | context page for "visible context" | context | - - @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 - Then I should see empty message for deferred todos of - 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 for deferred todos of - When I mark "visible todo" as complete - And I should see empty message for deferred todos of - And I should see "visible todo" in the completed container - - Scenarios: - | page | page type | - | tag page for "starred" | tag | - | "visible project" project | project | - | context page for "visible context" | context | - - @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" - And I have selected the view for group by - When I go to the - Then I should see empty message for todos of - And I should not see the - And I should not see empty message for completed todos of - When I mark the completed todo "visible todo" active - Then I should see the - And I should see empty message for completed todos of - And I should see "visible todo" in the - And I should not see empty message for todos of - - Scenarios: - | page | page type | grouping | container | - | tag page for "starred" | tag | context | container for context "visible context" | - | tag page for "starred" | tag | project | container for project "visible project" | - | home page | home | context | container for context "visible context" | - | home page | home | project | container for project "visible project" | - - @javascript - Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without hideable 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 - Then I should see empty message for todos of - And I should not see empty message for completed todos of - When I mark the completed todo "visible todo" active - And I should see empty message for completed todos of - And I should not see empty message for todos of - - Scenarios: - | page | page type | - | context page for "visible context" | context | - | "visible project" project | project | - - @javascript - Scenario Outline: I can edit a todo to change its description - 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 - And I have selected the view for group by - When I go to the - And I edit the description of "visible todo" to "changed todo" - Then I should not see the todo "visible todo" - And I should see the todo "changed todo" - - Scenarios: - | page | grouping | - | home page | context | - | home page | project | - | context page for "visible context" | context | - | "visible project" project | context | - | tag page for "starred" | context | - | tag page for "starred" | project | - | calendar page | context | - - @javascript - Scenario Outline: I can edit a todo to move it to another container - Given I have a context called "@laptop" - And I have selected the view for group by - And I have a project "project 1" that has the following todos - | context | description | tags | - | @pc | first action | bla | - | @laptop | second action | bla | - And I have a project "project 2" - When I go to the - Then I should see "first action" in the - When I edit the of "first action" to - Then I should not see "first action" in the - Then I should see "first action" in the - - Scenarios: - | page | grouping | container | new grouping | new container | - | home page | context | context container for "@pc" | "@laptop" | context container for "@laptop" | - | home page | project | project container for "project 1" | "project 2" | project container for "project 2" | - | tag page for "bla" | context | context container for "@pc" | "@laptop" | context container for "@laptop" | - | tag page for "bla" | project | project container for "project 1" | "project 2" | project container for "project 2" | - - @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 - | context | description | - | @pc | first action | - | @laptop | second action | - When I go to the tickler page - Then I should see "first action" in the context container for "@pc" - When I edit the context of "first action" to "@laptop" - 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" - - @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 - When I go to the "project two" project - And I edit the project of "todo 1" to "project one" - Then I should not see the todo "todo 1" - When I go to the "project one" project - Then I should see the todo "todo 1" - - @javascript - Scenario: I can give a todo without a project a blank project name - Given I have a todo "todo 1" in the context "@pc" - When I go to the home page - And I edit the project of "todo 1" to "" - Then I should see the todo "todo 1" - - @javascript - Scenario: I can edit a todo without a project and the project remains blank - Given I have a todo "todo 1" - When I go to the home page - And I change the todo[description] field of "todo 1" to "todo 1 edit" - Then I should see the todo "todo 1 edit" with project name "" - - @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" - And I edit the show from date of "start later" to next month - Then I should not see the todo "start later" - When I go to the tickler page - Then I should see the todo "start later" - - @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" - When I go to the home page - And I defer "start later" for 1 day - Then I should not see "start later" - When I go to the tickler page - Then I should see "start later" - - @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" - When I go to the home page - And I make a project of "buy mediacenter" - #sidebar does not update - Then I should be on the "buy mediacenter" project - When I go to the projects page - Then I should see "buy mediacenter" - - @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 the notes of "read the notes" - When I open the notes of "read the notes" - Then I should see the notes of "read the notes" - - @javascript - Scenario: I can tag a todo - Given I have a todo "tag me" - When I go to the home page - And I edit the tags of "tag me" to "bla, bli" - Then I should see the todo "bla" - And I should see the todo "bli" - - Scenario: Clicking a tag of a todo will go to that tag page - Given I have a todo "tag you are it" in context "@tags" with tags "taga, tagb" - When I go to the home page - Then I should see "tag you are it" - And I should see "taga" - When I follow "taga" - Then I should be on the tag page for "taga" - - @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 - Then I should see "tag you are it" - When I edit the tags of "tag you are it" to "tagb, tagc" - Then I should not see "taga" - And I should see "tagb" - And I should see "tagc" - - @javascript - Scenario Outline: Editing the container of a todo to a new container will show new container - Given I have a todo "moving" in context "@pc" in project "project 1 " with tags "tag" - And I have selected the view for group by - When I go to the - And I edit the of "moving" to - And I should see the - - Scenarios: - | page | grouping | new grouping | container | - | home page | context | "@new" | container for context "@new" | - | home page | project | "project 2" | container for project "project 2" | - | tag page for "tag" | context | "@new" | container for context "@new" | - | tag page for "tag" | project | "project 2" | container for project "project 2" | - - @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" - Then I should see the container for context "@new" - - @javascript - Scenario: Editing the context of a todo in the project view to a new context will show new context - Given I have a todo "something" in the context "@pc" in the project "project" - When I go to the "project" project page - And I edit the context of "something" to "@new" - Then I should see the container for context "@new" - - @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 - And I try to edit the description of "test" to "" - Then I should see an error message diff --git a/features/feedlist.feature b/features/feedlist.feature deleted file mode 100644 index ebf76b03..00000000 --- a/features/feedlist.feature +++ /dev/null @@ -1,48 +0,0 @@ -Feature: Get all sorts of lists from Tracks - In order to get reports on todos managed by Tracks - As a Tracks user - I want to be be able to select a feed - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have the following contexts: - | context | - | @pc | - | @home | - | @shops | - | @boss | - And I have the following projects: - | project_name | - | Test feedlist | - | Get release out | - - Scenario: I cannot see context scripts when I do not have a context - Given I have no contexts - When I go to the feeds page - Then I should see a message that you need a context to get feeds for contexts - - Scenario: I cannot see proejct scripts when I do not have a project - Given I have no projects - When I go to the feeds page - Then I should see a message that you need a project to get feeds for projects - - Scenario: I can see scripts when I have one or more contexts - When I go to the feeds page - Then I should see feeds for projects - And I should see "Test feedlist" as the selected project - And I should see feeds for contexts - And I should see "@pc" as the selected context - - @javascript - Scenario Outline: I can select the item for getting feeds for that item - When I go to the feeds page - And I select "" from "" - Then I should see feeds for "" in list of "" - - Examples: - | item | item-list | item-type | - | @boss | feed-contexts | context | - | Get release out | feed-projects | project | diff --git a/features/logging_in.feature b/features/logging_in.feature deleted file mode 100644 index ef74a8f7..00000000 --- a/features/logging_in.feature +++ /dev/null @@ -1,59 +0,0 @@ -Feature: Existing user logging in - In order to keep my things private - As an existing user - I want to log in with my username and password - - Background: - Given the following user records - | login | password | is_admin | first_name | last_name | - | testuser | secret | false | Test | User | - | admin | secret | true | Admin | User | - - Scenario Outline: Successful and unsuccessful login - When I go to the login page - And I submit the login form as user "" with password "" - Then I should be - And I should see "" - - Examples: - | user | password | there | message | - | admin | secret | redirected to the home page | Login successful | - | admin | wrong | on the login page | Login unsuccessful | - - Scenario Outline: Unauthorized users cannot access Tracks and need to log in first - Given there exists a project called "top secret" for user "testuser" - And there exists a context called "@secret location" for user "testuser" - When I go to the - Then I should be redirected to the login page - When I submit the login form as user "testuser" with password "secret" - Then I should be redirected to the - And I should see "" - - Examples: - | page | next page | logout | - | home page | home page | Logout | - | contexts page | contexts page | Logout | - | projects page | projects page | Logout | - | notes page | notes page | Logout | - | recurring todos page | recurring todos page | Logout | - | statistics page | statistics page | Logout | - | manage users page | manage users page | 401 Unauthorized | - | integrations page | integrations page | Logout | - | starred page | starred page | Logout | - | tickler page | tickler page | Logout | - | calendar page | calendar page | Logout | - | feeds page | feeds page | Logout | - | preference page | preference page | Logout | - | export page | export page | Logout | - | rest api docs page | rest api docs page | Logout | - | search page | search page | Logout | - | "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout | - | context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout | - - @javascript - Scenario: When session expires, you should be logged out - When I go to the login page - And I submit the login form as user "testuser" with password "secret" - Then I should be on the home page - When my session expires - Then I should be on the login page diff --git a/features/make_project_from_template.feature b/features/make_project_from_template.feature deleted file mode 100644 index dac6b35d..00000000 --- a/features/make_project_from_template.feature +++ /dev/null @@ -1,37 +0,0 @@ -Feature: Create project from template on console - In order to be able to create a project from a template - As a user who has installed Tracks with console access - I want to run the script to add projects and actions from a template - - These scenarios are tagged javascript so that there is a Tracks server running - to use from the command line script - - Background: - Given the following user records - | login | password | is_admin | - | testuser | secret | false | - | admin | secret | true | - And I have logged in as "testuser" with password "secret" - And I have a context called "Context A" - - @javascript @aruba - Scenario: Create a project with one task - Given a template that looks like - """ - My first project - .My first task in this project - """ - When I execute the template script - Then I should have a project called "My first project" - And I should have 1 todo in project "My first project" - - @javascript @aruba - Scenario: Create a project with dependent tasks - Given a template that looks like - """ - My first project - .Todo - ^Dependent - """ - When I execute the template script - Then the successors of "Todo" should include "Dependent" diff --git a/features/manage_users.feature b/features/manage_users.feature deleted file mode 100644 index a57b578c..00000000 --- a/features/manage_users.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Manage users - In order to be able to manage the users able to use Tracks - As the administrator of this installed Tracks - I want to add and delete accounts of users - - Background: - Given the following user records - | login | password | is_admin | - | testuser | secret | false | - | admin | secret | true | - And I have logged in as "admin" with password "secret" - - Scenario: Show all accounts - When I go to the manage users page - Then I should see "testuser" - And I should see "admin" - - Scenario: Add new account - When I go to the manage users page - And I follow "Sign up new user" - Then I should be on the signup page - When I submit the signup form with username "new.user", password "secret123" and confirm with "secret123" - Then I should be on the manage users page - And I should see "new.user" - - @javascript - Scenario: Delete account from users page - When I go to the manage users page - And I delete the user "testuser" - Then I should see that a user named "testuser" is not present \ No newline at end of file diff --git a/features/mobile_add_action.feature b/features/mobile_add_action.feature deleted file mode 100644 index 6cc7ccd2..00000000 --- a/features/mobile_add_action.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Add new next action from mobile page - In order to be able to add next actions from the mobile interface - As a Tracks user - I want to to be able to add a new next actions from the mobile interface and prepopulate the context and / or project of the prior page - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I am working on the mobile interface - And I have logged in as "testuser" with password "secret" - And I have a context called "a context" - And I have a project "test project" with a default context of "test context" - - Scenario Outline: The new action form is prefilled with context and project - Given I am on the - When I follow "New" - Then the selected project should be "" - And the selected context should be "" - - Scenarios: # empty means no selected, i.e. first in list is shown - | page | project | context | - | home page | | | - | tickler page | | | - | "test project" project | test project | test context | - | context page for "test context" | | test context | - | tag page for "starred" | | | - - Scenario: I can add a new todo using the mobile interface - Given I am on the home page - Then the badge should show 0 - When I follow "New" - And I fill in "Description" with "test me" - And I press "Create" - Then I should see "test me" - And the badge should show 1 diff --git a/features/mobile_context_list.feature b/features/mobile_context_list.feature deleted file mode 100644 index 769c10b7..00000000 --- a/features/mobile_context_list.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: View the list of contexts from mobile - In order to be able to see all contexts from the mobile interface - As a Tracks user - I want to to be able to see a list of project - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I am working on the mobile interface - And I have logged in as "testuser" with password "secret" - And I have a context called "@mobile" - And I have a project "test project" that has the following todos - | context | description | - | @mobile | test action | - - Scenario: I can go to a context from the mobile context list page - Given I have a todo "test mobile page" in the context "@mobile" - And I am on the contexts page - Then I should see "@mobile" - When I follow "@mobile" - Then the badge should show 2 - And I should see "@mobile" diff --git a/features/mobile_edit_a_todo.feature b/features/mobile_edit_a_todo.feature deleted file mode 100644 index a3599d64..00000000 --- a/features/mobile_edit_a_todo.feature +++ /dev/null @@ -1,50 +0,0 @@ -Feature: Edit a next action from the mobile view - In order to manage a next action - As a Tracks user - I want to to be able to edit a next action - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I am working on the mobile interface - And I have logged in as "testuser" with password "secret" - And I have a context called "@mobile" - And I have a project "test project" that has the following todos - | context | description | - | @mobile | test action | - - Scenario: I can edit an action on the mobile page - When I am on the home page - Then the badge should show 1 - And I should see "test action" - When I follow "test action" - Then I should see "Actions" - When I press "Edit action" - Then I should see "Description" - And I fill in "Description" with "changed action" - And I press "Update" - Then I should see "changed action" - And I should not see "test action" - When I follow "changed action" - And I press "Mark complete" - Then I should see "changed action" in the completed section of the mobile site - - Scenario: Navigate from home page - move this to separate features when other scenarios are created for these features - When I am on the home page - Then the badge should show 1 - When I follow "Tickler" - Then the badge should show 0 - When I follow "Feeds" - Then I should see "Last 15 actions" - - Scenario: I can defer an action on the mobile page - When I am on the home page - Then the badge should show 1 - And I should see "test action" - When I follow "test action" - And I press "Defer 1 day" - Then I should see "Currently there are no incomplete actions" - When I follow "Tickler" - Then I should see "test action" diff --git a/features/mobile_project_list.feature b/features/mobile_project_list.feature deleted file mode 100644 index 35402a49..00000000 --- a/features/mobile_project_list.feature +++ /dev/null @@ -1,22 +0,0 @@ -Feature: View the list of projects from mobile - In order to be able to see all project from the mobile interface - As a Tracks user - I want to to be able to see a list of project - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I am working on the mobile interface - And I have logged in as "testuser" with password "secret" - And I have a context called "@mobile" - And I have a project "test project" that has the following todos - | context | description | - | @mobile | test action | - - Scenario: I can go to a project from the list of project in mobile view - Given I am on the projects page - Then I should see "test project" - When I follow "test project" - Then the badge should show 1 - And I should see "test action" diff --git a/features/mobile_tagging_todos.feature b/features/mobile_tagging_todos.feature deleted file mode 100644 index 1d874366..00000000 --- a/features/mobile_tagging_todos.feature +++ /dev/null @@ -1,24 +0,0 @@ -Feature: Show the actions that are tagged on the mobile page - In order to be able to see all actions tags with a certain tag - As a Tracks user - I want to to be able to find all actions with a specific tag - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I am working on the mobile interface - And I have logged in as "testuser" with password "secret" - And I have a context called "@mobile" - And I have a project "my project" that has the following todos - | context | description | tags | - | @mobile | first action | test, bla | - | @mobile | second action | bla | - - Scenario: I can follow the tag of a action to see all actions belonging to that todo - When I go to the home page - And I follow the tag "test" - Then the badge should show 1 - When I go to the home page - And I follow the tag "bla" - Then the badge should show 2 diff --git a/features/notes_manage.feature b/features/notes_manage.feature deleted file mode 100644 index fa3c8924..00000000 --- a/features/notes_manage.feature +++ /dev/null @@ -1,66 +0,0 @@ -Feature: View, add, remove notes - In order to manage my notes - As a Tracks user - I want to view, add, and remove notes - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - Scenario: View notes - Given I have two projects with one note each - When I go to the notes page - Then 2 notes should be visible - And the badge should show 2 - - Scenario: Add a new note - Given I have one project "Pass Final Exam" with no notes - When I add note "My Note A" from the "Pass Final Exam" project page - Then I should see note "My Note A" on the "Pass Final Exam" project page - And I should see note "My Note A" on the notes page - Then the badge should show 1 - - Scenario: Link to note - Given I have a project "Pass Final Exam" with 1 note - When I go to the "Pass Final Exam" project - And I click the icon next to the note - Then I should see the note text - - @javascript - Scenario: Delete note from notes page - Given I have a project "Pass Final Exam" with 2 notes - When I go to the notes page - And I delete the first note - Then the badge should show 1 - - @javascript - Scenario: Edit a note - Given I have a project "Pass Final Exam" with 2 notes - When I go to the notes page - And I edit the first note to "edited note" - Then I should see "edited note" - - @javascript - Scenario: Toggle all notes - Given I have a context called "@pc" - And I have a project "take notes" that has the following todos - | description | context | notes | - | test 1 | @pc | note A | - | test 2 | @pc | note B | - | test 3 | @pc | note C | - When I go to the home page - Then I should not see the note "note A" - And I should not see the note "note B" - And I should not see the note "note C" - When I toggle the note of "test 1" - Then I should see the note "note A" - And I should not see the note "note B" - And I should not see the note "note C" - When I toggle the note of "test 1" - Then I should not see the note "note A" - When I toggle all notes - Then I should see the note "note A" - And I should see the note "note B" - And I should see the note "note C" diff --git a/features/preferences.feature b/features/preferences.feature deleted file mode 100644 index dddc2c0b..00000000 --- a/features/preferences.feature +++ /dev/null @@ -1,41 +0,0 @@ -Feature: Manage preferences - In order to customize Tracks to my needs - As a Tracks user - I want to be be able change my preferences - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - Scenario: I can change my password - When I go to the preferences page - And I set the password and confirmation to "secret123" - When I log out of Tracks - And I go to the login page - And I submit the login form as user "testuser" with password "secret" - Then I should see "Login unsuccessful" - When I submit the login form as user "testuser" with password "secret123" - Then I should see "Login successful" - - Scenario: I can leave password field empty and the password will not be changed - When I go to the preferences page - And I set the password and confirmation to "" - When I log out of Tracks - And I go to the login page - And I submit the login form as user "testuser" with password "" - Then I should see "Login unsuccessful" - When I submit the login form as user "testuser" with password "secret" - Then I should see "Login successful" - - Scenario: The password and the confirmation need to be the same - When I go to the preferences page - And I set the password to "secret" and confirmation to "wrong" - Then I should see "Password confirmation doesn't match confirmation" - - Scenario: I can edit preferences - When I go to the preferences page - Then I should see "testuser Preferences" - When I edit my last name to "Tester" - Then I should see "Tester Preferences" diff --git a/features/project_edit.feature b/features/project_edit.feature deleted file mode 100644 index df3f3cbd..00000000 --- a/features/project_edit.feature +++ /dev/null @@ -1,180 +0,0 @@ -Feature: Edit a project - In order to reach a goal by doing several related todos - As a Tracks user - I want to manage these todos in a project - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And there exists a project "manage me" for user "testuser" - And I have logged in as "testuser" with password "secret" - - Scenario: I can go to the note of a project - Given I have a project "test" with 2 notes - When I go to the "test" project - When I click on the first note icon - Then I should go to that note page - - @javascript - Scenario: I can describe the project using markup - When I go to the "manage me" project - And I edit the project description to "_successful outcome_: project is *done*" - Then I should see the italic text "successful outcome" in the project description - And I should see the bold text "done" in the project description - - @javascript - Scenario: I can edit the project name in place - Given I have a project "release tracks 1.8" with 1 todos - When I go to the "release tracks 1.8" project - And I edit the project name in place to be "release tracks 2.0" - Then I should see the project name is "release tracks 2.0" - When I go to the projects page - Then I should see that a project named "release tracks 1.8" is not present - And I should see that a project named "release tracks 2.0" is present - - @javascript - Scenario: I cannot edit the project name in two places at once - Given I have a project "release tracks 1.8" with 1 todos - When I go to the "release tracks 1.8" project - And I click to edit the project name in place - Then I should be able to change the project name in place - When I edit the project settings - Then I should not be able to change the project name in place - - # Ticket #1041 - @javascript - Scenario: I can change the name of the project using the Edit Project Settings form - Given I have a project "bananas" with 1 todos - When I go to the "bananas" project - And I edit the project name to "cherries" - Then the project title should be "cherries" - - @javascript - Scenario: I can change the name of the project and it should update the new todo form - Given I have a project "bananas" with 1 todos - When I go to the "bananas" project - And I edit the project name to "cherries" - Then the project title should be "cherries" - And the project field of the new todo form should contain "cherries" - - # Ticket #1789 - @javascript - Scenario: I can change the name of the project and it should still allow me to add new actions - Given I have a project "bananas" - When I go to the "bananas" project - And I edit the project name to "cherries" - And I edit the default context to "@pc" - And I submit a new action with description "a new next action" - Then I should see the todo "a new next action" - - @javascript - Scenario: I can change the default context of the project and it should update the new todo form - Given I have a project "bananas" with 1 todos - When I go to the "bananas" project - And I edit the default context to "@pc" - Then the default context of the new todo form should be "@pc" - # the default context should be prefilled ater submitting a new todo - When I submit a new action with description "test" - Then the default context of the new todo form should be "@pc" - - # Ticket #1042 - @javascript - Scenario: I cannot change the name of a project in the project view to the name of another existing project - Given I have a project "test" with 1 todos - When I go to the projects page - Then the badge should show 2 # "manage me" and "test" - When I go to the "manage me" project - And I try to edit the project name to "test" - Then I should see "Name already exists" - - # Ticket #1042 - @javascript - Scenario: I cannot change the name of a project in the project list view to the name of another existing project - Given I have a project "test" with 1 todos - When I go to the projects page - Then the badge should show 2 # "manage me" and "test" - When I try to edit the project name of "manage me" to "test" - Then I should see "Name already exists" - - @javascript - Scenario: I can add a note to the project - Given I have a project called "test" - When I go to the "test" project - And I add a note "hello I'm testing" to the project - Then I should see one note in the project - - @javascript - Scenario: Cancelling adding a note to the project will remove form - Given I have a project called "test" - When I go to the "test" project - And I cancel adding a note to the project - Then the form for adding a note should not be visible - - @javascript - Scenario: Long notes in a project are shown cut off - Given I have a project called "test" - When I go to the "test" project - And I add a note "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890TOO LONG" to the project - Then I should not see the note "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890TOO LONG" - And I should see the note "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456" - - @javascript - Scenario: Cancelling editing a project will restore project settings - Given I have a project called "test" - When I go to the "test" project - Then I should see the default project settings - When I open the project edit form - Then I should not see the default project settings - When I cancel the project edit form - Then I should see the default project settings - - @javascript - Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages - Given I have a project "test" with 1 todos - When I go to the "test" project - Then I should see "todo 1" in the context container for "Context A" - And I should see empty message for deferred todos of project - And I should see empty message for completed todos of project - When I defer "todo 1" for 1 day - Then I should see "todo 1" in the deferred container - And I should not see empty message for deferred todos of project - And I should see empty message for completed todos of project - And I should see empty message for todos of project - - @javascript - Scenario: Moving the todo out of the tickler will move todo to active container and update empty messages - Given I have a project "test" with 1 deferred todos - When I go to the "test" project - Then I should see "deferred todo 1" in the deferred container - And I should see empty message for todos of project - And I should not see empty message for deferred todos of project - When I clear the show from date of "deferred todo 1" - Then I should see "deferred todo 1" in the action container - And I should see empty message for deferred todos of project - And I should not see empty message for todos of project - - @javascript - Scenario: Making all todos inactive will show empty message - Given I have a project "test" with 1 todos - When I go to the "test" project - And I mark "todo 1" as complete - Then I should see empty message for todos of project - - @javascript - Scenario: Making all deferred todos inactive will show empty message - Given I have a project "test" with 1 deferred todos - When I go to the "test" project - And I mark "deferred todo 1" as complete - Then I should see empty message for todos of project - And I should see empty message for deferred todos of project - - # Ticket #1043 - @javascript - Scenario: I can move a todo out of the current project - Given I have a project "foo" with 2 todos - And I have a project called "bar" - When I go to the "foo" project - And I change the project_name field of "todo 1" to "bar" - Then I should not see the todo "todo 1" - And I should see the todo "todo 2" diff --git a/features/project_list.feature b/features/project_list.feature deleted file mode 100644 index 0a47468b..00000000 --- a/features/project_list.feature +++ /dev/null @@ -1,141 +0,0 @@ -Feature: Manage the list of projects - In order to keep track and manage of all my projects - As a Tracks user - I want to manage my list of projects - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And there exists a project "manage me" for user "testuser" - And there exists a project "upgrade jquery" for user "testuser" - And there exists a project "a project name starting with a" for user "testuser" - And I have logged in as "testuser" with password "secret" - - Scenario: The list of projects contain all projects - When I go to the projects page - Then I should see "manage me" - And I should see "upgrade jquery" - And I should see "a project name starting with a" - And the badge should show 3 - - Scenario: Clicking on a project takes me to the project page - When I go to the projects page - And I follow "manage me" - Then I should be on the "manage me" project page - - @javascript - Scenario: Editing a project name will update the list - When I go to the projects page - And I edit the project name of "manage me" to "manage him" - Then I should see "manage him" - - @javascript - Scenario: Deleting a project will remove it from the list - When I go to the projects page - And I delete project "manage me" - Then I should see that a project named "manage me" is not present - And the badge should show 2 - And the project list badge for "active" projects should show 2 - - @javascript - Scenario: Deleting a project after a edit will remove it from the list - # make sure the js is enabled after an edit and another edit - When I go to the projects page - And I edit the project name of "manage me" to "manage him" - Then I should see a project named "manage him" - When I edit the project name of "manage him" to "manage her" - Then I should see a project named "manage her" - When I delete project "manage her" - Then I should not see a project named "manage her" - And the badge should show 2 - And the project list badge for "active" projects should show 2 - - @javascript - Scenario: Changing project state will move project to other state list - When I go to the projects page - Then the project "manage me" should be in state list "active" - And the project list badge for "active" projects should show 3 - When I edit the project state of "manage me" to "hidden" - Then the project "manage me" should not be in state list "active" - And the project "manage me" should be in state list "hidden" - And the project list badge for "active" projects should show 2 - And the project list badge for "hidden" projects should show 1 - - @javascript - Scenario: Dragging a project to change list order of projects - When I go to the projects page - Then the project "manage me" should be above the project "upgrade jquery" - When I drag the project "manage me" below "upgrade jquery" - Then the project "upgrade jquery" should be above the project "manage me" - - @javascript - Scenario: Hiding and unhiding the new project form - When I go to the projects page - Then the new project form should be visible - When I follow "Hide form" - Then the new project form should not be visible - When I follow "Create a new project" - Then the new project form should be visible - - @javascript - Scenario: Adding a new project - When I go to the projects page - And I submit a new project with name "finish cucumber tests" - Then I should see "finish cucumber tests" - And the badge should show 4 - And the project list badge for "active" projects should show 4 - - @javascript - Scenario: Adding a new project and take me to the project page - When I go to the projects page - And I submit a new project with name "finish cucumber tests" and select take me to the project - Then I should be on the "finish cucumber tests" project page - - @javascript - Scenario: Sorting the project alphabetically - When I go to the projects page - Then the project "manage me" should be above the project "a project name starting with a" - When I sort the active list alphabetically - Then the project "a project name starting with a" should be above the project "manage me" - - @javascript - Scenario: Sorting the project by number of task - Given I have a project "test" with 2 todos - And I have a project "very busy" with 10 todos - When I go to the projects page - Then the project "test" should be above the project "very busy" - When I sort the active list by number of tasks - Then the project "very busy" should be above the project "test" - - @javascript - Scenario: Can add a project with comma in the name - When I go to the projects page - And I submit a new project with name "foo,bar" - Then I should see "foo,bar" - And the badge should show 4 - And the project list badge for "active" projects should show 4 - - @javascript - Scenario: Listing projects with only active actions - Given I have a project "do it now" with 2 active todos - When I go to the projects page - Then the project "do it now" should have 2 actions listed - - @javascript - Scenario: Listing projects with both active and deferred actions - Given I have a project "now and later" with 2 active actions and 2 deferred actions - When I go to the projects page - Then the project "now and later" should have 2 actions listed - - @javascript - Scenario: Listing projects with only deferred actions - Given I have a project "only later" with 3 deferred actions - When I go to the projects page - Then the project "only later" should have 3 deferred actions listed - - @javascript - Scenario: Listing projects with no actions - Given I have a project "all done" with 0 active actions and 0 deferred actions - When I go to the projects page - Then the project "all done" should have 0 actions listed diff --git a/features/recurring_todos.feature b/features/recurring_todos.feature deleted file mode 100644 index b469ab4a..00000000 --- a/features/recurring_todos.feature +++ /dev/null @@ -1,87 +0,0 @@ -Feature: Manage recurring todos - In order to manage recurring todos - As a Tracks user - I want to view, edit, add, or remove recurrence patterns of recurring todos - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "test context" - And I have a recurrence pattern called "run tests" - - @javascript - Scenario: Being able to select daily, weekly, monthly and yearly pattern - When I go to the recurring todos page - And I follow "Add a new recurring action" - Then I should see the form for "Daily" recurrence pattern - When I select "Weekly" recurrence pattern - Then I should see the form for "Weekly" recurrence pattern - When I select "Monthly" recurrence pattern - Then I should see the form for "Monthly" recurrence pattern - When I select "Yearly" recurrence pattern - Then I should see the form for "Yearly" recurrence pattern - When I select "Daily" recurrence pattern - Then I should see the form for "Daily" recurrence pattern - - @javascript - Scenario: I can mark a recurrence pattern as starred - When I go to the recurring todos page - And I star the pattern "run tests" - Then the pattern "run tests" should be starred - - @javascript - Scenario: I can edit a recurrence pattern - When I go to the recurring todos page - And I edit the name of the pattern "run tests" to "report test results" - Then the pattern "report test results" should be in the state list "active" - And I should not see "run tests" - - @javascript - Scenario: I can delete a recurrence pattern - When I go to the recurring todos page - And I delete the pattern "run tests" - And I should not see "run tests" - - @javascript - Scenario: I can mark a recurrence pattern as done - When I go to the recurring todos page - Then the pattern "run tests" should be in the state list "active" - And the state list "completed" should be empty - When I mark the pattern "run tests" as complete - Then the pattern "run tests" should be in the state list "completed" - And the state list "active" should be empty - - @javascript - Scenario: I can reactivate a recurrence pattern - Given I have a completed recurrence pattern "I'm done" - When I go to the recurring todos page - Then the pattern "I'm done" should be in the state list "completed" - When I mark the pattern "I'm done" as active - Then the pattern "I'm done" should be in the state list "active" - And the state list "completed" should be empty - - @javascript - Scenario: Following the recurring todo link of a todo takes me to the recurring todos page - When I go to the home page - Then I should see the todo "run tests" - When I follow the recurring todo link of "run tests" - Then I should be on the recurring todos page - - @javascript - Scenario: Deleting a recurring todo with ending pattern will show message - When I go to the recurring todos page - And I mark the pattern "run tests" as complete - And I go to the home page - Then I should see "run tests" - When I delete the action "run tests" - Then I should see "There is no next action after the recurring action you just deleted. The recurrence is completed" - - @javascript - Scenario: Deleting a recurring todo with active pattern will show new todo - When I go to the home page - Then I should see "run tests" - When I delete the action "run tests" - Then I should see "Action was deleted. Because this action is recurring, a new action was added" - And I should see "run tests" in the context container for "test context" \ No newline at end of file diff --git a/features/review.feature b/features/review.feature deleted file mode 100644 index c41a4aa6..00000000 --- a/features/review.feature +++ /dev/null @@ -1,60 +0,0 @@ -Feature: Reviewing projects - In order to keep the todos and projects up to date - As a Tracks user - I want to review my projects - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - Scenario: I see stalled projects - Given I have no projects - Given I have a project "stalled_project" with 0 todos - When I go to the review page - Then I see the project "stalled_project" in the "stalled" list - - Scenario: I see blocked projects - Given I have no projects - Given I have a project "blocked_project" with 1 deferred todos - When I go to the review page - Then I see the project "blocked_project" in the "blocked" list - - Scenario: I see dated projects - Given I have no projects - Given I have an outdated project "dated_project" with 1 todos - When I go to the review page - Then I see the project "dated_project" in the "review" list - - Scenario: The review list of projects contains all projects - Given I have no projects - Given I have a project "stalled_project" with 0 todos - Given I have a project "blocked_project" with 1 deferred todos - Given I have an outdated project "dated_project" with 1 todos - When I go to the review page - And the badge should show 5 ## note that stalled and blocked projects are also up-to-date listed - - @javascript - Scenario: I can mark a project as reviewed from the projects list page - Given I have a project called "review me" - When I go to the projects page - Then I should see "review me" - When I edit project "review me" and mark the project as reviewed - Then I should be on the projects page - And I should see "review me" - - @javascript - Scenario: I can mark a project as reviewed from the project page - Given I have a project called "review me" - When I go to the "review me" project - When I edit project settings and mark the project as reviewed - Then I should be on the "review me" project - - @javascript - Scenario: I can mark a project as reviewed from the review page - Given I have an outdated project "review me" with 1 todos - When I go to the review page - Then I should see "review me" - When I edit project "review me" and mark the project as reviewed - Then I should be on the review page \ No newline at end of file diff --git a/features/search.feature b/features/search.feature deleted file mode 100644 index ef725755..00000000 --- a/features/search.feature +++ /dev/null @@ -1,81 +0,0 @@ -Feature: Show all due actions in a calendar view - As a Tracks user - In order to keep overview of my due todos - I want to manage due todos in a calendar view - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - Scenario: I can search for todos by partial description - Given I have the following todos: - | description | context | - | tester of stuff | @home | - | testing search | @work | - | unrelated stuff | @home | - When I go to the search page - And I search for "test" - Then I should see "tester" - And I should see "testing search" - When I go to the search page - And I search for "stuff" - Then I should see "tester of stuff" - And I should see "unrelated stuff" - - @javascript - Scenario: I can edit found todos - Given I have the following todos: - | description | context | - | tester of stuff | @home | - | testing search | @work | - When I go to the search page - And I search for "test" - Then I should see the todo "tester of stuff" - When I star the action "tester of stuff" - Then I should see a starred "tester of stuff" - When I edit the description of "tester of stuff" to "test 1-2-3" - Then I should not see the todo "tester of stuff" - And I should see the todo "test 1-2-3" - When I go to the search page - And I search for "test" - Then I should not see the todo "tester of stuff" - And I should see the todo "test 1-2-3" - - @javascript - Scenario: I can delete found todos - Given I have the following todos: - | description | context | - | tester of stuff | @home | - | testing search | @work | - When I go to the search page - And I search for "test" - Then I should see "tester of stuff" - When I delete the action "tester of stuff" - Then I should not see "tester of stuff" - When I go to the search page - And I search for "test" - Then I should not see "tester of stuff" - - @javascript - Scenario: I can mark found todos complete and uncomplete - Given I have the following todos: - | description | context | - | tester of stuff | @home | - | testing search | @work | - When I go to the search page - And I search for "test" - Then I should see an active todo "tester of stuff" - When I mark "tester of stuff" as complete - Then I should see a completed todo "tester of stuff" - # the completed todo should show up on the next search too - When I go to the search page - And I search for "test" - Then I should see a completed todo "tester of stuff" - When I mark "tester of stuff" as uncompleted - Then I should see an active todo "tester of stuff" - # the active todo should show up on the next search too - When I go to the search page - And I search for "test" - Then I should see an active todo "tester of stuff" diff --git a/features/shared_add_new_todo.feature b/features/shared_add_new_todo.feature deleted file mode 100644 index 76064f15..00000000 --- a/features/shared_add_new_todo.feature +++ /dev/null @@ -1,321 +0,0 @@ -Feature: Add new next action from every page - In order to quickly add a new next action - As a Tracks user - I want to to be able to add one or more new next actions from every page - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "test context" - And I have a project "test project" - - @javascript - Scenario Outline: I can hide the input form for single next action on a page - When I go to the - Then the single action form should be visible - When I follow "Hide form" - Then the single action form should not be visible - - Scenarios: - | page | - | home page | - | tickler page | - | "test project" project | - | context page for "test context" | - | tag page for "starred" | - - @javascript - Scenario Outline: I can hide the input form for multiple next actions - When I go to the - Then the single action form should be visible - When I follow "Add multiple next actions" - Then the multiple action form should be visible - When I follow "Hide form" - Then the single action form should not be visible - And the multiple action form should not be visible - - Scenarios: - | page | - | home page | - | tickler page | - | "test project" project | - | context page for "test context" | - | tag page for "starred" | - - @javascript - Scenario Outline: I can hide the input form and then choose both input forms - When I go to the - Then the single action form should be visible - When I follow "Hide form" - Then the single action form should not be visible - When I follow "Add multiple next actions" - Then the multiple action form should be visible - When I follow "Hide form" - Then the single action form should not be visible - And the multiple action form should not be visible - - Scenarios: - | page | - | home page | - | tickler page | - | "test project" project | - | context page for "test context" | - | tag page for "starred" | - - @javascript - Scenario Outline: I can switch forms for single next action to multiple next actions - When I go to the - Then the single action form should be visible - When I follow "Add multiple next actions" - Then the single action form should not be visible - And the multiple action form should be visible - When I follow "Add a next action" - Then the single action form should be visible - And the multiple action form should not be visible - - Scenarios: - | page | - | home page | - | tickler page | - | "test project" project | - | context page for "test context" | - | tag page for "starred" | - - @javascript - Scenario Outline: I can add a todo from several pages - Given I have selected the view for group by - When I go to the - And I submit a new action with description "a new next action" - Then I should the todo "a new next action" - - Scenarios: - | page | grouping | see | - | home page | context | see | - | home page | project | see | - | tickler page | context | not see | - | tickler page | project | not see | - | "test project" project | context | see | - | "test project" project | project | see | - | context page for "test context" | context | see | - | context page for "test context" | project | see | - | tag page for "starred" | context | see | - | tag page for "starred" | project | see | - - @javascript - Scenario Outline: I can add multiple todos from several pages - Given I have a project "testing" with 1 todos - And I have selected the view for group by - When I go to the - And I follow "Add multiple next actions" - And I submit multiple actions with using - """ - one new next action - another new next action - """ - Then I should the todo "one new next action" - And I should the todo "another new next action" - And the badge should show - And the number of actions should be - - Scenarios: - | page | see | badge | count | grouping | - | home page | see | 3 | 3 | context | - | home page | see | 3 | 3 | project | - | tickler page | not see | 0 | 3 | context | - | tickler page | not see | 0 | 3 | project | - | "testing" project | see | 3 | 3 | context | - | "testing" project | see | 3 | 3 | project | - | context page for "test context" | see | 2 | 3 | context | - | context page for "test context" | see | 2 | 3 | project | - | tag page for "starred" | see | 2 | 3 | context | - | tag page for "starred" | see | 2 | 3 | project | - - @javascript - Scenario: Adding a todo to another project does not show the todo in project view - Given I have a project called "another project" - When I go to the "test project" project - And I submit a new action with description "can you see me?" to project "another project" in the context "test context" - Then I should not see "can you see me?" - When I go to the "another project" project - Then I should see "can you see me?" - - @javascript - Scenario: Adding a deferred todo to another project does not show the todo - # scenario for #1146 - Given I have a project called "another project" - When I go to the "test project" project - And I submit a deferred new action with description "a new next action" to project "another project" in the context "test context" - Then I should not see the todo "a new next action" - And I submit a deferred new action with description "another new next action" to project "test project" in the context "test context" - Then I should see the todo "another new next action" - - @javascript - Scenario Outline: Adding a todo with a new context shows the new context when page groups todos by context - When I go to the - And I submit a new with description "do at new context" and the tags "starred" in the context "New" - Then a confirmation for adding a new context "New" should be asked - And the container for the context "New" should - And the badge should show - - Scenarios: - | page | todo | badge | visible | - | home page | action | 1 | be visible | - | tickler page | deferred action | 1 | be visible | - | "test project" project | action | 1 | not be visible | - | context page for "test context" | action | 1 | not be visible | - | tag page for "starred" | action | 1 | be visible | - - @javascript - Scenario Outline: Adding a todo with a new project shows the new project when page groups todos by project - And I have selected the view for group by project - When I go to the - And I submit a new with description "do in new project" to project "New" with tags "starred" - Then the container for the project "New" should - And the badge should show - - Scenarios: - | page | todo | badge | visible | - | home page | action | 1 | be visible | - | tickler page | deferred action | 1 | be visible | - | "test project" project | action | 1 | not be visible | - | context page for "test context" | action | 1 | not be visible | - | tag page for "starred" | action | 1 | be visible | - - @javascript - Scenario Outline: Adding a todo to a hidden project does not show the todo - Given I have a hidden project called "hidden project" - And I have a project called "visible project" - And I have a context called "visible context" - And I have a context called "other context" - And I have selected the view for group by - When I go to the - And I submit a new action with description "hidden todo" to project "hidden project" with tags "test" in the context "visible context" - Then I should the todo "hidden todo" - When I submit a new action with description "visible todo" to project "visible project" with tags "test" in the context "visible context" - Then I should the todo "visible todo" - - Scenarios: - | page | grouping | see_hidden | see_visible | - | home page | context | not see | see | - | home page | project | not see | see | - | tickler page | context | not see | not see | - | tickler page | project | not see | not see | - | "visible project" project | project | not see | see | - | "visible project" project | context | not see | see | - | "hidden project" project | project | see | not see | - | "hidden project" project | context | see | not see | - | context page for "visible context" | context | not see | see | - | context page for "visible context" | project | not see | see | - | context page for "other context" | context | not see | not see | - | context page for "other context" | project | not see | not see | - | tag page for "starred" | context | not see | not see | - | tag page for "starred" | project | not see | not see | - | tag page for "test" | context | see | see | - | tag page for "test" | project | see | see | - - @javascript - Scenario: Adding a todo to a hidden context from home page does not show the todo - Given I have a context called "visible context" - And I have a hidden context called "hidden context" - When I go to the home page - And I submit a new action with description "a new todo" in the context "visible context" - Then I should see "a new todo" - When I submit a new action with description "another new todo" in the context "hidden context" - Then I should not see "another new todo" - - @javascript - Scenario: Adding a todo to a context shows the todo in that context page - Given I have a context called "visible context" - And I have a hidden context called "hidden context" - When I go to the context page for "visible context" - And I submit a new action with description "a new todo" in the context "visible context" - Then I should see "a new todo" - When I go to the context page for "hidden context" - And I submit a new action with description "another new todo" in the context "hidden context" - Then I should see "another new todo" - - @javascript - Scenario Outline: Adding a todo to an empty container hides the empty message - Given I have a context called "visible context" - And I have a project called "visible project" - And I have selected the view for group by - When I go to the tag page for "test" - Then I should see empty message for todos of tag - When I submit a new action with description "a new todo" to project "visible project" with tags "test" in the context "visible context" - Then I should see "a new todo" - And I should not see empty message for todos of tag - - Scenarios: - | grouping | - | context | - | project | - - @javascript @wip - Scenario Outline: Adding a dependency to a todo updates the successor - Given I have a "test" with 1 todos - When I go to the "test" - Then I should see "todo 1" - When I submit a new action with description "a new todo" with a dependency on "todo 1" - Then I should not see "a new todo" in the container of "test" - When I expand the dependencies of "todo 1" - Then I should see "a new todo" within the dependencies of "todo 1" - And I should not see empty message for deferred todos of - - Examples: - | list_type | - | project | - | context | - - @javascript - Scenario: Adding a dependency to a todo in another project - Given I have a project "testing" with 1 todos - And I have a project "another project" - When I go to the "another project" project - And I submit a new action with description "a new todo" with a dependency on "todo 1" - Then I should not see "a new todo" in the project container of "another project" - And I should not see empty message for deferred todos of project - - @javascript - Scenario Outline: I can add multiple todos in a new project and a new context - Given I have selected the view for group by - When I go to the home page - And I follow "Add multiple next actions" - And I fill the multiple actions form with "", "a next project", "@anywhere", "new tag" - And I submit the new multiple actions form with - """ - - a - b - c - - - """ - Then a confirmation for adding a new context "@anywhere" should be asked - Then I should see "@anywhere" - And I should see "a" - And I should see "b" - And I should see "c" - - Scenarios: - | grouping | - | project | - | context | - - - @javascript - Scenario: I need to fill in at least one description and a context - When I go to the home page - And I follow "Add multiple next actions" - And I submit the new multiple actions form with "", "", "", "" - Then I should see "You need to submit at least one next action" - When I submit the new multiple actions form with "one", "", "", "" - Then I should see "Context can't be blank" - When I fill the multiple actions form with "", "a project", "test context", "tag" - And I submit the new multiple actions form with - """ - - - """ - Then I should see "You need to submit at least one next action" diff --git a/features/show_statistics.feature b/features/show_statistics.feature deleted file mode 100644 index 40f3fa92..00000000 --- a/features/show_statistics.feature +++ /dev/null @@ -1,81 +0,0 @@ -Feature: Show statistics - In order to see what I have got done - As an user - I want see my statistics - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - Given I have logged in as "testuser" with password "secret" - - Scenario: Show statistics with no history - Given I have no todos - When I go to the statistics page - Then I should see "Totals" - And I should see " More statistics will appear here once you have added some actions." - - Scenario: Show statistics with history - Given I have 5 todos - And I have 2 deferred todos - And I have 2 completed todos - When I go to the statistics page - And I should see "You have 7 incomplete actions" - And I should see "of which 2 are deferred actions" - And I should see "you have a total of 9 actions" - And I should see "2 of these are completed" - Then I should see "Totals" - And I should see "actions" - And I should see "Contexts" - And I should see "Projects" - And I should see "Tags" - - Scenario: Click through to see chart of all actions per month - Given I have 5 todos - When I go to the statistics page - And I click on the chart for actions done in the last 12 months - Then I should see a chart - And I should see "to return to the statistics page" - - Scenario: Click through to see all incomplete actions of a week - Given I have 5 todos - And I have 2 deferred todos - When I go to the statistics page - And I click on the chart for running time of all incomplete actions - Then I should see a chart - And I should see "Actions selected from week" - And I should see 7 todos - And I should see "to return to the statistics page" - And I should see "to show the actions from week 0 and further" - - Scenario: Click through to see all incomplete visible actions of a week - Given I have 5 todos - And I have 3 deferred todos - When I go to the statistics page - And I click on the chart for running time of all incomplete visible actions - Then I should see a chart - And I should see "Actions selected from week" - And I should see 5 todos - And I should see "to return to the statistics page" - And I should see "to show the actions from week 0 and further" - - @javascript - Scenario: I can edit the todos selected from a chart - Given I have 5 todos - When I go to the statistics page - And I click on the chart for running time of all incomplete actions - Then I should see 5 todos - And I should see "todo 1" - When I edit the description of "todo 1" to "foo bar" - Then I should not see the todo "todo 1" - And I should see the todo "foo bar" - - @javascript - Scenario: Marking a todo selected from a chart as complete will remove it from the page - Given I have 5 todos - When I go to the statistics page - And I click on the chart for running time of all incomplete actions - Then I should see 5 todos - And I should see "todo 1" - When I mark "todo 1" as complete - Then I should not see the todo "todo 1" \ No newline at end of file diff --git a/features/step_definitions/console_steps.rb b/features/step_definitions/console_steps.rb deleted file mode 100644 index 4f9319ba..00000000 --- a/features/step_definitions/console_steps.rb +++ /dev/null @@ -1,59 +0,0 @@ -Given /^a template that looks like$/ do |template| - steps %{ - Given a file named "template.txt" with: - """ - #{template} - """ - } -end - -Given /^a console input that looks like$/ do |input| - steps %{ - Given a file named "todo.txt" with: - """ - #{input} - """ - } -end - -When /^I execute the template script$/ do - step "I cd to \"../..\"" - - context_id = @current_user.contexts.first.id - port = Capybara.current_session.server.port - - # assumes there is a context with id=1 - cli = "ruby doc/tracks_template_cli.rb -c #{context_id} -f tmp/aruba/template.txt" - - set_env('GTD_LOGIN','testuser') - set_env('GTD_PASSWORD', 'secret') - set_env('GTD_TODOS_URL', "http://localhost:#{port}/todos.xml") - set_env('GTD_PROJECTS_URL', "http://localhost:#{port}/projects.xml") - set_env('GTD_CONTEXT_URL_PREFIX', "http://localhost:#{port}/contexts/") - set_env("GTD_CONTEXT_URL","http://localhost:#{port}/contexts.xml") - - step "I run `#{cli}`" -end - -When /^I execute the add-todo script$/ do - step "I cd to \"../..\"" - - # assumes there is a context and a project - context_id = @current_user.contexts.first.id - project_id = @current_user.projects.first.id - port = Capybara.current_session.server.port - - cli = "ruby doc/tracks_cli_client.rb -c #{context_id} -p #{project_id}" - - set_env('GTD_LOGIN','testuser') - set_env('GTD_PASSWORD', 'secret') - set_env('GTD_TODOS_URL', "http://localhost:#{port}/todos.xml") - - step "I run `#{cli}` interactively" - step "I pipe in the file \"tmp/aruba/todo.txt\"" - - # it seems aruba does not wait for process to end with interactively run command, but - # continues anyway which will start cleaning up the database while the process is still running - # so wait 2.5 secs for the process to finish - sleep 2.5 -end \ No newline at end of file diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb deleted file mode 100644 index 081f42a4..00000000 --- a/features/step_definitions/container_steps.rb +++ /dev/null @@ -1,154 +0,0 @@ -When(/^I collapse the context container of "([^"]*)"$/) do |context_name| - toggle = page.find(:xpath, toggle_context_container_xpath(find_context(context_name))) - expect(toggle).to be_visible - toggle.click -end - -When(/^I collapse the project container of "(.*?)"$/) do |project_name| - toggle = page.find(:xpath, toggle_project_container_xpath(find_project(project_name))) - expect(toggle).to be_visible - toggle.click -end - -When /^I toggle all collapsed context containers$/ do - open_view_menu do - click_link 'Toggle collapsed contexts' - end -end - -####### Context ####### - -Then(/^I should (see|not see) the context "([^"]*)"$/) do |visible, context_name| - check_xpath_visibility(visible, context_container_xpath(find_context(context_name))) -end - -Then /^I should (see|not see) the container for context "([^"]*)"$/ do |visible, context_name| - step("I should #{visible} the context \"#{context_name}\"") -end - -Then /^I should (see|not see) the context container for "([^"]*)"$/ do |visible, context_name| - step "I should #{visible} the context \"#{context_name}\"" -end - -Then(/^the container for the context "([^"]*)" should (be|not be) visible$/) do |context_name, visible| - mapping = {"be" => "see", "not be" => "not see"} - step "I should #{mapping[visible]} the context \"#{context_name}\"" -end - -Then /^I should (see|not see) "([^"]*)" in the context container for "([^"]*)"$/ do |visible, todo_description, context_name| - check_xpath_visibility(visible, todo_in_context_container_xpath(find_todo(todo_description), find_context(context_name))) -end - -Then(/^I should (see|not see) "([^"]*)" in the context container of "([^"]*)"$/) do |visible, todo_description, context_name| - step "I should #{visible} \"#{todo_description}\" in the context container for \"#{context_name}\"" -end - -Then /^I should (see|not see) "([^"]*)" in the container for context "([^"]*)"$/ do |visible, todo_description, context_name| - step "I should #{visible} \"#{todo_description}\" in the context container for \"#{context_name}\"" -end - -####### Deferred ####### - -Then(/^I should (not see|see) "([^"]*)" in the deferred container$/) do |visible, todo_description| - check_xpath_visibility(visible, todo_in_deferred_container_xpath(find_todo(todo_description))) -end - -Then(/^I should (not see|see) "([^"]*)" in the action container$/) do |visible, todo_description| - check_xpath_visibility(visible, todo_in_container_xpath(find_todo(todo_description), @source_view.to_sym)) -end - -####### Project ####### - -Then /^I should (see|not see) "([^"]*)" in the project container of "([^"]*)"$/ do |visible, todo_description, project_name| - check_xpath_visibility(visible, todo_in_project_container_xpath(find_todo(todo_description), find_project(project_name))) -end - -Then(/^I should (see|not see) "(.*?)" in the container for project "(.*?)"$/) do |visible, todo_description, project_name| - step "I should #{visible} \"#{todo_description}\" in the project container of \"#{project_name}\"" -end - -Then(/^I should (see|not see) "(.*?)" in the project container for "(.*?)"$/) do |visible, todo_description, project_name| - step "I should #{visible} \"#{todo_description}\" in the project container of \"#{project_name}\"" -end - -Then(/^I should (see|not see) the project container for "([^"]*)"$/) do |visible, project_name| - check_xpath_visibility(visible, project_container_xpath(find_project(project_name))) -end - -Then(/^I should (see|not see) the container for project "(.*?)"$/) do |visible, project_name| - step "I should #{visible} the project container for \"#{project_name}\"" -end - -Then(/^the container for the project "(.*?)" should (be visible|not be visible)$/) do |project_name, visible| - map = { "be visible" => "see", "not be visible" => "not see"} - step("I should #{map[visible]} the project container for \"#{project_name}\"") -end - -####### Completed ####### - -Then(/^I should (not see|see) "([^"]*)" in the (completed|done today|done this week|done this month) container$/) do |visible, todo_description, container| - id = 'completed_container' if container == 'completed' - id = 'completed_today_container' if container == 'done today' - id = 'completed_rest_of_week_container' if container == 'done this week' - id = 'completed_rest_of_month_container' if container == 'done this month' - - css = "div##{id} div#line_todo_#{find_todo(todo_description).id}" - check_css_visibility(visible, css) -end - -####### Hidden ####### - -Then /^I should (not see|see) "([^"]*)" in the hidden container$/ do |visible, todo_description| - xpath = "//div[@id='hidden_container']//div[@id='line_todo_#{find_todo(todo_description).id}']" - check_xpath_visibility(visible, xpath) -end - -####### Calendar ####### - -Then /^I should see "([^"]*)" in the due next month container$/ do |todo_description| - within "div#due_after_this_month_container" do - expect(page).to have_css("div#line_todo_#{find_todo(todo_description).id}") - end -end - -####### Recurrence patterns ####### - -Then /^I should (see|not see) "([^"]*)" in the active recurring todos container$/ do |visibility, recurrence_pattern| - recurrence = @current_user.recurring_todos.where(:description => recurrence_pattern).first - - unless recurrence.nil? - xpath = "//div[@id='active_recurring_todos_container']//div[@id='recurring_todo_#{recurrence.id}']" - check_xpath_visibility(visibility, xpath) - else - step "I should #{visibility} \"#{recurrence_pattern}\"" - end -end - -Then /^I should (see|not see) "([^"]*)" in the completed recurring todos container$/ do |visible, recurrence_pattern| - recurrence = @current_user.todos.where(:description => recurrence_pattern).first - - unless recurrence.nil? - xpath = "//div[@id='completed_recurring_todos_container']//div[@id='recurring_todo_#{recurrence.id}']" - check_xpath_visibility(visible, xpath) - else - step "I should #{visible} \"#{recurrence_pattern}\"" - end -end - -####### Empty message patterns ####### - -Then /^I should (see|not see) empty message for (done today|done this week|done this month|completed todos|deferred todos|todos) (of done actions|of context|of project|of home|of tag)/ do |visible, state, type| - css = "error: wrong state" - css = "div#c#{@context.id}-empty-d" if state == "todos" - css = "div#no_todos_in_view" if state == "todos" && ["of home", "of tag", "of context", "of project"].include?(type) - css = "div#completed_today_container" if state == "done today" - css = "div#completed_rest_of_week_container" if state == "done this week" - css = "div#completed_rest_of_month_container" if state == "done this month" - css = "div#completed_container-empty-d" if state == "completed todos" - css = "div#deferred_pending_container-empty-d" if state == "deferred todos" - - elem = find(css) - expect(elem).to_not be_nil - - check_elem_visibility(visible, elem) -end \ No newline at end of file diff --git a/features/step_definitions/context_list_steps.rb b/features/step_definitions/context_list_steps.rb deleted file mode 100644 index e4080a94..00000000 --- a/features/step_definitions/context_list_steps.rb +++ /dev/null @@ -1,96 +0,0 @@ -When /^I delete the context "([^\"]*)"$/ do |context_name| - context = find_context(context_name) - - handle_js_confirm do - click_link "delete_context_#{context.id}" - end - expect(get_confirm_text).to eq("Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (recurring) actions in this context!") - - # wait until the context is removed - expect(page).to_not have_css("a#delete_context_#{context.id}") -end - -When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name| - find("a#link_edit_context_#{@context.id}").click - - wait_for_context_form_to_appear(@context) - - within "div.edit-form" do - fill_in "context_name", :with => new_name - click_button "submit_context_#{@context.id}" - end - - wait_for_context_form_to_go_away(@context) -end - -When(/^I add a new context "([^"]*)"$/) do |context_name| - fill_in "context[name]", :with => context_name - submit_new_context_form -end - -When(/^I add a new active context "([^"]*)"$/) do |context_name| - step "I add a new context \"#{context_name}\"" -end - -When(/^I add a new hidden context "([^"]*)"$/) do |context_name| - fill_in "context[name]", :with => context_name - check "context_state_hide" - submit_new_context_form -end - -When(/^I drag context "([^"]*)" above context "([^"]*)"$/) do |context_drag, context_drop| - drag_id = find_context(context_drag).id - - drag_index = context_list_find_index(context_drag) - drop_index = context_list_find_index(context_drop) - - context_drag_and_drop(drag_id, drop_index-drag_index) -end - -When /^I edit the state of context "(.*?)" to closed$/ do |context_name| - context = find_context(context_name) - - open_context_edit_form(context) - # change state - within "form#edit_form_context_#{context.id}" do - find("input#context_state_closed").click - click_button "submit_context_#{context.id}" - end - - wait_for_context_form_to_go_away(context) -end - -Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low| - sleep 0.2 - expect(context_list_find_index(context_high)).to be < context_list_find_index(context_low) -end - -Then(/^I should see that a context named "([^"]*)" (is|is not) present$/) do |context_name, present| - is_not = present=="is not" ? "not " : "" - within "div#display_box" do - step "I should #{is_not}see \"#{context_name}\"" - end -end - -Then /^I should see that the context container for (.*) contexts (is|is not) present$/ do |state, visible| - v = {"is" => "see", "is not" => "not see"}[visible] # map is|is not to see|not see - check_css_visibility(v, "div#list-#{state}-contexts-container" ) -end - -Then /^I should see the context "([^"]*)" under "([^"]*)"$/ do |context_name, state| - context = find_context(context_name) - check_css_visibility("see", "div#list-contexts-#{state} div#context_#{context.id}") -end - -Then /^the new context form should (be|not be) visible$/ do |visible| - v = {"be" => "see", "not be" => "not see"}[visible] # map be|not be to see|not see - check_css_visibility(v, "div#context_new") -end - -Then /^the context list badge for ([^"]*) contexts should show (\d+)$/ do |state_name, count| - expect(find("span##{state_name}-contexts-count").text).to eq(count) -end - -Then /^I should (see|not see) empty message for (active|hidden|closed) contexts$/ do |visible, state| - check_css_visibility(visible, "div##{state}-contexts-empty-nd") -end diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb deleted file mode 100644 index e1c05153..00000000 --- a/features/step_definitions/context_steps.rb +++ /dev/null @@ -1,74 +0,0 @@ -Given /^I have no contexts$/ do - # should probably not be needed as you use this given at the start of a scenario - Context.delete_all -end - -Given /^there exists (an active|a hidden|a closed) context called "([^"]*)" for user "([^"]*)"$/ do |state, context_name, login| - user = User.where(:login => login).first - expect(user).to_not be_nil - context_state = {"an active" => "active", "a hidden" => "hidden", "a closed" => "closed"}[state] - @context = user.contexts.where(:name => context_name, :state => context_state).first_or_create -end - -Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login| - step "there exists an active context called \"#{context_name}\" for user \"#{login}\"" -end - -Given /^I have a context called "([^\"]*)"$/ do |context_name| - step "there exists an active context called \"#{context_name}\" for user \"#{@current_user.login}\"" -end - -Given /^I have (an active|a hidden|a closed) context called "([^\"]*)"$/ do |state, context_name| - step "there exists #{state} context called \"#{context_name}\" for user \"#{@current_user.login}\"" -end - -Given /^I have the following contexts:$/ do |table| - table.hashes.each do |context| - step 'I have a context called "'+context[:context]+'"' - @context.state = (context[:hide] == "true") ? 'hidden' : 'active' 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 - @context.move_to_bottom - @context.save! - end -end - -Given /^I have the following contexts$/ do |table| - step("I have the following contexts:", table) -end - -Given /^I have a context "([^\"]*)" with (\d+) (?:actions|todos)$/ do |context_name, number_of_actions| - context = @current_user.contexts.create!(:name => context_name) - @todos=[] - 1.upto number_of_actions.to_i do |i| - @todos << @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}") - end -end - -Given /^I have a context "([^\"]*)" with (\d+) deferred (?:actions|todos)$/ do |context_name, number_of_actions| - step "I have a context \"#{context_name}\" with #{number_of_actions} actions" - @todos.each {|todo| todo.description = "deferred "+todo.description; todo.show_from = Time.zone.now + 1.week; todo.save!} -end - -When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name| - page.find("span#context_name").click - fill_in "value", :with => new_context_name - click_button "Ok" - wait_for_ajax -end - -Then /^I should see the context name is "([^\"]*)"$/ do |context_name| - step "I should see \"#{context_name}\"" -end - -Then /^he should see that a context named "([^\"]*)" (is|is not) present$/ do |context_name, visible| - context = @current_user.contexts.where(:name => context_name).first - if visible == "is" - expect(context).to_not be_nil - css = "div#context_#{context.id} div.context_description a" - expect(page).to have_selector(css, :visible => true) - expect(page.find(:css, css).text).to eq(context_name) - else - expect(page).to_not have_selector("div#context_#{context.id} div.context_description a", :visible => true) if context - end -end diff --git a/features/step_definitions/dependencies_steps.rb b/features/step_definitions/dependencies_steps.rb deleted file mode 100644 index 88e782ab..00000000 --- a/features/step_definitions/dependencies_steps.rb +++ /dev/null @@ -1,117 +0,0 @@ -Given /^"([^"]*)" depends on "([^"]*)"$/ do |successor_name, predecessor_name| - successor = Todo.where(:description => successor_name).first - predecessor = Todo.where(:description => predecessor_name).first - - successor.add_predecessor(predecessor) - successor.state = "pending" - successor.save! -end - -When /^I drag "(.*)" to "(.*)"$/ do |dragged, target| - drag_id = Todo.where(:description => dragged).first.id - drop_id = Todo.where(:description => target).first.id - drag_elem = page.find("div#line_todo_#{drag_id} img.grip") - drop_elem = page.find("div#line_todo_#{drop_id}") - - drag_elem.drag_to(drop_elem) -end - -When /^I expand the dependencies of "([^\"]*)"$/ do |todo_name| - todo = Todo.where(:description=>todo_name).first - expect(todo).to_not be_nil - - expand_img_locator = "//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img" - page.find(:xpath, expand_img_locator).click - - wait_for_animations_to_end -end - -When /^I edit the dependency of "([^"]*)" to add "([^"]*)" as predecessor$/ do |todo_description, predecessor_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - predecessor = @current_user.todos.where(:description => predecessor_description).first - expect(predecessor).to_not be_nil - - open_edit_form_for(todo) - - form_css = "form#form_todo_#{todo.id}" - within form_css do - fill_in 'predecessor_input', :with => predecessor_description - end - - # in webkit, the autocompleter is not fired after fill_in - page.execute_script %Q{$("#{form_css}").find('input[id$="predecessor_input"]').autocomplete('search')} if Capybara.javascript_driver == :webkit - - # click first line - page.find('ul.ui-autocomplete li.ui-state-focus').click - - # wait for the new dependency to be added to the list - expect(page).to have_css("li#pred_#{predecessor.id}") - - submit_edit_todo_form(todo) -end - -When /^I edit the dependency of "([^"]*)" to remove "([^"]*)" as predecessor$/ do |todo_description, predecessor_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - predecessor = @current_user.todos.where(:description => predecessor_description).first - expect(predecessor).to_not be_nil - - open_edit_form_for(todo) - - delete_dep_button = "//form[@id='form_todo_#{todo.id}']//img[@id='delete_dep_#{predecessor.id}']" - page.find(:xpath, delete_dep_button).click - - expect(page).to_not have_xpath(delete_dep_button) - - submit_edit_todo_form(todo) - wait_for_ajax - wait_for_animations_to_end -end - -When /^I edit the dependency of "([^"]*)" to "([^"]*)"$/ do |todo_name, deps| - todo = @dep_todo = @current_user.todos.where(:description => todo_name).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - fill_in "predecessor_list_todo_#{todo.id}", :with => deps - submit_edit_todo_form(todo) -end - -Then /^the successors of "(.*)" should include "(.*)"$/ do |parent_name, child_name| - parent = @current_user.todos.where(:description => parent_name).first - expect(parent).to_not be_nil - - # wait until the successor is added. - wait_until do - !parent.pending_successors.where(:description => child_name).first.nil? - end -end - -Then /^I should see "([^\"]*)" within the dependencies of "([^\"]*)"$/ do |successor_description, todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - - # open successors - within "div#line_todo_#{todo.id}" do - if !find(:css, "div#successors_todo_#{todo.id}").visible? - find(:css, "a.show_successors").click - end - end - - step "I should see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\"" -end - -Then /^I should not see "([^"]*)" within the dependencies of "([^"]*)"$/ do |successor_description, todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - - step "I should not see \"#{successor_description}\" within \"div#line_todo_#{todo.id}\"" -end - -Then /^I should see that "([^"]*)" does not have dependencies$/ do |todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - dependencies_icon = "//div[@id='line_todo_#{todo.id}']/div/a[@class='show_successors']/img" - expect(page).to_not have_xpath(dependencies_icon) -end diff --git a/features/step_definitions/feedlist_steps.rb b/features/step_definitions/feedlist_steps.rb deleted file mode 100644 index ffe5160b..00000000 --- a/features/step_definitions/feedlist_steps.rb +++ /dev/null @@ -1,29 +0,0 @@ -Then /^I should see a message that you need a context to get feeds for contexts$/ do - step "I should see \"There needs to be at least one context before you can request a feed\"" -end - -Then /^I should see a message that you need a project to get feeds for projects$/ do - step "I should see \"There needs to be at least one project before you can request a feed\"" -end - -Then /^I should see feeds for projects$/ do - expect(page).to have_css("select#feed-projects option[value='#{@current_user.projects.first.id}']") -end - -Then /^I should see feeds for contexts$/ do - expect(page).to have_css("select#feed-contexts option[value='#{@current_user.contexts.first.id}']") -end - -Then /^I should see "([^"]*)" as the selected project$/ do |project_name| - expect(page).to have_css('select#feed-projects option[selected="selected"]') -end - -Then /^I should see "([^"]*)" as the selected context$/ do |context_name| - expect(page).to have_css('select#feed-contexts option[selected="selected"]') -end - -Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type| - wait_for_ajax - xpath= "//div[@id='feeds-for-#{list_type}']//strong" - expect(name).to eq(find(:xpath, xpath).text) -end diff --git a/features/step_definitions/generic_steps.rb b/features/step_definitions/generic_steps.rb deleted file mode 100644 index 0a4f3d24..00000000 --- a/features/step_definitions/generic_steps.rb +++ /dev/null @@ -1,36 +0,0 @@ -Given /this is a pending scenario/ do - pending -end - -Given(/^I set the locale to "([^"]*)"$/) do |locale| - @locale = locale -end - -Given /^I am working on the mobile interface$/ do - @mobile_interface = true -end - -Given(/^I have selected the view for group by (project|context)$/) do |grouping| - @group_view_by = grouping -end - -Then /the badge should show (.*)/ do |number| - badge = find("span#badge_count").text.to_i - expect(badge).to eq(number.to_i) -end - -Then(/^I should see an error flash message saying "([^"]*)"$/) do |message| - xpath = "//div[@id='message_holder']/h4[@id='flash']" - expect(page).to have_xpath(xpath, :visible => true) - - text = page.find(:xpath, xpath).text - expect(text).to eq(message) -end - -Then /^I should see "([^"]*)" $/ do |text| - step "I should see \"#{text}\"" -end - -Then /^I should save and open the page$/ do - save_and_open_page -end diff --git a/features/step_definitions/login_steps.rb b/features/step_definitions/login_steps.rb deleted file mode 100644 index 52e11947..00000000 --- a/features/step_definitions/login_steps.rb +++ /dev/null @@ -1,27 +0,0 @@ -Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password| - user = User.where(:login => username).first - request_signin_as(user) - @current_user = user -end - -When /^I submit the login form as user "([^\"]*)" with password "([^\"]*)"$/ do |username, password| - fill_in 'Login', :with => username - fill_in 'Password', :with => password - uncheck "Stay logged in" - click_button "Sign in" -end - -When /^my session expires$/ do - # use expire_session to force expiry of session - js = '$.ajax({type: "GET", url: "/login/expire_session", dataType: "script", async: false});' - page.execute_script(js); - - # force check of expiry bypassing timeout - js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});' - page.execute_script(js); - sleep 1 -end - -When /^I log out of Tracks$/ do - step "I go to the logout page" -end diff --git a/features/step_definitions/mobile_tagging_todos_steps.rb b/features/step_definitions/mobile_tagging_todos_steps.rb deleted file mode 100644 index 4c8557af..00000000 --- a/features/step_definitions/mobile_tagging_todos_steps.rb +++ /dev/null @@ -1,4 +0,0 @@ -When /^I follow the tag "(.*?)"$/ do |tag_name| - # there could be more than one tag on the page, so use the first - all(:xpath, "//span[@class='tag #{tag_name}']/a")[0].click -end \ No newline at end of file diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb deleted file mode 100644 index 586a1382..00000000 --- a/features/step_definitions/note_steps.rb +++ /dev/null @@ -1,87 +0,0 @@ -When /^I add note "([^\"]*)" from the "([^\"]*)" project page$/ do |note, project| - project = Project.where(:name => project).first - project.notes.create!(:user_id => @current_user.id, :body => note) -end - -When /^I delete the first note$/ do - title = page.all("div.container h2").first.text - id = title.split(' ').last - - handle_js_confirm do - click_link "delete_note_#{id}" - end - expect(get_confirm_text).to eq("Are you sure that you want to delete the note '#{id}'?") - - expect(page).to_not have_css("a#delete_note_#{id}") -end - -When /^I click the icon next to the note$/ do - click_link "Show note" -end - -When /^I edit the first note to "([^"]*)"$/ do |note_body| - title = page.all("div.container h2").first.text - id = title.split(' ').last - - click_link "link_edit_note_#{id}" - within "form#edit_form_note_#{id}" do - fill_in "note[body]", :with => note_body - click_button "submit_note_#{id}" - end -end - -When(/^I toggle the note of "([^"]*)"$/) do |todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - - xpath = "//div[@id='line_todo_#{todo.id}']/div/a/img" - page.find(:xpath, xpath).click -end - -When /^I click Toggle Notes$/ do - open_view_menu do - click_link 'Toggle notes' - end -end - -When /^I toggle all notes$/ do - step "I click Toggle Notes" -end - -Then /^(.*) notes should be visible$/ do |number| - # count number of project_notes - count = 0 - page.all("div.project_notes").each { |node| count += 1 } - expect(count).to eq(number.to_i) -end - -Then /^I should see note "([^\"]*)" on the "([^\"]*)" project page$/ do |note, project| - project = Project.where(:name => project).first - visit project_path(project) - step "I should see the note \"#{note}\"" -end - -Then /^I should see note "([^\"]*)" on the notes page$/ do |note| - visit notes_path - step "I should see the note \"#{note}\"" -end - -Then /^the first note should disappear$/ do - title = page.find("div.container h2").text - id = title.split(' ').last - note = "div#note_#{id}" - - expect(page).to_not have_css(note, :visible=>true) -end - -Then /^I should see the note text$/ do - step "I should see the note \"after 50 characters\"" -end - -Then /^I should not see the note "([^"]*)"$/ do |note_content| - expect(page).to_not have_selector("div", :text => note_content, :visible => true) -end - -Then /^I should see the note "([^"]*)"$/ do |note_content| - expect(page.all("div", :text => note_content).first).to be_visible -end diff --git a/features/step_definitions/page_navigation_steps.rb b/features/step_definitions/page_navigation_steps.rb deleted file mode 100644 index dc07b394..00000000 --- a/features/step_definitions/page_navigation_steps.rb +++ /dev/null @@ -1,3 +0,0 @@ -Then /^I should be redirected to (.+?)$/ do |page_name| - step "I should be on #{page_name}" -end \ No newline at end of file diff --git a/features/step_definitions/preferences_steps.rb b/features/step_definitions/preferences_steps.rb deleted file mode 100644 index feb4b180..00000000 --- a/features/step_definitions/preferences_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -When /^I edit my last name to "([^"]*)"$/ do |last_name| - fill_in "user[last_name]", :with => last_name - click_button "prefs_submit" -end - -When /^I set the password and confirmation to "([^"]*)"$/ do |new_password| - step "I set the password to \"#{new_password}\" and confirmation to \"#{new_password}\"" -end - -When /^I set the password to "([^"]*)" and confirmation to "([^"]*)"$/ do |new_password, new_password_confirmation| - fill_in "user[password]", :with => new_password - fill_in "user[password_confirmation]", :with => new_password_confirmation - click_button "prefs_submit" -end - diff --git a/features/step_definitions/project_list_steps.rb b/features/step_definitions/project_list_steps.rb deleted file mode 100644 index 4141520b..00000000 --- a/features/step_definitions/project_list_steps.rb +++ /dev/null @@ -1,135 +0,0 @@ -When /^I delete project "([^"]*)"$/ do |project_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - handle_js_confirm do - click_link "delete_project_#{project.id}" - end - expect(get_confirm_text).to eq("Are you sure that you want to delete the project '#{project_name}'?") - - expect(page).to_not have_css("a#delete_project_#{project.id}") -end - -When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_drop| - drag_id = @current_user.projects.where(:name => project_drag).first.id - sortable_css = "div.ui-sortable div#container_project_#{drag_id}" - - drag_index = project_list_find_index(project_drag) - drop_index = project_list_find_index(project_drop) - - page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});" - sleep 0.1 # wait for the js to process the drop -end - -When /^I submit a new project with name "([^"]*)"$/ do |project_name| - fill_in "project[name]", :with => project_name - submit_new_project_form -end - -When /^I submit a new project with name "([^"]*)" and select take me to the project$/ do |project_name| - fill_in "project[name]", :with => project_name - check "go_to_project" - submit_new_project_form -end - -When /^I sort the active list alphabetically$/ do - handle_js_confirm do - within "div#list-active-projects-container" do - click_link "Alphabetically" - end - wait_for_ajax - end - expect(get_confirm_text).to eq("Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order.") -end - -When /^I sort the active list by number of tasks$/ do - handle_js_confirm do - within "div#list-active-projects-container" do - click_link "By number of tasks" - end - wait_for_ajax - end - expect(get_confirm_text).to eq("Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order.") -end - -Then /^I should see that a project named "([^"]*)" is not present$/ do |project_name| - within "div#display_box" do - step "I should not see \"#{project_name}\"" - end -end - -Then /^I should see that a project named "([^"]*)" is present$/ do |project_name| - within "div#display_box" do - step "I should see \"#{project_name}\"" - end -end - -Then /^I should see a project named "([^"]*)"$/ do |project_name| - step "I should see that a project named \"#{project_name}\" is present" -end - -Then /^I should not see a project named "([^"]*)"$/ do |project_name| - step "I should see that a project named \"#{project_name}\" is not present" -end - -Then(/^I should not see the project "(.*?)"$/) do |project_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - project_xpath = "//div[@id='project_#{project.id}']" - expect(page).to_not have_xpath(project_xpath) -end - -Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low| - expect(project_list_find_index(project_high)).to be < project_list_find_index(project_low) -end - -Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - list_id = @source_view=="review" ? "list-#{state}-projects" : "list-#{state_name}-projects-container" - xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']" - - expect(page).to_not have_xpath(xpath) -end - -Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_name, state_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - list_id = @source_view=="review" ? "list-#{state_name}-projects" : "list-#{state_name}-projects-container" - xpath = "//div[@id='#{list_id}']//div[@id='project_#{project.id}']" - - expect(page).to have_xpath(xpath) -end - -Then /^I see the project "([^"]*)" in the "([^"]*)" list$/ do |project_name, state_name| - step "the project \"#{project_name}\" should be in state list \"#{state_name}\"" -end - -Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count| - expect(page.find(:xpath, "//span[@id='#{state_name}-projects-count']").text).to eq(count) -end - -Then /^the new project form should be visible$/ do - expect(page).to have_css("div#project_new", :visible => true) -end - -Then /^the new project form should not be visible$/ do - expect(page).to_not have_css("div#project_new", :visible => true) -end - -Then /^the project "([^"]*)" should have (\d+) actions listed$/ do |project_name, count| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']" - expect(page.find(:xpath, xpath).text).to eq("#{project.name} (#{count} actions)") -end - -Then /^the project "([^"]*)" should have (\d+) deferred actions listed$/ do |project_name, deferred| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - xpath = "//div[@id='list-active-projects-container']//div[@id='project_#{project.id}']" - expect(page.find(:xpath, xpath).text).to eq("#{project.name} (#{deferred} deferred actions)") -end diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb deleted file mode 100644 index 2824fbdd..00000000 --- a/features/step_definitions/project_steps.rb +++ /dev/null @@ -1,313 +0,0 @@ -Given /^I have no projects$/ do - Project.delete_all -end - -Given /^I have an outdated project "([^"]*)" with (\d+) todos$/ do |project_name, num_todos| - step "I have a project \"#{project_name}\" with #{num_todos} todos" - @project = @current_user.projects.where(:name => project_name).first - @project.last_reviewed = UserTime.new(@current_user).time - @current_user.prefs.review_period.days-1 - @project.save -end - -Given /^I have a project "([^"]*)" with (\d+) deferred actions$/ do |name, deferred| - step "I have a project \"#{name}\" with #{deferred} deferred todos" -end - -Given /^I have a project "([^"]*)" with (\d+) active actions and (\d+) deferred actions$/ do |name, active_count, deferred_count| - step "I have a project \"#{name}\" with #{active_count} active todos" - step "I have a project \"#{name}\" with #{deferred_count} deferred todos" -end - -Given /^I have a project "([^"]*)" with (\d+) (todo|active todo|deferred todo)s prefixed by "([^\"]*)"$/ do |project_name, num_todos, state, prefix| - @context = @current_user.contexts.where(:name => "Context A").first_or_create - @project = @current_user.projects.where(:name => project_name).first_or_create - # acts_as_list adds at top by default, but that is counter-intuitive when reading scenario's, so reverse this - @project.move_to_bottom - - @todos=[] - 1.upto num_todos.to_i do |i| - todo = @current_user.todos.create!( - :project_id => @project.id, - :context_id => @context.id, - :description => "#{prefix}#{state} #{i}") - todo.show_from = Time.zone.now + 1.week if state=="deferred todo" - todo.save! - @todos << todo - end -end - -Given /^I have a project "([^"]*)" with (\d+) (todos|active todos|deferred todos)$/ do |project_name, num_todos, state| - step "I have a project \"#{project_name}\" with #{num_todos} #{state} prefixed by \"\"" -end - -Given /^there exists a project (?:|called )"([^"]*)" for user "([^"]*)"$/ do |project_name, user_name| - user = User.where(:login => user_name).first - expect(user).to_not be_nil - @project = user.projects.create!(:name => project_name) - # acts_as_list adds at top by default, but that is counter-intuitive when reading scenario's, so reverse this - @project.move_to_bottom -end - -Given /^I have a project (?:|called )"([^"]*)"$/ do |project_name| - @project = @current_user.projects.create!(:name => project_name) -end - -Given /^I have a project "([^"]*)" with a default context of "([^"]*)"$/ do |project_name, context_name| - step "I have a project \"#{project_name}\"" - context = @current_user.contexts.create!(:name => context_name) - @project.default_context = context - @project.save! -end - -Given /^I have the following projects:$/ do |table| - table.hashes.each do |project| - 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 - @project.save! - end -end - -Given /^I have a (completed|hidden) project called "([^"]*)"$/ do |state, project_name| - step "I have a project called \"#{project_name}\"" - @project.send(state=="completed" ? "complete!" : "hide!") - @project.reload - expect(@project.send(state=="completed" ? "completed?" : "hidden?")).to be true -end - -Given /^I have (\d+) completed projects$/ do |number_of_projects| - 1.upto number_of_projects.to_i do |i| - step "I have a completed project called \"Project #{i}\"" - end -end - -Given /^I have one project "([^\"]*)" with no notes$/ do |project_name| - step "I have a project called \"#{project_name}\"" -end - -Given /^I have two projects with one note each$/ do - step "I have a project \"project A\"" - @project.notes.create!(:user_id => @current_user.id, :body => 'note for project A') - step "I have a project \"project B\"" - @project.notes.create!(:user_id => @current_user.id, :body => 'note for project B') -end - -Given /^I have a project "([^\"]*)" with (.*) notes?$/ do |project_name, num| - project = @current_user.projects.create!(:name => project_name) - 1.upto num.to_i do |i| - project.notes.create!(:user_id => @current_user.id, :body => "A note #{i}. This is the very long body of note #{i} where you should not see the last part of the note after 50 characters") - end -end - -Given /^the default tags for "(.*?)" are "(.*?)"$/ do |project_name, default_tags| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - project.default_tags = default_tags - project.save! -end - -When /^I open the project edit form$/ do - click_link "link_edit_project_#{@project.id}" - expect(page).to have_css("button#submit_project_#{@project.id}", :visible => true) -end - -When /^I cancel the project edit form$/ do - click_link "cancel_project_#{@project.id}" - expect(page).to_not have_css("submit_project_#{@project.id}") - wait_for_animations_to_end -end - -When /^I edit the project description to "([^\"]*)"$/ do |new_description| - edit_project(@project) do - fill_in "project[description]", :with => new_description - end -end - -When /^I edit the project name to "([^\"]*)"$/ do |new_title| - edit_project(@project) do - fill_in "project[name]", :with => new_title - end -end - -When /^I try to edit the project name to "([^\"]*)"$/ do |new_title| - edit_project_no_wait(@project) do - within "form.edit-project-form" do - fill_in "project[name]", :with => new_title - end - end -end - -When /^I edit the default context to "([^"]*)"$/ do |default_context| - edit_project(@project) do - fill_in "project[default_context_name]", :with => default_context - end -end - -When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name| - @project = @current_user.projects.where(:name => project_current_name).first - expect(@project).to_not be_nil - 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.where(:name => project_current_name).first - expect(@project).to_not be_nil - 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| - page.find("span#project_name").click - fill_in "value", :with => new_project_name - click_button "Ok" -end - -When /^I click to edit the project name in place$/ do - page.find("span#project_name").click -end - -When /^I edit the project settings$/ do - expect(@project).to_not be_nil - - click_link "link_edit_project_#{@project.id}" - expect(page).to have_xpath("//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']") -end - -When /^I close the project settings$/ do - expect(@project).to_not be_nil - click_link "Cancel" - wait_for_ajax - wait_for_animations_to_end -end - -When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, state_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - edit_project_settings(project) do - choose "project_state_#{state_name}" - end -end - -When /^I edit project "([^"]*)" and mark the project as reviewed$/ do |project_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - - open_project_edit_form(project) - click_link "reviewed_project_#{project.id}" -end - -When /^I edit project settings and mark the project as reviewed$/ do - open_project_edit_form(@project) - click_link "reviewed_project_#{@project.id}" -end - -When /^I add a note "([^"]*)" to the project$/ do |note_body| - submit_button = "div.widgets button#submit_note" - - click_link "Add a note" - expect(page).to have_css submit_button - fill_in "note[body]", :with => note_body - - elem = find(submit_button) - expect(elem).to_not be_nil - elem.click - - expect(page).to_not have_css(submit_button, visible: true) -end - -When /^I click on the first note icon$/ do - expect(@project).to_not be_nil - @note = @project.notes.first # assume first note is also first on screen - expect(@note).to_not be_nil - - click_link "link_note_#{@note.id}" -end - -When /^I cancel adding a note to the project$/ do - click_link "Add a note" - fill_in "note[body]", :with => "will not save this" - click_link "neg_edit_form_note" -end - -Then /^I edit the default tags to "([^"]*)"$/ do |default_tags| - edit_project(@project) do - fill_in "project[default_tags]", :with => default_tags - end -end - -Then /^I should be able to change the project name in place$/ do - # Note that this is not changing the project name - expect(page).to have_css("span#project_name>form>input") - page.find("span#project_name > form > button[type=cancel]").click - expect(page).to_not have_css("span#project_name>form>input") -end - -Then /^I should not be able to change the project name in place$/ do - step "I click to edit the project name in place" - expect(page).to_not have_xpath("//span[@id='project_name']/form/input") -end - -Then /^the form for adding a note should not be visible$/ do - expect(page).to_not have_css("edit_form_note") -end - -Then /^I should go to that note page$/ do - current_path = URI.parse(current_url).path - note_path = note_path(@note) - expect(current_path).to eq(note_path) -end - -Then /^I should see one note in the project$/ do - expect(page).to have_xpath("//div[@class='note_wrapper']") -end - -Then /^I should see the bold text "([^\"]*)" in the project description$/ do |text_in_bold| - xpath="//div[@class='project_description']/p/strong" - - expect(page).to have_xpath(xpath) - bold_text = page.find(:xpath, xpath).text - expect(bold_text).to match(/#{text_in_bold}/) -end - -Then /^I should see the italic text "([^\"]*)" in the project description$/ do |text_in_italic| - xpath="//div[@class='project_description']/p/em" - - expect(page).to have_xpath(xpath) - italic_text = page.find(:xpath, xpath).text - expect(italic_text).to match(/#{text_in_italic}/) -end - -Then /^the project title should be "(.*)"$/ do |title| - expect(page).to have_css("h2#project_name_container span#project_name", text: title, exact: true) -end - -Then /^I should see the project name is "([^"]*)"$/ do |project_name| - step "the project title should be \"#{project_name}\"" -end - -Then /^I should (see|not see) the default project settings$/ do |visible| - default_settings = "This project is active with no default context and with no default tags" - - expect(page).to have_css("div.project_settings") - elem = page.find("div.project_settings") - - if visible == "see" - expect(elem).to be_visible - expect(elem.text).to match(/#{default_settings}/) - else - expect(elem).to_not be_visible - end -end - -Then /^I should have a project called "([^"]*)"$/ do |project_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil -end - -Then /^I should have (\d+) todos? in project "([^"]*)"$/ do |todo_count, project_name| - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - expect(project.todos.count).to eq(todo_count.to_i) -end diff --git a/features/step_definitions/recurring_todo_steps.rb b/features/step_definitions/recurring_todo_steps.rb deleted file mode 100644 index 1b85193a..00000000 --- a/features/step_definitions/recurring_todo_steps.rb +++ /dev/null @@ -1,109 +0,0 @@ -Given /^I have a recurrence pattern called "([^"]*)"$/ do |pattern_name| - context = @current_user.contexts.first - - @recurring_todo = @current_user.recurring_todos.create!( - :description => pattern_name, - :context_id => context.id, - :state => 'active', - :start_from => Time.now - 1.day, - :ends_on => 'no_end_date', - :target => 'due_date', - :recurring_period => 'daily', - :every_other1 => 1, - :show_always => 1, - :created_at => Time.now - 1.day, - :completed_at => nil - ) - expect(@recurring_todo.completed?).to be false - @todo = @current_user.todos.create!( - :description => pattern_name, - :context_id => context.id, - :recurring_todo_id => @recurring_todo.id) -end - -Given /^I have a completed recurrence pattern "([^"]*)"$/ do |pattern_name| - step "I have a recurrence pattern called \"#{pattern_name}\"" - @recurring_todo.toggle_completion! - expect(@recurring_todo.completed?).to be true -end - -Given /^I have (\d+) completed recurrence patterns$/ do |number_of_patterns| - 1.upto number_of_patterns.to_i do |i| - step "I have a completed recurrence pattern \"Recurring Todo #{i}\"" - end -end - -When /^I select "([^\"]*)" recurrence pattern$/ do |recurrence_period| - page.find("#recurring_todo_recurring_period_#{recurrence_period.downcase}").click -end - -When /^I edit the name of the pattern "([^\"]*)" to "([^\"]*)"$/ do |pattern_name, new_name| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - click_link "link_edit_recurring_todo_#{pattern.id}" - - expect(page).to have_css("input#edit_recurring_todo_description") - - fill_in "edit_recurring_todo_description", :with => new_name - page.find("button#recurring_todo_edit_update_button").click - - expect(page).to_not have_css("div#edit-recurring-todo", :visible => true) -end - -When /^I star the pattern "([^\"]*)"$/ do |pattern_name| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - click_link "star_icon_#{pattern.id}" -end - -When /^I delete the pattern "([^"]*)"$/ do |pattern_name| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - - handle_js_confirm do - click_link "delete_icon_#{pattern.id}" - end - expect(get_confirm_text).to eq("Are you sure that you want to delete the recurring action '#{pattern_name}'?") - - expect(page).to_not have_css("#delete_icon_#{pattern.id}") -end - -When /^I mark the pattern "([^"]*)" as (complete|active)$/ do |pattern_name, state| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - expect(pattern.completed?).to be (state != "complete") - page.find("#check_#{pattern.id}").click - wait_for_ajax - wait_for_animations_to_end -end - -When /^I follow the recurring todo link of "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - page.find(:xpath, "//div[@id='todo_#{todo.id}']//a[@class='recurring_icon']/img").click - sleep 1 # wait for page to load -end - -Then /^the state list "([^"]*)" should be empty$/ do |state| - empty_id = "recurring-todos-empty-nd" if state.downcase == "active" - empty_id = "completed-empty-nd" if state.downcase == "completed" - empty_msg = page.find("div##{empty_id}") - expect(empty_msg.visible?).to be true -end - -Then /^the pattern "([^\"]*)" should be starred$/ do |pattern_name| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - expect(page).to have_xpath("//div[@id='recurring_todo_#{pattern.id}']//img[@class='todo_star starred']") -end - -Then /^I should see the form for "([^\"]*)" recurrence pattern$/ do |recurrence_period| - expect(page).to have_css("#recurring_#{recurrence_period.downcase}", :visible => true) -end - -Then /^the pattern "([^"]*)" should be in the state list "([^"]*)"$/ do |pattern_name, state_name| - pattern = @current_user.recurring_todos.where(:description => pattern_name).first - expect(pattern).to_not be_nil - expect(page).to have_xpath("//div[@id='#{state_name}_recurring_todos_container']//div[@id='recurring_todo_#{pattern.id}']") -end diff --git a/features/step_definitions/review_steps.rb b/features/step_definitions/review_steps.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/features/step_definitions/search_steps.rb b/features/step_definitions/search_steps.rb deleted file mode 100644 index 1c7327f8..00000000 --- a/features/step_definitions/search_steps.rb +++ /dev/null @@ -1,4 +0,0 @@ -When /^I search for "([^"]*)"$/ do |search_arg| - fill_in "search", :with => search_arg - click_button "Search" -end \ No newline at end of file diff --git a/features/step_definitions/shared_new_todo_steps.rb b/features/step_definitions/shared_new_todo_steps.rb deleted file mode 100644 index 6b19c970..00000000 --- a/features/step_definitions/shared_new_todo_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -Then /^the single action form should be visible$/ do - expect(page).to have_css("#todo_new_action", :visible => true) -end - -Then /^the single action form should not be visible$/ do - expect(page).to_not have_css("#todo_new_action", :visible=>true) -end - -Then /^the multiple action form should be visible$/ do - expect(page).to have_css("#todo_multi_add", :visible => true) -end - -Then /^the multiple action form should not be visible$/ do - expect(page).to_not have_css("#todo_multi_add", :visible=>true) -end \ No newline at end of file diff --git a/features/step_definitions/signup_steps.rb b/features/step_definitions/signup_steps.rb deleted file mode 100644 index 5bbba959..00000000 --- a/features/step_definitions/signup_steps.rb +++ /dev/null @@ -1,17 +0,0 @@ -Given /^public signups are turned (.*)$/ do |state| - case state - when 'on' - SITE_CONFIG['open_signups'] = true - when 'off' - SITE_CONFIG['open_signups'] = false - else - raise "public signups should be either 'on' or 'off'" - end -end - -When /^I submit the signup form with username "([^\"]*)", password "([^\"]*)" and confirm with "([^\"]*)"$/ do |username, password, confirm| - fill_in 'Desired login', :with => username - fill_in 'Choose password', :with => password - fill_in 'Confirm password', :with => confirm - click_button "Signup" -end \ No newline at end of file diff --git a/features/step_definitions/stats_steps.rb b/features/step_definitions/stats_steps.rb deleted file mode 100644 index 53c60028..00000000 --- a/features/step_definitions/stats_steps.rb +++ /dev/null @@ -1,18 +0,0 @@ -When /^I click on the chart for actions done in the last 12 months$/ do - # cannot really click the chart which is a swf - visit stats_path + "/actions_done_last_years" -end - -Then /^I should see a chart$/ do - expect(page).to have_css("div.open-flash-chart") -end - -When /^I click on the chart for running time of all incomplete actions$/ do - # cannot really click the chart which is a swf - visit stats_path + "/show_selected_actions_from_chart/art?index=0" -end - -When /^I click on the chart for running time of all incomplete visible actions$/ do - # cannot really click the chart which is a swf - visit stats_path + "/show_selected_actions_from_chart/avrt?index=0" -end diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb deleted file mode 100644 index db121238..00000000 --- a/features/step_definitions/todo_create_steps.rb +++ /dev/null @@ -1,369 +0,0 @@ -Given /^I have no todos$/ do - Todo.delete_all -end - -Given /^I have a todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name| - context = @current_user.contexts.where(:name => context_name).first_or_create - @todo = @current_user.todos.create!(:context_id => context.id, :description => description) -end - -Given /^I have a todo "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |description, context_name, tag_names| - step "I have a todo \"#{description}\" in the context \"#{context_name}\"" - @todo.tag_with(tag_names) - @todo.save! -end - -Given(/^I have a todo "([^"]*)" in the context "([^"]*)" in the project "([^"]*)"$/) do |description, context_name, project_name| - step "I have a todo \"#{description}\" in the context \"#{context_name}\"" - - @project = @current_user.projects.where(:name => project_name).first_or_create - expect(@project).to_not be_nil - - @todo.project = @project - @todo.save! -end - -Given /^I have a todo "([^"]*)" in the context "([^"]*)" which is due tomorrow$/ do |description, context_name| - context = @current_user.contexts.where(:name => context_name).first_or_create - @todo = @current_user.todos.create!(:context_id => context.id, :description => description) - @todo.due = @todo.created_at + 1.day - @todo.save! -end - -Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)" prefixed by "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names, prefix| - @context = find_context(context_name) - @project = find_project(project_name) - - @todos = [] - number_of_todos.to_i.downto 1 do |i| - todo = @current_user.todos.create!(:context_id => @context.id, :description => "#{prefix}todo #{i}", :project_id => @project.id) - todo.tag_with(tag_names) - todo.save! - @todos << todo - end -end - -Given /^I have (\d+) todos in project "([^"]*)" in context "([^"]*)" with tags "([^"]*)"$/ do |number_of_todos, project_name, context_name, tag_names| - step "I have #{number_of_todos} todos in project \"#{project_name}\" in context \"#{context_name}\" with tags \"#{tag_names}\" prefixed by \"\"" -end - -Given /^I have a todo "([^"]*)"$/ do |description| - 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 | - step "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\"" - end -end - -Given /^I have a todo "([^"]*)" with notes "([^"]*)"$/ do |description, notes| - 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| - step "I have a todo \"todo #{i}\" in the context \"Context A\"" - end -end - -Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |action_description, project_name, tags, context_name| - @context = @current_user.contexts.where(:name => context_name).first_or_create - @project = @current_user.projects.where(:name => project_name).first_or_create - @todo = @current_user.todos.create!(:context_id => @context.id, :project_id => @project.id, :description => action_description) - @todo.tag_with(tags) - @todo.save -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| - step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\"" - @todo.due = UserTime.new(@current_user).time + 1.week - @todo.save! -end - -Given(/^I have a todo "(.*?)" in context "(.*?)" in project "(.*?)" with tags "(.*?)"$/) do |action_description, context_name, project_name, tags| - step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\"" -end - - -###### DEFERRED TODOS ####### - -Given /^I have ([0-9]+) deferred todos$/ do |count| - context = @current_user.contexts.create!(:name => "context B") - count.to_i.downto 1 do |i| - todo = @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}") - todo.show_from = UserTime.new(@current_user).time + 1.week - todo.save! - end -end - -Given /^I have a deferred todo "([^"]*)" in the context "([^"]*)"$/ do |description, context_name| - step "I have a deferred todo \"#{description}\" in the context \"#{context_name}\" deferred by 7 days" -end - -Given /^I have a (?:deferred )todo "([^"]*)" in the context "([^"]*)" deferred by (\d+) day(?:s)?$/ do |description, context_name, deferred_by_days| - context = @current_user.contexts.where(:name => context_name).first_or_create - todo = @current_user.todos.create!(:context_id => context.id, :description => description) - todo.show_from = UserTime.new(@current_user).time + deferred_by_days.to_i.day - todo.save! -end - -Given /^I have a deferred todo "([^"]*)"$/ do |description| - 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| - step "I have a todo \"#{action_description}\" in context \"#{context_name}\" with tags \"#{tag_list}\"" - @todo.show_from = UserTime.new(@current_user).time + 1.week - @todo.save! -end - -Given(/^I have a deferred todo "(.*?)" in the context "(.*?)" in the project "(.*?)"$/) do |action_description, context_name, project_name| - step "I have a todo \"#{action_description}\" in the context \"#{context_name}\" in the project \"#{project_name}\"" - @todo.show_from = UserTime.new(@current_user).time + 1.week - @todo.save! -end - - -####### COMPLETED TODOS ####### - -Given /^I have ([0-9]+) completed todos in project "([^"]*)" in context "([^"]*)"$/ do |count, project_name, context_name| - @context = find_context(context_name) - @project = find_project(project_name) - - @todos = [] - count.to_i.downto 1 do |i| - @todo = @current_user.todos.create!(:context_id => @context.id, :description => "todo #{i}", :project_id => @project.id) - @todo.complete! - @todos << @todo - end -end - -Given /^I have a completed todo "([^"]*)" in project "([^"]*)" in context "([^"]*)"$/ do |action_description, project_name, 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| - step "I have #{count} completed todos in project \"#{project_name}\" in context \"#{context_name}\"" - @todos.each { |t| t.tag_with(tags); t.save! } -end - -Given(/^I have ([0-9]+) completed todos in context "([^"]*)"$/) do |count, context_name| - context = find_context(context_name) - - count.to_i.downto 1 do |i| - todo = @current_user.todos.create!(:context_id => context.id, :description => "todo #{i}") - todo.complete! - end -end - -Given /^I have ([0-9]+) completed todos$/ do |count| - 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| - 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| - 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| - step "I have a todo with description \"#{action_description}\" in project \"#{project_name}\" with tags \"#{tags}\" in the context \"#{context_name}\"" - @todo.complete! -end - -Given(/^I have a completed todo with description "([^"]*)" in context "(.*?)" completed (\d+) days ago$/) do |action_description, context_name, num_of_days| - step "I have a todo \"#{action_description}\" in the context \"#{context_name}\"" - @todo.complete! - @todo.completed_at = Time.zone.now - num_of_days.to_i.days - @todo.save! - @todo.reload -end - -####### PROJECT WITH TODOS ###### - -Given /^I have a project "([^"]*)" that has the following (todos|deferred todos)$/ do |project_name, kind_of_todo, todos| - step "I have a project called \"#{project_name}\"" - expect(@project).to_not be_nil - - todos.hashes.each do |todo| - new_todo = @current_user.todos.create!( - :description => todo[:description], - :context_id => find_context(todo[:context]).id, - :project_id => @project.id, - :notes => todo[:notes]) - new_todo.show_from = Time.zone.now+1.week if kind_of_todo=="deferred todos" - new_todo.tag_with(todo[:tags]) unless todo[:tags].nil? - new_todo.complete! if !todo[:completed].nil? && todo[:completed] == 'yes' - new_todo.save! - end -end - -####### submitting using sidebar form ####### - -When /^I submit a new action with description "([^"]*)"$/ do |description| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - end - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" in the project "(.*?)"$/ do |description, project_name| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - fill_in "project_name", :with => project_name - end - submit_next_action_form -end - -When(/^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)"$/) do |description, project_name, tags| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - fill_in "project_name", :with => project_name - fill_in "tag_list", :with => tags - end - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" with a dependency on "([^"]*)"$/ do |todo_description, predecessor_description| - predecessor = find_todo(predecessor_description) - - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => todo_description - fill_in "predecessor_input", :with => predecessor_description - end - - wait_for_auto_complete - click_first_line_of_auto_complete - - new_dependency_line = "//li[@id='pred_#{predecessor.id}']" - expect(page).to have_xpath(new_dependency_line, :visible => true) - - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - fill_in "tag_list", :with => tags - - # fill_in does not seem to work when the field is prefilled with something. Empty the field first - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - end - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - - clear_project_name_from_next_action_form - clear_context_name_from_next_action_form - - fill_in "todo_project_name", :with => project_name - fill_in "todo_context_name", :with => context_name - fill_in "tag_list", :with => tags - end - - submit_next_action_form -end - -When /^I submit a new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, 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| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - end - - submit_next_action_form -end - -####### submitting using sidebar form: DEFERRED ####### - -When(/^I submit a new deferred action with description "([^"]*)"$/) do |description| - fill_in "todo[description]", :with => description - fill_in "todo[show_from]", :with => format_date(UserTime.new(@current_user).time + 1.week) - submit_next_action_form -end - -When /^I submit a new deferred action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - - clear_context_name_from_next_action_form - fill_in "todo_context_name", :with => context_name - - fill_in "tag_list", :with => tags - fill_in "todo[show_from]", :with => format_date(UserTime.new(@current_user).time + 1.week) - end - submit_next_action_form -end - -When(/^I submit a new deferred action with description "([^"]*)" to project "(.*?)" with tags "([^"]*)"$/) do |description, project_name, tags| - within "form#todo-form-new-action" do - fill_in "todo[description]", :with => description - fill_in "todo_project_name", :with => project_name - fill_in "tag_list", :with => tags - fill_in "todo[show_from]", :with => format_date(UserTime.new(@current_user).time + 1.week) - end - submit_next_action_form -end - -When /^I submit a new deferred action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name| - fill_in "todo[description]", :with => description - - clear_project_name_from_next_action_form - clear_context_name_from_next_action_form - - within "form#todo-form-new-action" do - fill_in "todo_project_name", :with => project_name - fill_in "todo_context_name", :with => context_name - fill_in "tag_list", :with => tags - fill_in "todo[show_from]", :with => format_date(UserTime.new(@current_user).time + 1.week) - end - - submit_next_action_form -end - -When /^I submit a deferred new action with description "([^"]*)" to project "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, 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 ####### - -When /^I submit multiple actions with using$/ do |multiple_actions| - fill_in "todo[multiple_todos]", :with => multiple_actions - submit_multiple_next_action_form -end - -When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags| - fill_in "todo[multiple_todos]", :with => descriptions - fill_in "multi_todo_project_name", :with => project_name - fill_in "multi_todo_context_name", :with => context_name - fill_in "multi_tag_list", :with => tags -end - -When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |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 - -When /^I submit the new multiple actions form with$/ do |multi_line_descriptions| - fill_in "todo[multiple_todos]", :with => multi_line_descriptions - submit_multiple_next_action_form -end diff --git a/features/step_definitions/todo_edit_steps.rb b/features/step_definitions/todo_edit_steps.rb deleted file mode 100644 index 1c459a2f..00000000 --- a/features/step_definitions/todo_edit_steps.rb +++ /dev/null @@ -1,210 +0,0 @@ -####### MARK (UN)COMPLETE ####### - -When /^I mark "([^"]*)" as complete$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - check "mark_complete_#{todo.id}" - - wait_for_ajax - wait_for_animations_to_end -end - -When /^I mark "([^"]*)" as uncompleted$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - uncheck "mark_complete_#{todo.id}" - - wait_for_ajax - wait_for_animations_to_end -end - -When /^I mark the completed todo "([^"]*)" active$/ do |action_description| - step "I mark \"#{action_description}\" as uncompleted" - wait_for_ajax - wait_for_animations_to_end -end - -####### (UN)STARRING ####### - -When /^I star the action "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - 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']" - - expect(page).to have_xpath(xpath_unstarred) - - star_img = "//img[@id='star_img_#{todo.id}']" - page.find(:xpath, star_img).click - - wait_for_ajax - wait_for_animations_to_end - - expect(page).to have_xpath(xpath_starred) -end - -When /^I unstar the action "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - 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']" - - expect(page).to have_xpath(xpath_starred) - - star_img = "//img[@id='star_img_#{todo.id}']" - page.find(:xpath, star_img).click - - expect(page).to have_xpath(xpath_unstarred) -end - -####### Editing a todo using Edit Form ####### - -When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field_name, todo_name, new_value| - todo = find_todo(todo_name) - - open_edit_form_for(todo) - within "form.edit_todo_form" do - fill_in "#{field_name}", :with => new_value - # force blur event - execute_javascript("$('form.edit_todo_form input.#{field_name}_todo_#{todo.id}').blur();") - sleep 0.10 - end - submit_edit_todo_form(todo) - wait_for_ajax -end - -When /^I edit the context of "([^"]*)" to "([^"]*)"$/ do |todo_name, 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| - 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| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - within "form.edit_todo_form" do - fill_in "todo_description", :with => new_description - end - submit_edit_todo_form(todo) -end - -When /^I try to edit the description of "([^"]*)" to "([^"]*)"$/ do |action_description, new_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - within "form.edit_todo_form" do - fill_in "todo_description", :with => new_description - end - 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 - -When /^I edit the due date of "([^"]*)" to "([^"]*)"$/ do |action_description, date| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - fill_in "due_todo_#{todo.id}", :with => date - close_datepicker - submit_edit_todo_form(todo) -end - -When /^I edit the due date of "([^"]*)" to tomorrow$/ do |action_description| - date = format_date(Time.zone.now + 1.day) - 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) - step "I edit the due date of \"#{action_description}\" to \"#{date}\"" -end - -When /^I clear the due date of "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - # use all()[0] to get the first todo. This is for calendar page where you can have - # de same todo more than once - within all("div#edit_todo_#{todo.id}")[0] do - find("a#due_x_todo_#{todo.id}").click - expect(page).to have_field("due_todo_#{todo.id}", with: "") - end - submit_edit_todo_form(todo) -end - -When /^I edit the show from date of "([^"]*)" to next month$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - fill_in "show_from_todo_#{todo.id}", :with => format_date(todo.created_at + 1.month) - submit_edit_todo_form(todo) -end - -When /^I remove the show from date from "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - page.find(:xpath, "//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| - step "I remove the show from date from \"#{action_description}\"" -end - -When /^I defer "([^"]*)" for 1 day$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_submenu_for(todo) do - click_link "defer_1_todo_#{todo.id}" - end - - wait_for_ajax - wait_for_animations_to_end -end - -When /^I edit the tags of "([^"]*)" to "([^"]*)"$/ do |action_description, tags| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_edit_form_for(todo) - within "form#form_todo_#{todo.id}" do - fill_in "tag_list", :with => tags - end - submit_edit_todo_form(todo) -end - -When /^I make a project of "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - open_submenu_for(todo) do - click_link "to_project_todo_#{todo.id}" - end - - expect(page).to 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 = "//form/div[@id='edit_error_status']" - expect(page).to have_xpath(error_block) -end diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb deleted file mode 100644 index f9dd2c4d..00000000 --- a/features/step_definitions/todo_steps.rb +++ /dev/null @@ -1,167 +0,0 @@ -When /^I select the second page$/ do - step "I follow \"2\" within \"div.paginate_header\"" -end - -####### DELETE ####### - -When /^I delete the action "([^"]*)"$/ do |action_description| - todo = find_todo(action_description) - - handle_js_confirm do - open_submenu_for(todo) do - click_link "delete_todo_#{todo.id}" - end - end - expect(get_confirm_text).to eq("Are you sure that you want to delete the action '#{todo.description}'?") - - wait_for_ajax -end - -When /^I delete the todo "([^"]*)"$/ do |action_description| - step "I delete the action \"#{action_description}\"" -end - -####### Notes ####### - -When /^I open the notes of "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - page.find(:xpath, "//div[@id='line_todo_#{todo.id}']/div/a/img").click - - expect(page).to have_xpath("//div[@id='notes_todo_#{todo.id}']", :visible=>true) -end - -####### THEN ####### - -Then /^I should see a starred "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star starred']" - expect(page).to have_xpath(xpath_starred) -end - -Then /^I should see an unstarred "([^"]*)"$/ do |action_description| - todo = @current_user.todos.where(:description => action_description).first - expect(todo).to_not be_nil - - xpath_starred = "//div[@id='line_todo_#{todo.id}']//img[@class='todo_star']" - expect(page).to have_xpath(xpath_starred) -end - -Then /^I should see ([0-9]+) todos$/ do |count| - total = page.all("div.item-container").inject(0) { |s, e| s+=1 } - expect(total).to eq(count.to_i) -end - -Then /^I should see the todo "([^\"]*)"$/ do |todo_description| - expect(page).to have_xpath("//span[.=\"#{todo_description}\"]", :visible => true) -end - -Then /^I should not see the todo "([^\"]*)"$/ do |todo_description| - expect(page).to_not have_xpath("//span[.=\"#{todo_description}\"]", :visible => true) -end - -Then /^I should see a completed todo "([^"]*)"$/ do |todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - - # only completed todos have a grey span with the completed_at date - xpath = "//div[@id='line_todo_#{todo.id}']/div/span[@class='grey']" - expect(page).to have_xpath(xpath, :visible=>true) -end - -Then /^I should see an active todo "([^"]*)"$/ do |todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - expect(page).to have_css("div#line_todo_#{todo.id} img.grip", :visible=>true) -end - -Then /^the number of actions should be (\d+)$/ do |count| - expect(@current_user.todos.count).to eq(count.to_i) -end - -Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name| - expect(get_confirm_text).to eq("New context '#{context_name}' will be also created. Are you sure?") -end - -Then /^the selected project should be "([^"]*)"$/ do |content| - # Works for mobile. TODO: make it work for both mobile and non-mobile - if content.blank? - expect(page.has_css?("select#todo_project_id option[selected='selected']")).to be false - else - expect(page.find("select#todo_project_id option[selected='selected']").text).to match(/#{content}/) - end -end - -Then /^the selected context should be "([^"]*)"$/ do |content| - # Works for mobile. TODO: make it work for both mobile and non-mobile - if content.blank? - expect(page.has_css?("select#todo_context_id option[selected='selected']")).to be false - else - expect(page.find("select#todo_context_id option[selected='selected']").text).to match(/#{content}/) - end -end - -Then /^I should see the page selector$/ do - expect(page).to have_xpath(".//a[@class='next_page']") -end - -Then /^the page should be "([^"]*)"$/ do |page_number| - expect(page.find(:xpath, ".//div[@class='paginate_header']//em[@class='current']").text).to eq(page_number) -end - -Then /^the project field of the new todo form should contain "([^"]*)"$/ do |project_name| - xpath= "//form[@id='todo-form-new-action']/input[@id='todo_project_name']" - expect(page.find(:xpath, xpath).value).to eq(project_name) -end - -Then /^the context field of the new todo form should contain "([^"]*)"$/ do |context_name| - xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']" - expect(page.find(:xpath, xpath).value).to eq(context_name) -end - -Then /^the default context of the new todo form should be "([^"]*)"$/ do |context_name| - xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']" - expect(context_name).to eq(page.find(:xpath, xpath).value) -end - -Then /^the tag field in the new todo form should be empty$/ do - xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']" - expect(page.find(:xpath, xpath).value).to be_blank -end - -Then /^the tag field in the new todo form should be "([^"]*)"$/ do |tag_list| - xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']" - expect(tag_list).to eq(page.find(:xpath, xpath).value) -end - -Then /^the tags of "([^"]*)" should be "([^"]*)"$/ do |todo_description, tag_list| - expect(find_todo(todo_description).tag_list).to eq(tag_list) -end - -Then /^I should see "([^"]*)" in the completed section of the mobile site$/ do |desc| - todo = @current_user.todos.where(:description => desc).first - expect(todo).to_not be_nil - - xpath = "//div[@id='completed_container']//a[@href='/todos/#{todo.id}.m']" - expect(page).to have_xpath(xpath) -end - -Then /^I should (see|not see) the notes of "([^"]*)"$/ do |visible, todo_description| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo).to_not be_nil - - expect(page.find("div#notes_todo_#{todo.id}")).send(visible=="see" ? :to : :to_not, be_visible) -end - -Then /^I should (see|not see) the empty tickler message$/ do |see| - elem = find("div#no_todos_in_view") - expect(elem).send(see=="see" ? :to : :to_not, be_visible) -end - -Then /^I should see the todo "([^"]*)" with project name "([^"]*)"$/ do |todo_description, project_name| - todo = @current_user.todos.where(:description => todo_description).first - expect(todo.project.name).to eq(project_name) -end diff --git a/features/step_definitions/todo_tag_steps.rb b/features/step_definitions/todo_tag_steps.rb deleted file mode 100644 index e69de29b..00000000 diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb deleted file mode 100644 index 18a7b706..00000000 --- a/features/step_definitions/user_steps.rb +++ /dev/null @@ -1,41 +0,0 @@ -Given /^the following user records?$/ do |table| - User.delete_all - table.hashes.each do |hash| - user = FactoryGirl.create(:user, hash) - user.create_preference({:locale => 'en'}) - end -end - -Given("no users exists") do - User.delete_all -end - -When(/^I change my password to "([^"]*)"$/) do |password| - step 'I should be on the change password page' - fill_in "user[password]", :with => password - fill_in "user[password_confirmation]", :with => password - click_button "Change password" -end - -When /^I delete the user "([^\"]*)"$/ do |username| - # click "//tr[@id='user-3']//img" - # assert_confirmation "Warning: this will delete user 'john', all their actions, contexts, project and notes. Are you sure that you want to continue?" - user = User.where(:login => username).first - expect(user).to_not be_nil - - handle_js_confirm do - page.find(:xpath, "//tr[@id='user-#{user.id}']//img").click - end - expect(get_confirm_text).to eq("Warning: this will delete user '#{user.login}', all their actions, contexts, project and notes. Are you sure that you want to continue?") - - expect(page).to_not have_css("tr#user-#{user.id}") -end - -Then /^I should see that a user named "([^\"]*)" is not present$/ do |username| - step "I should not see \"#{username} (\"" -end - -Then "I should be an admin" do - # just check on the presence of the menu item for managing users - step "I should see \"Manage users\"" -end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb deleted file mode 100644 index 3b198263..00000000 --- a/features/step_definitions/web_steps.rb +++ /dev/null @@ -1,185 +0,0 @@ -# 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. - - -require 'uri' -require 'cgi' -require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) - -module WithinHelpers - def with_scope(locator) - locator ? within(locator) { yield } : yield - end -end -World(WithinHelpers) - -Given /^(?:|I )am on (.+)$/ do |page_name| - visit path_to(page_name) -end - -When /^(?:|I )go to (.+)$/ do |page_name| - visit path_to(page_name) -end - -When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| - with_scope(selector) do - click_button(button) - end -end - -When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| - with_scope(selector) do - click_link(link) - end -end - -When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| - with_scope(selector) do - fill_in(field, :with => value) - end -end - -When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector| - with_scope(selector) do - fill_in(field, :with => value) - end -end - -# Use this to fill in an entire form with data from a table. Example: -# -# When I fill in the following: -# | Account Number | 5002 | -# | Expiry date | 2009-11-01 | -# | Note | Nice guy | -# | Wants Email? | | -# -# TODO: Add support for checkbox, select og option -# based on naming conventions. -# -When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields| - with_scope(selector) do - fields.rows_hash.each do |name, value| - When %{I fill in "#{name}" with "#{value}"} - end - end -end - -When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector| - with_scope(selector) do - select(value, :from => field) - end -end - -When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| - with_scope(selector) do - check(field) - end -end - -When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| - with_scope(selector) do - uncheck(field) - end -end - -When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector| - with_scope(selector) do - choose(field) - end -end - -When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector| - with_scope(selector) do - attach_file(field, path) - end -end - -Then /^(?:|I )should see JSON:$/ do |expected_json| - require 'json' - expected = JSON.pretty_generate(JSON.parse(expected_json)) - actual = JSON.pretty_generate(JSON.parse(response.body)) - expect(expected).to eq(actual) -end - -Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| - with_scope(selector) do - expect(page).to have_content(text) - end -end - -Then /^(?:|I )should see "([^"]*)" before "([^"]*)"$/ do |earlier_content, later_content| - expect(page).to have_content(earlier_content) - expect(page).to have_content(later_content) - expect(page.body.index(earlier_content)).to be < page.body.index(later_content) -end - -Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| - regexp = Regexp.new(regexp) - with_scope(selector) do - expect(page).to have_xpath('//*', :text => regexp) - end -end - -Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector| - with_scope(selector) do - expect(page).to have_no_content(text) - end -end - -Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| - regexp = Regexp.new(regexp) - with_scope(selector) do - expect(page).to have_no_xpath('//*', :text => regexp) - end -end - -Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value| - with_scope(selector) do - field = find_field(field) - field_value = (field.tag_name == 'textarea') ? field.text : field.value - expect(field_value).to match(/#{value}/) - end -end - -Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value| - with_scope(selector) do - field = find_field(field) - field_value = (field.tag_name == 'textarea') ? field.text : field.value - expect(field_value).to_not match(/#{value}/) - end -end - -Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector| - with_scope(selector) do - field_checked = find_field(label)['checked'] - expect(field_checked).to be true - end -end - -Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector| - with_scope(selector) do - field_checked = find_field(label)['checked'] - expect(field_checked).to be false - end -end - -Then /^(?:|I )should be on (.+)$/ do |page_name| - current_path = URI.parse(current_url).path - expect(current_path).to eq(path_to(page_name)) -end - -Then /^(?:|I )should have the following query string:$/ do |expected_pairs| - query = URI.parse(current_url).query - actual_params = query ? CGI.parse(query) : {} - expected_params = {} - expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} - - expect(actual_params).to eq(expected_params) -end - -Then /^show me the page$/ do - save_and_open_page -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index a9e3e6c9..00000000 --- a/features/support/env.rb +++ /dev/null @@ -1,59 +0,0 @@ -# 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. - -require 'cucumber/rails' -require 'aruba/cucumber' - -# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In -# order to ease the transition to Capybara we set the default here. If you'd -# prefer to use XPath just remove this line and adjust any selectors in your -# steps to use the XPath syntax. -Capybara.default_selector = :css - -# By default, any exception happening in your Rails application will bubble up -# to Cucumber so that your scenario will fail. This is a different from how -# your application behaves in the production environment, where an error page will -# be rendered instead. -# -# Sometimes we want to override this default behaviour and allow Rails to rescue -# exceptions and display an error page (just like when the app is running in production). -# Typical scenarios where you want to do this is when you test your error pages. -# There are two ways to allow Rails to rescue exceptions: -# -# 1) Tag your scenario (or feature) with @allow-rescue -# -# 2) Set the value below to true. Beware that doing this globally is not -# recommended as it will mask a lot of errors for you! -# -ActionController::Base.allow_rescue = false - -# Remove/comment out the lines below if your app doesn't have a database. -# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. -begin - DatabaseCleaner.strategy = :transaction -rescue NameError - raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." -end - -# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. -# See the DatabaseCleaner documentation for details. Example: -# -# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do -# # { :except => [:widgets] } may not do what you expect here -# # as Cucumber::Rails::Database.javascript_strategy overrides -# # this setting. -# DatabaseCleaner.strategy = :truncation -# end -# -# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do -# DatabaseCleaner.strategy = :transaction -# end -# - -# Possible values are :truncation and :transaction -# The :transaction strategy is faster, but might give you threading problems. -# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature -Cucumber::Rails::Database.javascript_strategy = :truncation \ No newline at end of file diff --git a/features/support/factories/factories.rb b/features/support/factories/factories.rb deleted file mode 100644 index 704566d1..00000000 --- a/features/support/factories/factories.rb +++ /dev/null @@ -1,23 +0,0 @@ -FactoryGirl.define do - factory :user do - sequence(:login) { |n| "testuser#{n}" } - password "secret" - password_confirmation { |user| user.password } - is_admin false - end - - factory :context do - sequence(:name) { |n| "testcontext#{n}" } - hide false - created_at Time.now.utc - end - - factory :project do - sequence(:name) { |n| "testproject#{n}" } - end - - factory :todo do - sequence(:description) { |n| "testtodo#{n}" } - association :context - end -end \ No newline at end of file diff --git a/features/support/hooks.rb b/features/support/hooks.rb deleted file mode 100644 index 05c2558d..00000000 --- a/features/support/hooks.rb +++ /dev/null @@ -1,9 +0,0 @@ -AfterStep('@pause') do - print "Press Return to continue..." - STDIN.getc -end - -Before('@aruba') do - @aruba_timeout_seconds = 10 - # print "\nsetting timeout for aruba to #{@aruba_timeout_seconds}\n" -end diff --git a/features/support/init_factory_girl.rb b/features/support/init_factory_girl.rb deleted file mode 100644 index ee874599..00000000 --- a/features/support/init_factory_girl.rb +++ /dev/null @@ -1,2 +0,0 @@ -# require 'factory_girl' -# Dir.glob(File.join(File.dirname(__FILE__), 'factories/*.rb')).each {|f| require f } \ No newline at end of file diff --git a/features/support/paths.rb b/features/support/paths.rb deleted file mode 100644 index 9748104d..00000000 --- a/features/support/paths.rb +++ /dev/null @@ -1,141 +0,0 @@ -module NavigationHelpers - # Maps a name to a path. Used by the - # - # When /^I go to (.+)$/ do |page_name| - # - # step definition in web_steps.rb - # - def path_to(page_name) - options = {} - options[:format] = :m if @mobile_interface - options[:locale] = @locale if @locale - options[:_group_view_by] = @group_view_by if @group_view_by - @source_view = nil - - case page_name - - when /the home\s?page/ - @source_view = "todos" - root_path(options) - - when /the done page/ - @source_view = "done" - done_overview_path(options) - when /the done actions page for context "([^"]*)"/i - @source_view = "done" - context = @current_user.contexts.where(:name => $1).first - done_todos_context_path(context, options) - when /the done actions page for project "([^"]*)"/i - @source_view = "done" - project = @current_user.projects.where(:name => $1).first - done_todos_project_path(project, options) - when /the done actions page for tag "([^"]*)"/i - @source_view = "done" - done_tag_path($1, options) - when /the done actions page/ - @source_view = "done" - done_todos_path(options) - when /the all done actions page for context "([^"]*)"/i - @source_view = "done" - context = @current_user.contexts.where(:name => $1).first - all_done_todos_context_path(context, options) - when /the all done actions page for project "([^"]*)"/i - @source_view = "done" - project = @current_user.projects.where(:name => $1).first - all_done_todos_project_path(project, options) - when /the all done actions page for tag "([^"]*)"/i - @source_view = "done" - all_done_tag_path($1, options) - when /the all done actions page/ - @source_view = "done" - all_done_todos_path(options) - - when /the statistics page/ - @source_view = "stats" - stats_path(options) - when /the signup page/ - signup_path(options) - when /the login page/ - login_path(options) - when /the logout page/ - logout_path(options) - when /the notes page/ - notes_path(options) - when /the calendar page/ - calendar_path(options) - when /the review page/ - @source_view = "review" - review_path(options) - when /the contexts page/ - @source_view = "context" - contexts_path(options) - when /the projects page/ - @source_view = "project" - projects_path(options) - when /the manage users page/ - users_path(options) - when /the recurring todos page/ - recurring_todos_path(options) - when /the integrations page/ - integrations_path(options) - when /the tickler page/ - @source_view = "deferred" - tickler_path(options) - when /the export page/ - data_path(options) - when /the preference page/ - preferences_path(options) - when /the rest api docs page/ - rest_api_docs_path(options) - when /the search page/ - search_path(options) - when /the starred page/ - tag_path("starred", options) - when /the feeds page/ - feeds_path(options) - when /the context page for "([^\"]*)" for user "([^\"]*)"/i - @source_view = "context" - @context = User.where(:login => $2).first.contexts.where(:name => $1).first - context_path(@context, options) - when /the context page for "([^\"]*)"/i - @source_view = "context" - @context = @current_user.contexts.where(:name => $1).first - context_path(@context, options) - when /the "([^\"]*)" context/i - @source_view = "context" - @context = @current_user.contexts.where(:name => $1).first - context_path(@context, options) - when /the "([^\"]*)" project for user "([^\"]*)"/i - @source_view = "project" - @project = User.where(:login => $2).first.projects.where(:name => $1).first - project_path(@project, options) - when /the "([^\"]*)" project/i - @source_view = "project" - @project = @current_user.projects.where(:name => $1).first - project_path(@project, options) - when /the tag page for "([^"]*)"/i - @source_view = "tag" - tag_path($1, options) - when /the change password page/ - change_password_user_path @current_user - - # Add more mappings here. - # Here is an example that pulls values out of the Regexp: - # - # when /^(.*)'s profile page$/i - # user_profile_path(User.where(:login => $1))first. - - else - begin - page_name =~ /the (.*) page/ - path_components = $1.split(/\s+/) - self.send(path_components.push('path').join('_').to_sym) - rescue Object => e - raise "Can't find mapping from \"#{page_name}\" to a path.\n" + - "Now, go and add a mapping in #{__FILE__}" - end - end - end -end - -World(NavigationHelpers) diff --git a/features/support/tracks_cucumber_settings.rb b/features/support/tracks_cucumber_settings.rb deleted file mode 100644 index e49111d8..00000000 --- a/features/support/tracks_cucumber_settings.rb +++ /dev/null @@ -1,28 +0,0 @@ -# commented out because aruba 0.5 conflics -# require 'aruba/cucumber' - -require 'capybara/rails' -require 'capybara/cucumber' -require 'capybara/session' -# BUG in this version of cucumber/capybara: require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript - -Capybara.default_wait_time = 5 -Capybara.javascript_driver = ENV["JS_DRIVER"] ? ENV["JS_DRIVER"].to_sym : :selenium -Capybara.ignore_hidden_elements = false # make find(css) find hidden elements - -if Capybara.javascript_driver == :webkit -# require 'capybara/webkit' -end - -if Capybara.javascript_driver == :selenium - profile = Selenium::WebDriver::Firefox::Profile.new - profile['intl.accept_languages'] = 'en' - - capabilities = Selenium::WebDriver::Remote::Capabilities.firefox - capabilities['elementScrollBehavior'] = 1 - - Capybara.register_driver :selenium_english do |app| - Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile, desired_capabilities: capabilities) - end - Capybara.javascript_driver = :selenium_english -end diff --git a/features/support/tracks_form_helper.rb b/features/support/tracks_form_helper.rb deleted file mode 100644 index d88e5f12..00000000 --- a/features/support/tracks_form_helper.rb +++ /dev/null @@ -1,117 +0,0 @@ -module TracksFormHelper - - def open_edit_form_for(todo) - edit_link = "div#line_todo_#{todo.id} a#icon_edit_todo_#{todo.id}" - - # make sure we can open the edit form - expect(page).to have_css(edit_link) - - # on calendar page there can be more than 1 occurance of a todo, so we select the first here - all(:css, edit_link)[0].click - wait_for_ajax - wait_for_animations_to_end - end - - def open_context_edit_form(context) - # open edit form - page.find("a#link_edit_context_#{context.id}").click - - # wait for the form to appear (which included a submit button) - expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true) - end - - def submit_form(form_xpath, button_name) - handle_js_confirm do - # on calendar page there can be more than 1 occurance of a todo, so we select the first here - within all(:xpath, form_xpath)[0] do - click_button(button_name) - end - wait_for_ajax - wait_for_animations_to_end - end - end - - def submit_multiple_next_action_form - submit_form("//form[@id='todo-form-multi-new-action']", "todo_multi_new_action_submit") - end - - def submit_next_action_form - submit_form("//form[@id='todo-form-new-action']", "todo_new_action_submit") - end - - def submit_new_context_form - submit_form("//form[@id='context-form']", "context_new_submit") - end - - def submit_new_project_form - submit_form("//form[@id='project_form']", "project_new_project_submit") - end - - def submit_edit_todo_form (todo) - submit_form("//div[@id='edit_todo_#{todo.id}']", "submit_todo_#{todo.id}") - wait_for_todo_form_to_go_away(todo) - end - - def wait_for_todo_form_to_go_away(todo) - expect(page).to_not have_content("button#submit_todo_#{todo.id}") - end - - def wait_for_context_form_to_appear(context) - expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true) - end - - def wait_for_context_form_to_go_away(context) - # wait for the form to go away - expect(page).to_not have_css("button#submit_context_#{context.id}", :visible => true) - # wait for the changed context to appear - expect(page).to have_css("a#link_edit_context_#{context.id}", :visible=> true) - end - - def open_project_edit_form(project) - click_link "link_edit_project_#{project.id}" - expect(page).to have_css("button#submit_project_#{project.id}") - end - - def submit_project_edit_form(project) - page.find("button#submit_project_#{project.id}").click - end - - def edit_project_no_wait(project) - open_project_edit_form(project) - yield - submit_project_edit_form(project) - end - - def edit_project(project) - open_project_edit_form(project) - within "form#edit_form_project_#{project.id}" do - yield - end - submit_project_edit_form(project) - - wait_for_ajax - wait_for_animations_to_end - - expect(page).to_not have_css("button#submit_project_#{project.id}", :visible => true) - end - - def edit_project_settings(project) - edit_project(project) do - yield - end - end - - def clear_context_name_from_next_action_form - execute_javascript("$('#todo_context_name').val('');") - end - - def clear_project_name_from_next_action_form - execute_javascript("$('#todo_project_name').val('');") - end - - def close_datepicker - within '.ui-datepicker' do - click_button 'Done' - end - end -end diff --git a/features/support/tracks_id_helper.rb b/features/support/tracks_id_helper.rb deleted file mode 100644 index 1ad22626..00000000 --- a/features/support/tracks_id_helper.rb +++ /dev/null @@ -1,47 +0,0 @@ -module TracksIdHelper - - def toggle_context_container_xpath(context) - "//a[@id='toggle_c#{context.id}']" - end - - def toggle_project_container_xpath(project) - "//a[@id='toggle_p#{project.id}']" - end - - def context_container_xpath(context) - "//div[@id='c#{context.id}']" - end - - def project_container_xpath(project) - id = project.nil? ? "without_project_container" : "p#{project.id}" - "//div[@id='#{id}']" - end - - def deferred_container_xpath - "//div[@id='deferred_pending_container']" - end - - def todo_line_xpath(todo) - "//div[@id='line_todo_#{todo.id}']" - end - - def todo_in_container_xpath(todo, container_type) - id = "//div[@id=\"wrong\"]" - id = context_container_xpath(todo.context) if container_type == :context - id = project_container_xpath(todo.project) if container_type == :project - return "#{id}//div[@id='line_todo_#{todo.id}']" - end - - def todo_in_context_container_xpath(todo, context) - "#{context_container_xpath(context)}#{todo_line_xpath(todo)}" - end - - def todo_in_project_container_xpath(todo, project) - "#{project_container_xpath(project)}#{todo_line_xpath(todo)}" - end - - def todo_in_deferred_container_xpath(todo) - "#{deferred_container_xpath}#{todo_line_xpath(todo)}" - end - -end \ No newline at end of file diff --git a/features/support/tracks_login_helper.rb b/features/support/tracks_login_helper.rb deleted file mode 100644 index 7599e447..00000000 --- a/features/support/tracks_login_helper.rb +++ /dev/null @@ -1,52 +0,0 @@ -class SessionBackdoorController < ::ApplicationController - skip_before_filter :login_required - - def create - session['user_id'] = params[:user_id] - user = User.find(params[:user_id]) - set_current_user(user) - user.remember_me - cookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at } - redirect_to root_path - end - - def expire_session - current_user.forget_me if logged_in? - cookies.delete :auth_token - session['user_id'] = nil - reset_session - session['expiry_time'] = Time.now - - respond_to do |format| - format.html { render :text => "Session expired for test purposes"} - format.js { render :text => "" } - end - end -end - -module TracksLoginHelper - begin - _routes = Rails.application.routes - _routes.disable_clear_and_finalize = true - _routes.clear! - Rails.application.routes_reloader.paths.each{ |path| load(path) } - _routes.draw do - # here you can add any route you want - get "/test_login_backdoor", to: "session_backdoor#create" - get "login/expire_session", to: "session_backdoor#expire_session" - end - ActiveSupport.on_load(:action_controller) { _routes.finalize! } - ensure - _routes.disable_clear_and_finalize = false - end - - def request_signin_as(user) - visit "/test_login_backdoor?user_id=#{user.id}" - end - - def signin_as(user) - session[:user_id] = user.id - @current_user = user - end - -end diff --git a/features/support/tracks_step_helper.rb b/features/support/tracks_step_helper.rb deleted file mode 100644 index dd90e085..00000000 --- a/features/support/tracks_step_helper.rb +++ /dev/null @@ -1,131 +0,0 @@ -module TracksStepHelper - - def wait_until(wait_time = Capybara.default_wait_time) - Timeout.timeout(wait_time) do - loop until yield - end - end - - def wait_for_animations_to_end - wait_until do - page.evaluate_script('$(":animated").length').zero? - end - end - - def wait_for_ajax - wait_until do - page.evaluate_script('jQuery.active').zero? - end - end - - def wait_for_auto_complete - expect(page).to have_css("ul.ui-autocomplete li.ui-state-focus", :visible => true) - end - - def click_first_line_of_auto_complete - page.find(:css, "ul.ui-autocomplete li.ui-state-focus").click - end - - def check_xpath_visibility(visible, xpath) - expect(page).send( (visible=="see" ? :to : :to_not), have_xpath(xpath, :visible => true)) - end - - def check_css_visibility(visible, css) - expect(page).send( (visible=="see" ? :to : :to_not), have_css(css, :visible => true)) - end - - def check_elem_visibility(visible, elem) - expect(elem).send( (visible=="see" ? :to : :to_not), be_visible) - end - - def find_todo(description) - todo = @current_user.todos.where(:description => description).first - expect(todo).to_not be_nil - return todo - end - - def find_context(context_name) - context = @current_user.contexts.where(:name => context_name).first - expect(context).to_not be_nil - return context - end - - def find_project(project_name) - project = @current_user.projects.where(:name => project_name).first - expect(project).to_not be_nil - return project - end - - def container_list_find_index(container, object) - div_id = "#{container}_#{object.id}" - containers = page.all("div.#{container}").map { |x| x[:id] } - return containers.find_index(div_id) - end - - def context_list_find_index(context_name) - return container_list_find_index(:context, find_context(context_name)) - end - - def project_list_find_index(project_name) - return container_list_find_index(:project, find_project(project_name)) - end - - def format_date(date) - # copy-and-past from ApplicationController::format_date - return date ? date.in_time_zone(@current_user.prefs.time_zone).strftime("#{@current_user.prefs.date_format}") : '' - end - - def context_drag_and_drop(drag_id, delta) - sortable_css = "div.ui-sortable div#container_context_#{drag_id}" - execute_javascript("$('#{sortable_css}').simulateDragSortable({move: #{delta}, handle: '.grip'});") - end - - def open_view_menu - view_menu = '#menu_view_link + ul.dropdown-menu' - # click menu - view_menu_link = "#menu_view_link" - expect(page).to have_css(view_menu_link, :visible => true) - page.find(view_menu_link).click - - # wait for menu to be visible - view_menu_item = "#menu_view_toggle_contexts" - expect(page).to have_css(view_menu_item) - - within view_menu do - yield - end - end - - def open_submenu_for(todo) - wait_for_animations_to_end - - submenu_css = "#ultodo_#{todo.id}" - - execute_javascript "$('#{submenu_css}').parent().showSuperfishUl()" - - expect(page).to have_css(submenu_css, visible: true) - submenu = page.first(submenu_css, visible: true) - - within submenu do - yield - end - end - - def handle_js_confirm(accept=true) - execute_javascript "window.original_confirm_function = window.confirm" - execute_javascript "window.confirmMsg = null" - execute_javascript "window.confirm = function(msg) { window.confirmMsg = msg; return #{!!accept}; }" - yield - ensure - execute_javascript "window.confirm = window.original_confirm_function" - end - - def get_confirm_text - page.evaluate_script "window.confirmMsg" - end - - def execute_javascript(js) - page.execute_script(js) - end - -end diff --git a/features/support/world.rb b/features/support/world.rb deleted file mode 100644 index f157c1a0..00000000 --- a/features/support/world.rb +++ /dev/null @@ -1,4 +0,0 @@ -World(TracksLoginHelper) -World(TracksStepHelper) -World(TracksFormHelper) -World(TracksIdHelper) diff --git a/features/tagging_todos.feature b/features/tagging_todos.feature deleted file mode 100644 index dd3fef30..00000000 --- a/features/tagging_todos.feature +++ /dev/null @@ -1,92 +0,0 @@ -Feature: Tagging todos - In order to organise my todos in various lists - As a Tracks user - I want to to be able to add or edit one or more tags to todos - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "@pc" - And I have a project called "hacking tracks" - - Scenario: If there are no todos with a tag, the tag page should show an empty message - When I go to the tag page for "starred" - Then I should see "Currently there are no incomplete actions with the tag 'starred'" - - @javascript - Scenario: I can remove a tag from a todo from the tag view and the todo will be removed - Given I have a todo "fix tests" in context "@pc" with tags "now" - When I go to the tag page for "now" - Then I should see the todo "fix tests" - When I edit the tags of "fix tests" to "later" - Then I should not see the todo "fix tests" - - @javascript - Scenario: I can add a new todo from tag view with that tag and it will be added to the page - When I go to the tag page for "tracks" - And I submit a new action with description "prepare release" and the tags "tracks, release" in the context "@pc" - Then I should see "prepare release" in the context container for "@pc" - - @javascript - Scenario: I can add a new todo from tag view with a different tag and it will not be added to the page - When I go to the tag page for "tracks" - And I submit a new action with description "prepare release" and the tags "release, next" in the context "@pc" - Then I should not see the todo "prepare release" - - @javascript - Scenario: I can move a tagged todo in tag view to a hidden project and it will move the todo on the page to the hidden container - Given I have a hidden project called "secret" - When I go to the tag page for "tracks" - And I submit a new action with description "prepare release" to project "hacking tracks" with tags "release, tracks" in the context "@pc" - Then I should see "prepare release" in the context container for "@pc" - When I edit the project of "prepare release" to "secret" - Then I should not see "prepare release" in the context container for "@pc" - And I should see "prepare release" in the hidden container - - @javascript - Scenario: I can move a tagged todo in tag view to a hidden context and it will move the todo on the page to the hidden container - Given I have a hidden context called "@secret" - When I go to the tag page for "tracks" - And I submit a new action with description "prepare release" and the tags "release, tracks" in the context "@pc" - Then I should see "prepare release" in the context container for "@pc" - When I edit the context of "prepare release" to "@secret" - Then I should not see "prepare release" in the context container for "@pc" - Then I should see "prepare release" in the hidden container - - @javascript - Scenario: Completing the last todo from the tag view will show the empty message - Given I have a todo "migrate old scripts" in context "@pc" with tags "starred" - When I go to the tag page for "starred" - Then I should see "migrate old scripts" in the context container for "@pc" - When I mark "migrate old scripts" as complete - Then I should not see the context container for "@pc" - And I should see "Currently there are no incomplete actions with the tag 'starred'" - - @javascript - Scenario: Setting default tags for a project will prefill new todo form for that project - When I go to the "hacking tracks" project - Then the tag field in the new todo form should be empty - And I edit the default tags to "tests" - Then the tag field in the new todo form should be "tests" - # also the tag field should be prefilled after reload - When I go to the "hacking tracks" project - Then the tag field in the new todo form should be "tests" - # and the tag field should be prefilled after submitting a new todo - When I submit a new action with description "are my tags prefilled" - Then the tags of "are my tags prefilled" should be "tests" - - @javascript - Scenario: Selecting a project with default tags when editing a todo will prefill the tags field - Given I have a todo "tag me" in the context "@pc" - And the default tags for "hacking tracks" are "TagA, TagB" - When I go to the "@pc" context - And I edit the project of "tag me" to "hacking tracks" - Then the tags of "tag me" should be "taga, tagb" - - @javascript - Scenario: If there are todos for a tag, when viewing the tag's page, the Tags field for new todos should be defaulted to that tag - Given I have a todo "migrate old scripts" in context "@pc" with tags "starred" - When I go to the tag page for "starred" - Then the tag field in the new todo form should be "starred" diff --git a/features/tickler.feature b/features/tickler.feature deleted file mode 100644 index c8512781..00000000 --- a/features/tickler.feature +++ /dev/null @@ -1,109 +0,0 @@ -Feature: Manage deferred todos - In order to hide todos that require attention in the future and not now - As a Tracks user - I want to defer these and manage them in a tickler - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And there exists a project "manage me" for user "testuser" - And I have logged in as "testuser" with password "secret" - - @javascript - Scenario Outline: I can add a deferred todo and it will show in the tickler - # also adding the first deferred todo will hide the empty message - Given I have a context called "test" - And I have selected the view for group by - When I go to the tickler page - Then I should see the empty tickler message - When I submit a new deferred action with description "a new next action" - Then I should see "a new next action" - And I should not see the empty tickler message - - Scenarios: - | grouping | - | context | - | project | - - @javascript - Scenario Outline: Editing the description of a todo in the tickler updated the todo - Given I have a deferred todo "not yet now" - And I have selected the view for group by - When I go to the tickler page - Then I should see "not yet now" - When I edit the description of "not yet now" to "almost" - Then I should not see "not yet now" - And I should see "almost" - - Scenarios: - | grouping | - | context | - | project | - - @javascript - Scenario Outline: Editing the container of a todo moves it to the new container - Given I have a context called "A" - And I have a context called "B" - And I have a project called "pA" - And I have a project called "pB" - And I have a deferred todo "not yet now" in the context "A" in the project "pA" - And I have selected the view for group by - When I go to the tickler page - Then I should see "not yet now" in the - When I edit the of "not yet now" to - Then I should see "not yet now" in the - And I should not see "not yet now" in the - - Scenarios: - | grouping | first container | new container name | new container | - | context | context container for "A" | "B" | context container for "B" | - | project | project container for "pA" | "pB" | project container for "pB" | - - @javascript - Scenario Outline: Removing the show from date from a todo removes it from the tickler - Given I have a deferred todo "not yet now" - And I have selected the view for group by - When I go to the tickler page - Then I should see "not yet now" - When I remove the show from date from "not yet now" - Then I should not see "not yet now" - And I should see the empty tickler message - When I go to the home page - Then I should see "not yet now" - - Scenarios: - | grouping | - | context | - | project | - - Scenario: Opening the tickler page shows me all deferred todos - Given I have a deferred todo "not yet now" - And I have a todo "now is a good time" - When I go to the tickler page - Then I should see "not yet now" - And I should not see "now is a good time" - - @javascript - Scenario Outline: I can mark an action complete from the tickler - Given I have a deferred todo "not yet now" - And I have selected the view for group by - When I go to the tickler page - And I mark "not yet now" as complete - Then I should not see "not yet now" - When I go to the done page - Then I should see "not yet now" - - Scenarios: - | grouping | - | context | - | project | - - Scenario: Opening the tickler page shows the deferred todos in order - Given I have a deferred todo "show tomorrow" in the context "Context B" deferred by 1 day - And I have a deferred todo "show in a year" in the context "Context B" deferred by 365 days - And I have a deferred todo "show in a week" in the context "Context B" deferred by 7 days - When I go to the tickler page - Then I should see "show tomorrow" before "show in a week" - And I should see "show tomorrow" before "show in a year" - And I should see "show in a week" before "show in a year" diff --git a/features/toggle_containers.feature b/features/toggle_containers.feature deleted file mode 100644 index e8da11cd..00000000 --- a/features/toggle_containers.feature +++ /dev/null @@ -1,113 +0,0 @@ -Feature: Toggle the containers - In order to only see the todos relevant on this moment - As a Tracks user - I want to toggle the containers so the todos in that container (context or project) are not shown - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - - @javascript - Scenario: I can toggle a context container - Given I have the following contexts - | context | hide | - | @ipad | false | - | @home | false | - | @boss | false | - And I have a project "collapse those contexts" that has the following todos - | description | context | - | test 1 | @ipad | - | test 2 | @home | - | test 3 | @boss | - When I go to the home page - Then I should see "test 1" in the context container for "@ipad" - And I should see "test 2" in the context container for "@home" - And I should see "test 3" in the context container for "@boss" - When I collapse the context container of "@ipad" - Then I should not see the todo "test 1" - And I should see "test 2" in the context container for "@home" - And I should see "test 3" in the context container for "@boss" - When I collapse the context container of "@home" - Then I should not see the todo "test 1" - And I should not see the todo "test 2" - And I should see "test 3" in the context container for "@boss" - When I collapse the context container of "@boss" - Then I should not see the todo "test 1" - And I should not see the todo "test 2" - And I should not see the todo "test 3" - - @javascript - Scenario: I can toggle a project container - Given I have the following contexts - | context | hide | - | @ipad | false | - | @home | false | - | @boss | false | - And I have a project "collapse those containers" that has the following todos - | description | context | - | test 1 | @ipad | - | test 2 | @home | - | test 3 | @boss | - And I have selected the view for group by project - When I go to the home page - Then I should see "test 1" in the project container of "collapse those containers" - And I should see "test 2" in the project container of "collapse those containers" - And I should see "test 3" in the project container of "collapse those containers" - When I collapse the project container of "collapse those containers" - Then I should not see the todo "test 1" - And I should not see the todo "test 2" - And I should not see the todo "test 3" - - @javascript - Scenario: I can hide all collapsed context containers - Given I have the following contexts - | context | hide | - | @ipad | false | - | @home | false | - | @boss | false | - And I have a project "collapse those contexts" that has the following todos - | description | context | - | test 1 | @ipad | - | test 2 | @home | - | test 3 | @boss | - When I go to the home page - Then I should see "test 1" in the context container for "@ipad" - And I should see "test 2" in the context container for "@home" - And I should see "test 3" in the context container for "@boss" - When I collapse the context container of "@home" - And I collapse the context container of "@boss" - And I collapse the context container of "@ipad" - Then I should not see the todo "test 1" - And I should not see the todo "test 2" - And I should not see the todo "test 3" - When I toggle all collapsed context containers - Then I should not see the context container for "@home" - And I should not see the context container for "@boss" - And I should not see the context container for "@ipad" - - @javascript - Scenario: I can hide all collapsed project containers - Given I have the following contexts - | context | hide | - | @ipad | false | - And I have a project "collapse those containers" that has the following todos - | description | context | - | test 1 | @ipad | - And I have a project "collapse those other containers" that has the following todos - | description | context | - | test 2 | @ipad | - And I have selected the view for group by project - When I go to the home page - Then I should see "test 1" in the project container of "collapse those containers" - And I should see "test 2" in the project container of "collapse those other containers" - When I collapse the project container of "collapse those containers" - Then I should not see the todo "test 1" - And I should see the todo "test 2" - When I collapse the project container of "collapse those other containers" - Then I should not see the todo "test 1" - And I should not see the todo "test 2" - When I toggle all collapsed context containers - Then I should not see the project container for "collapse those containers" - Then I should not see the project container for "collapse those other containers" diff --git a/features/view_done.feature b/features/view_done.feature deleted file mode 100644 index c554ec00..00000000 --- a/features/view_done.feature +++ /dev/null @@ -1,246 +0,0 @@ -Feature: Show done - In order to see what I have completed - As an user - I want to see my done todos - - Background: - Given the following user record - | login | password | is_admin | - | testuser | secret | false | - And I have logged in as "testuser" with password "secret" - And I have a context called "@pc" - And I have a project called "test project" - And I have 1 completed todos in project "test project" in context "@pc" with tags "starred" - - Scenario: Visit done overview page - When I go to the done page - Then I should see "Last Completed Actions" - And I should see "Last Completed Projects" - And I should see "Last Completed Recurring Actions" - - Scenario Outline: Page with actions links to show all completed actions - When I go to the - Then I should see "Completed actions" - And I should see "Show all" - When I follow "Show all" - Then I should be on the - - Scenarios: - | page | next page | - | home page | done actions page | - | context page for "@pc" | done actions page for context "@pc" | - | "test project" project | done actions page for project "test project" | - | tag page for "starred" | done actions page for tag "starred" | - - Scenario Outline: I can see all todos completed in the last timeperiod - When I go to the - Then I should see "todo 1" - And I should see "Completed today" - And I should see "Completed in the rest of this week" - And I should see "Completed in the rest of this month" - - Scenarios: - | page | - | done actions page | - | done actions page for context "@pc" | - | done actions page for project "test project" | - | done actions page for tag "starred" | - - Scenario Outline: I can see all todos completed - When I go to the - And I should see "You can see all completed actions here" - When I follow "here" - Then I should be on the - - Scenarios: - | page | other page | - | done actions page | all done actions page | - | done actions page for project "test project" | all done actions page for project "test project" | - | done actions page for context "@pc" | all done actions page for context "@pc" | - | done actions page for tag "starred" | all done actions page for tag "starred" | - - Scenario Outline: I can browse all todos completed by page - Given I have 50 completed todos with a note in project "test project" in context "@pc" with tags "starred" - When I go to the - Then I should see the page selector - When I select the second page - Then I should be on the - And the page should be "2" - - Scenarios: - | page | - | all done actions page | - | all done actions page for project "test project" | - | all done actions page for context "@pc" | - | all done actions page for tag "starred" | - - Scenario: The projects page shows a link to all completed projects - Given I have a completed project called "finished" - When I go to the projects page - Then I should see "finished" - And I should see "Show all" - When I follow "Show all" - Then I should be on the done projects page - And I should see "finished" - - Scenario: I can browse all completed projects by page - Given I have 40 completed projects - When I go to the projects page - Then I should see "10 / 40" - When I follow "Show all" - Then I should see the page selector - And I should see "40 (1-20)" - When I select the second page - Then I should be on the done projects page - And the page should be "2" - - Scenario: The recurring todos page shows a link to all completed recurring todos - Given I have a completed recurrence pattern "finished" - When I go to the recurring todos page - Then I should see "finished" - And I should see "Show all" - When I follow "Show all" - Then I should be on the done recurring todos page - And I should see "finished" - - Scenario: I can browse all completed recurring todos by page - Given I have 40 completed recurrence patterns - When I go to the recurring todos page - And I follow "Show all" - Then I should see the page selector - And I should see "40 (1-20)" - When I select the second page - Then I should be on the done recurring todos page - And the page should be "2" - - @javascript - Scenario: I can toggle a done recurring todo active from done page - Given I have a completed recurrence pattern "test pattern" - When I go to the done recurring todos page - Then I should see "test pattern" - When I mark the pattern "test pattern" as active - Then I should not see "test pattern" in the completed recurring todos container - When I go to the recurring todos page - Then I should see "test pattern" in the active recurring todos container - - @javascript - Scenario: I can delete a recurring todo from the done page - Given I have a completed recurrence pattern "test pattern" - When I go to the done recurring todos page - Then I should see "test pattern" - When I delete the pattern "test pattern" - Then I should not see "test pattern" in the completed recurring todos container - When I go to the recurring todos page - Then I should not see "test pattern" in the active recurring todos container - - @javascript - Scenario Outline: I can toggle a todo active from the done pages - When I go to the - Then I should see the todo "todo 1" - When I mark the completed todo "todo 1" active - Then I should not see the todo "todo 1" - When I go to the - Then I should see "todo 1" - - Scenarios: - | page | next page | where | - | done actions page | home page | in the context container for "@pc" | - | all done actions page | home page | in the context container for "@pc" | - | done actions page for context "@pc" | context page for "@pc" | | - | done actions page for project "test project" | "test project" project | | - | done actions page for tag "starred" | home page | in the context container for "@pc" | - | all done actions page for context "@pc" | context page for "@pc" | | - | all done actions page for project "test project"| "test project" project | | - | all done actions page for tag "starred" | home page | in the context container for "@pc" | - - @javascript - Scenario: Activating the last todo will show empty message - When I go to the done actions page - Then I should see "todo 1" in the done today container - When I mark the completed todo "todo 1" active - Then I should not see the todo "todo 1" - And I should see empty message for done today of done actions - - @javascript - Scenario Outline: I can toggle the star of a todo from the done pages - When I go to the - Then I should see a starred "todo 1" - When I unstar the action "todo 1" - Then I should see an unstarred "todo 1" - - Scenarios: - | page | - | done actions page | - | all done actions page | - | done actions page for context "@pc" | - | done actions page for project "test project" | - | done actions page for tag "starred" | - | all done actions page for context "@pc" | - | all done actions page for project "test project"| - | all done actions page for tag "starred" | - - @javascript - Scenario: I can edit a project to active from the project done page - Given I have a completed project called "completed project" - When I go to the done projects page - Then I should see "completed project" - When I edit the project state of "completed project" to "active" - Then I should not see the project "completed project" - When I go to the projects page - Then I should see "completed project" - - Scenario Outline: All pages are internationalized - Given I set the locale to "" - When I go to the - Then I should not see "translation missing" - - Scenarios: - | page | locale | - | done actions page | en | - | all done actions page | en | - | done actions page for context "@pc" | en | - | done actions page for project "test project" | en | - | done actions page for tag "starred" | en | - | all done actions page for context "@pc" | en | - | all done actions page for project "test project"| en | - | all done actions page for tag "starred" | en | - | done actions page | nl | - | all done actions page | nl | - | done actions page for context "@pc" | nl | - | done actions page for project "test project" | nl | - | done actions page for tag "starred" | nl | - | all done actions page for context "@pc" | nl | - | all done actions page for project "test project"| nl | - | all done actions page for tag "starred" | nl | - | done actions page | de | - | all done actions page | de | - | done actions page for context "@pc" | de | - | done actions page for project "test project" | de | - | done actions page for tag "starred" | de | - | all done actions page for context "@pc" | de | - | all done actions page for project "test project"| de | - | all done actions page for tag "starred" | de | - | done actions page | es | - | all done actions page | es | - | done actions page for context "@pc" | es | - | done actions page for project "test project" | es | - | done actions page for tag "starred" | es | - | all done actions page for context "@pc" | es | - | all done actions page for project "test project"| es | - | all done actions page for tag "starred" | es | - | done actions page | fr | - | all done actions page | fr | - | done actions page for context "@pc" | fr | - | done actions page for project "test project" | fr | - | done actions page for tag "starred" | fr | - | all done actions page for context "@pc" | fr | - | all done actions page for project "test project"| fr | - | all done actions page for tag "starred" | fr | - | done actions page | cs | - | all done actions page | cs | - | done actions page for context "@pc" | cs | - | done actions page for project "test project" | cs | - | done actions page for tag "starred" | cs | - | all done actions page for context "@pc" | cs | - | all done actions page for project "test project"| cs | - | all done actions page for tag "starred" | cs | diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake deleted file mode 100644 index 9f53ce49..00000000 --- a/lib/tasks/cucumber.rake +++ /dev/null @@ -1,65 +0,0 @@ -# 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. - - -unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks - -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({:ok => 'test:prepare'}, 'Run features that should pass') do |t| - t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. - t.fork = true # You may get faster startup if you set this to false - t.profile = 'default' - end - - Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'wip' - end - - Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'rerun' - end - - desc 'Run all features' - task :all => [:ok, :wip] - - task :statsetup do - require 'rails/code_statistics' - ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') - ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') - end - end - desc 'Alias for cucumber:ok' - task :cucumber => 'cucumber:ok' - - task :default => :cucumber - - task :features => :cucumber do - STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" - end - - # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon. - task 'test:prepare' do - end - - task :stats => 'cucumber:statsetup' -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 - -end diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 00000000..117aa192 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +docker_compose="docker-compose --file docker-compose.yml" + +function cleanup() { + $docker_compose down +} + +function die() { + echo $@ + exit 1 +} + + +trap cleanup EXIT + +export RAILS_ENV=test + +# Put a config/site.yml file in place since it's needed for operation +cp config/site.yml.tmpl config/site.yml + +$docker_compose build +$docker_compose up -d +script/poll-for-db + +# Leaving this in since it will be needed for Rails 5 +# bin/rails db:environment:set RAILS_ENV=test || true + +bin/rake db:reset +bin/rake test + diff --git a/script/console b/script/console new file mode 100755 index 00000000..ff671891 --- /dev/null +++ b/script/console @@ -0,0 +1,7 @@ +#!/bin/sh + +appdir=$(cd $(dirname "$0")/.. && pwd) +[ -f /etc/app-env ] || exec "$appdir/script/docker-environment" $0 $@ + +export RAILS_ENV='development' +bin/rails console diff --git a/script/docker-environment b/script/docker-environment new file mode 100755 index 00000000..423122d6 --- /dev/null +++ b/script/docker-environment @@ -0,0 +1,17 @@ +#!/bin/sh +# Run a command in the app's environment + +set -e + +# Find our app dir and just run the command in we're in the container since the +# container is built with an /etc/app-env file inside of it. +appdir=$(cd $(dirname "$0")/.. && pwd) +[ -f /etc/app-env ] && exec "$@" + +# Otherwise, run docker compose to run our command in the container +cmd="$@"; [ "$#" -eq 0 ] && cmd=bash +export VOLUME="$appdir:/app" +image=${DOCKER_IMAGE:=web} + +port_publish=""; [ "${BIND_DOCKER_SERVICE_PORTS:-}" = 1 ] && port_publish="--service-ports" +exec docker-compose run $port_publish --rm $image $cmd diff --git a/script/poll-for-db b/script/poll-for-db new file mode 100755 index 00000000..97f1c794 --- /dev/null +++ b/script/poll-for-db @@ -0,0 +1,12 @@ +#!/bin/bash + +appdir=$(cd $(dirname "$0")/.. && pwd) +[ -f /etc/app-env ] || exec "$appdir/script/docker-environment" $0 $@ + +for i in {1..60}; do + curl -sf db:3306 >/dev/null && exit + sleep 1 +done + +echo "Unable to reach database!" +exit 1 diff --git a/script/server b/script/server new file mode 100755 index 00000000..59d2d32b --- /dev/null +++ b/script/server @@ -0,0 +1,7 @@ +#!/bin/sh + +export BIND_DOCKER_SERVICE_PORTS=1 +appdir=$(cd $(dirname "$0")/.. && pwd) +[ -f /etc/app-env ] || exec "$appdir/script/docker-environment" $0 $@ + +bin/rails server -b 0.0.0.0 diff --git a/test/controllers/preferences_controller_test.rb b/test/controllers/preferences_controller_test.rb index 3b7d617b..98efc207 100644 --- a/test/controllers/preferences_controller_test.rb +++ b/test/controllers/preferences_controller_test.rb @@ -57,7 +57,11 @@ class PreferencesControllerTest < ActionController::TestCase :prefs => { :date_format => "%m-%d-%Y", :week_starts => "0", :show_number_completed => "10", :show_completed_projects_in_sidebar => "false", :show_hidden_contexts_in_sidebar => "false", :staleness_starts => "14", :due_style => "1" }} updated_admin_user = users(:admin_user).reload - assert_equal old_password_hash, updated_admin_user.password + if old_password_hash.nil? + assert_nil updated_admin_user.password + else + assert_equal old_password_hash, updated_admin_user.password + end end end diff --git a/test/controllers/recurring_todos_controller_test.rb b/test/controllers/recurring_todos_controller_test.rb index 7ce7f335..6c1d8a17 100644 --- a/test/controllers/recurring_todos_controller_test.rb +++ b/test/controllers/recurring_todos_controller_test.rb @@ -224,7 +224,7 @@ class RecurringTodosControllerTest < ActionController::TestCase assert_equal UserTime.new(user).midnight(target_date), new_todo.due # show_from should be nil since now+4.days-10.days is in the past - assert_equal nil, new_todo.show_from + assert_nil new_todo.show_from end def test_last_sunday_of_march diff --git a/test/controllers/todos_controller_test.rb b/test/controllers/todos_controller_test.rb index 1781a0b0..ec203975 100644 --- a/test/controllers/todos_controller_test.rb +++ b/test/controllers/todos_controller_test.rb @@ -32,9 +32,9 @@ class TodosControllerTest < ActionController::TestCase p.save! login_as(:admin_user) get :index - assert_equal nil, assigns['project_not_done_counts'][projects(:timemachine).id] + assert_nil assigns['project_not_done_counts'][projects(:timemachine).id] assert_equal 2, assigns['context_not_done_counts'][contexts(:call).id] - assert_equal nil, assigns['context_not_done_counts'][contexts(:lab).id] + assert_nil assigns['context_not_done_counts'][contexts(:lab).id] end def test_not_done_counts_after_hiding_project diff --git a/test/models/project_from_todo_test.rb b/test/models/project_from_todo_test.rb index 6bdc1f07..6149203b 100644 --- a/test/models/project_from_todo_test.rb +++ b/test/models/project_from_todo_test.rb @@ -8,8 +8,16 @@ class ProjectFromTodoTest < ActiveSupport::TestCase todo = todos(:upgrade_rails) project = ProjectFromTodo.new(todo).create assert_equal project.name, todo.description - assert_equal project.description, todo.notes - assert_equal project.default_context, todo.context + if project.description.nil? + assert_nil todo.notes + else + assert_equal project.description, todo.notes + end + if project.default_context.nil? + assert_nil todo.context + else + assert_equal project.default_context, todo.context + end end def test_retain_tags_from_todo diff --git a/test/models/recurring_todo_test.rb b/test/models/recurring_todo_test.rb index 79ef192f..8a59bf39 100644 --- a/test/models/recurring_todo_test.rb +++ b/test/models/recurring_todo_test.rb @@ -30,8 +30,8 @@ class RecurringTodoTest < ActiveSupport::TestCase @every_day.target='show_from_date' # when recurrence is targeted on show_from, due date should remain nil - assert_equal nil, @every_day.get_due_date(nil) - assert_equal nil, @every_day.get_due_date(@today-3.days) + assert_nil @every_day.get_due_date(nil) + assert_nil @every_day.get_due_date(@today-3.days) # check show from get the next day assert_equal_dmy @today, @every_day.get_show_from_date(@today-1.days) @@ -40,7 +40,7 @@ class RecurringTodoTest < ActiveSupport::TestCase @every_day.target='due_date' # when target on due_date, show_from is relative to due date unless show_always is true @every_day.show_always = true - assert_equal nil, @every_day.get_show_from_date(@today-1.days) + assert_nil @every_day.get_show_from_date(@today-1.days) @every_day.show_always = false @every_day.show_from_delta=10 @@ -52,7 +52,7 @@ class RecurringTodoTest < ActiveSupport::TestCase # when show_from is nil, show always (happend in tests) @every_day.show_from_delta=nil - assert_equal nil, @every_day.get_show_from_date(@today+9.days) + assert_nil @every_day.get_show_from_date(@today+9.days) # TODO: show_from has no use case for daily pattern. Need to test on # weekly/monthly/yearly diff --git a/test/models/rich_message_extractor_test.rb b/test/models/rich_message_extractor_test.rb index cecdbdcd..828234e6 100644 --- a/test/models/rich_message_extractor_test.rb +++ b/test/models/rich_message_extractor_test.rb @@ -21,7 +21,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "ohai", extractor.description assert_equal "some-context", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_without_context @@ -37,7 +37,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "ohai", extractor.description assert_equal "", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_without_anything @@ -45,7 +45,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "", extractor.description assert_equal "", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_with_just_a_context @@ -53,7 +53,7 @@ class RichMessageExtractorTest < Minitest::Test extractor = RichMessageExtractor.new(message) assert_equal "", extractor.description assert_equal "some-context", extractor.context - assert_equal nil, extractor.project + assert_nil extractor.project end def test_message_with_tags @@ -65,7 +65,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_tags message = "no tags" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.tags + assert_nil extractor.tags end def test_message_with_due_date @@ -77,7 +77,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_due_date message = "no date" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.due + assert_nil extractor.due end def test_message_with_show_from @@ -89,7 +89,7 @@ class RichMessageExtractorTest < Minitest::Test def test_message_with_no_show_from message = "no tickler" extractor = RichMessageExtractor.new(message) - assert_equal nil, extractor.show_from + assert_nil extractor.show_from end def test_message_with_star