From 90b2008e927f50ca0a58101fd045b8ea543f2ff2 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sat, 25 Oct 2014 05:43:33 +0000 Subject: [PATCH 1/3] fix failing cucumber test in distribute_to_commits.feature * Scenario: Distribute to commits not linked to a GitHub account User#recipient_label method was prefering to show identifier instead of email when nick was undefined but the test was expecting an email address - not sure which was the intended behavior but showing email to the use rather than an obtuse ID seems more reasonable --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b7c05860..7c42fd76 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -65,14 +65,14 @@ def email_required? def recipient_label if nickname.present? nickname - elsif identifier.present? - identifier elsif email.present? if new_record? "#{email} (new user)" else email end + elsif identifier.present? + identifier else "Unknown user" end From 19b0f5b10b7501d3113508db63e85338b688f250 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sun, 26 Oct 2014 01:52:44 +0000 Subject: [PATCH 2/3] fix failing cucumber tests in distribute.feature several tests that filled fields on the Distribution edit form were were passing and failing intermittently this was most likely due to the 'auto-complete' feature notably scenarios: * Send distribution to multiple users * Remove a distribution line * Create distribution line without an amount adding a one second delay to these steps has made all tests passing * Given(/^I add the GitHub user "(.*?)" to the recipients$/) * Given(/^I add the user with email "(.*?)" through his identifier to the recipients$/) * When(/^I add the commit "(.*?)" to the recipients$/) --- features/distribution.feature | 2 +- features/step_definitions/distribution.rb | 2 ++ features/support/ajax.rb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 features/support/ajax.rb diff --git a/features/distribution.feature b/features/distribution.feature index 77053a9c..9b895a41 100644 --- a/features/distribution.feature +++ b/features/distribution.feature @@ -235,7 +235,7 @@ Feature: Fundraisers can distribute funds And the project balance should be "490.00" @javascript - Scenario: Send to an known email address who has no confirmation token + Scenario: Send to a known email address who has no confirmation token Given an user with email "bob@example.com" and without password nor confirmation token And a project managed by "alice" And our fee is "0" diff --git a/features/step_definitions/distribution.rb b/features/step_definitions/distribution.rb index 95b3a71e..ab5b2704 100644 --- a/features/step_definitions/distribution.rb +++ b/features/step_definitions/distribution.rb @@ -25,6 +25,8 @@ find("input:enabled").set(arg1) click_on "Add" end + + wait_for_ajax end Given(/^I add the email address "(.*?)" to the recipients$/) do |arg1| diff --git a/features/support/ajax.rb b/features/support/ajax.rb new file mode 100644 index 00000000..6c9b4bb4 --- /dev/null +++ b/features/support/ajax.rb @@ -0,0 +1,2 @@ + +def wait_for_ajax ; sleep(1) ; end ; From 1a7a6fdc7fa04d562868d6c58e36bf9647477589 Mon Sep 17 00:00:00 2001 From: bill auger Date: Sun, 26 Oct 2014 14:43:02 +0000 Subject: [PATCH 3/3] add ajax wait to other tests filling autocomplete fields these were intended to be included in the previous commit --- features/step_definitions/distribution.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/features/step_definitions/distribution.rb b/features/step_definitions/distribution.rb index ab5b2704..449f37e1 100644 --- a/features/step_definitions/distribution.rb +++ b/features/step_definitions/distribution.rb @@ -43,6 +43,8 @@ find("input:enabled").set(user.identifier) click_on "Add" end + + wait_for_ajax end When(/^I select the commit recipients "(.*?)"$/) do |arg1| @@ -56,6 +58,8 @@ find("input:enabled").set(arg1) click_on "Add" end + + wait_for_ajax end Given(/^I fill the amount to "(.*?)" with "(.*?)"$/) do |arg1, arg2|