From 50efd27710343293afb2d803ca07135820492680 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 20:04:24 -0700 Subject: [PATCH 1/4] Removing webmock from cucumber - interferes with capybara (more investigation needed). --- Gemfile | 2 +- features/support/env.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 70a944119..4e8b65d55 100644 --- a/Gemfile +++ b/Gemfile @@ -60,7 +60,7 @@ group :test do gem 'rspec-rails', '>= 2.0.0' gem 'mocha' gem 'database_cleaner', '0.5.2' - gem 'webmock' + gem 'webmock', :require => false gem 'jasmine', :path => 'vendor/gems/jasmine', :require => false gem 'mongrel', :require => false if RUBY_VERSION.include? "1.8" end diff --git a/features/support/env.rb b/features/support/env.rb index 2fb86c4dc..f196e1776 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -22,8 +22,6 @@ require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links wi # steps to use the XPath syntax. Capybara.default_selector = :css -WebMock.disable_net_connect!(:allow_localhost => true) - # If you set this to false, any error raised from within your app will bubble # up to your step definition and out to cucumber unless you catch it somewhere # on the way. You can make Rails rescue errors and render error pages on a From 8193f2e3506808c9f5d3495d4a16dc7c6cfb380a Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 20:05:15 -0700 Subject: [PATCH 2/4] Adding the rest of the new user setup to cucumber. wip scenario for skipping the profile wizard. --- features/signs_up.feature | 31 ++++++++++++++++++++++++++++++- features/support/paths.rb | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/features/signs_up.feature b/features/signs_up.feature index 59d34f3fa..e64b066e7 100644 --- a/features/signs_up.feature +++ b/features/signs_up.feature @@ -1,10 +1,11 @@ +@javascript Feature: new user registration Scenario: new user sees profile wizard When I go to the new user registration page And I fill in "Username" with "ohai" And I fill in "Email" with "ohai@example.com" - And I fill in "Password" with "secret" + And I fill in "user_password" with "secret" And I fill in "Password confirmation" with "secret" And I press "Sign up" Then I should be on the getting started page @@ -16,4 +17,32 @@ Feature: new user registration Then I should see "Profile updated" And I should see "Your aspects" +# Not working with selenium - it thinks the aspect name field is hidden +# When I fill in "Aspect name" with "cheez friends" +# And I press "Add" +# And show me the page +# Then I should see "cheez friends" + When I follow "Save and continue" + Then I should see "Your services" + When I follow "Save and continue" + Then I should see "You're all set up, O!" + + When I follow "Continue on to your everyone page, an overview of all of your aspects." + Then I should be on the home page + And I should see "We know you have friends, bring them to Diaspora!" + + @wip + Scenario: new user can skip the profile wizard + When I go to the new user registration page + And I fill in "Username" with "ohai" + And I fill in "Email" with "ohai@example.com" + And I fill in "Password" with "secret" + And I fill in "Password confirmation" with "secret" + And I press "Sign up" + Then I should be on the getting started page + And I should see "Welcome to Diaspora!" + + When I follow "skip getting started" + Then I should be on the home page + And I should see "We know you have friends, bring them to Diaspora!" diff --git a/features/support/paths.rb b/features/support/paths.rb index 3d3f64724..9a08357a0 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -1,6 +1,8 @@ module NavigationHelpers def path_to(page_name) case page_name + when /^the home page$/ + root_path when /^its ([\w ]+) page$/ send("#{$1.gsub(/\W+/, '_')}_path", @it) when /^the ([\w ]+) page$/ From cb09249058b0a045d0fb0c2c7e83e29cfb86d7d4 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 22:49:40 -0700 Subject: [PATCH 3/4] Refactor aspect cucumber feature - now happy path only. --- features/manages_aspects.feature | 14 ++++++++++++++ features/user_creates_an_aspect.feature | 21 --------------------- 2 files changed, 14 insertions(+), 21 deletions(-) create mode 100644 features/manages_aspects.feature delete mode 100644 features/user_creates_an_aspect.feature diff --git a/features/manages_aspects.feature b/features/manages_aspects.feature new file mode 100644 index 000000000..74f6744f4 --- /dev/null +++ b/features/manages_aspects.feature @@ -0,0 +1,14 @@ +@aspects @javascript +Feature: User manages aspects + In order to share with a limited group + As a User + I want to create new aspects + + Scenario: creating an aspect + Given I am signed in + When I follow "Manage" in the header + And I follow "Add a new aspect" + And I fill in "Name" with "Dorm Mates" in the modal window + And I press "Create" in the modal window + Then I should see "Dorm Mates" in the header + And I should see "Your aspect 'Dorm Mates' is empty." diff --git a/features/user_creates_an_aspect.feature b/features/user_creates_an_aspect.feature deleted file mode 100644 index d611d412f..000000000 --- a/features/user_creates_an_aspect.feature +++ /dev/null @@ -1,21 +0,0 @@ -@aspects @javascript -Feature: User creates an aspect - In order to share with a limited group - As a User - I want to create a new aspect - - Background: - Given I am signed in - And I follow "Manage" in the header - And I follow "Add a new aspect" - - Scenario: success - Given I fill in "Name" with "Dorm Mates" in the modal window - When I press "Create" in the modal window - Then I should see "Dorm Mates" in the header - And I should see "Your aspect 'Dorm Mates' is empty." - - Scenario: I omit the name - Given I fill in "Name" with "" in the modal window - When I press "Create" in the modal window - Then I should see "Aspect creation failed." From 9594e11ded9fe1c5338aecd046c3c8e0f4101d8c Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 22:50:20 -0700 Subject: [PATCH 4/4] Add feature for skipping the setup wizard. --- features/signs_up.feature | 16 ++++------------ features/step_definitions/custom_web_steps.rb | 4 ++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/features/signs_up.feature b/features/signs_up.feature index e64b066e7..d449034cf 100644 --- a/features/signs_up.feature +++ b/features/signs_up.feature @@ -1,7 +1,7 @@ @javascript Feature: new user registration - Scenario: new user sees profile wizard + Background: When I go to the new user registration page And I fill in "Username" with "ohai" And I fill in "Email" with "ohai@example.com" @@ -11,6 +11,7 @@ Feature: new user registration Then I should be on the getting started page And I should see "Welcome to Diaspora!" + Scenario: new user goes through the setup wizard When I fill in "person_profile_first_name" with "O" And I fill in "person_profile_last_name" with "Hai" And I press "Save and continue" @@ -32,17 +33,8 @@ Feature: new user registration Then I should be on the home page And I should see "We know you have friends, bring them to Diaspora!" - @wip - Scenario: new user can skip the profile wizard - When I go to the new user registration page - And I fill in "Username" with "ohai" - And I fill in "Email" with "ohai@example.com" - And I fill in "Password" with "secret" - And I fill in "Password confirmation" with "secret" - And I press "Sign up" - Then I should be on the getting started page - And I should see "Welcome to Diaspora!" - + Scenario: new user skips the setup wizard When I follow "skip getting started" + And I wait for the home page to load Then I should be on the home page And I should see "We know you have friends, bring them to Diaspora!" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index d213cbf4d..c98150d3d 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -20,4 +20,8 @@ Then /^I should see "([^\"]*)" in the main content area$/ do |stuff| within("#stream") do Then "I should see #{stuff}" end +end + +When /^I wait for the home page to load$/ do + wait_until { current_path == root_path } end \ No newline at end of file