Skip to content

Commit

Permalink
Fix cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rap1ds committed Jun 9, 2014
1 parent fbbd6c3 commit 3c99161
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 20 deletions.
4 changes: 2 additions & 2 deletions features/conversations/user_checks_inbox.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Feature: User checks inbox
And there is a message "Test message" from "kassi_testperson2" about that listing
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Massage" within ".inbox-feed"
And I should see "Test message" within ".inbox-feed"
Then I should see "Massage" within "#conversations"
And I should see "Test message" within "#conversations"

Scenario: Viewing a single conversation
And there is a listing with title "Massage" from "kassi_testperson1" with category "Services" and with transaction type "Requesting"
Expand Down
2 changes: 2 additions & 0 deletions features/conversations/user_confirms_a_transaction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Feature: User confirms a transaction
And the request is paid
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to mark the request completed"
When I follow "paid $20"
And I follow "Mark completed"

@javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Feature: User gives feedback from transaction
Scenario: Give feedback successfully
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to give feedback"
And I follow "paid $20"
And I follow "Give feedback"
And I click "#positive-grade-link"
And I fill in "How did things go?" with "Everything was great!"
Expand All @@ -43,6 +45,8 @@ Feature: User gives feedback from transaction
Scenario: Try to give feedback without required information
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to give feedback"
And I follow "paid $20"
And I follow "Give feedback"
And I press "send_testimonial_button"
Then I should see "Remember to tell whether your experience was positive or negative."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: User requests an item in item offer
When I log out
And I log in as "kassi_testperson1"
And I follow inbox link
Then I should see "Accept"
Then I should see "Waiting for you to accept the request"
When I follow "I want to borrow this item"
Then I should see "Accept"
When the system processes jobs
Expand Down
8 changes: 1 addition & 7 deletions features/conversations/user_skips_feedback.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ Feature: User skips feedback
@javascript
Scenario: Skipping feedback from the conversation page
When I follow inbox link
Then I should see "Waiting for you to give feedback"
And I follow "paid $20"
And I follow "Skip feedback"
And I should see "Feedback skipped" within ".conversation-status"

@javascript
Scenario: Skipping feedback from the received conversations page
And I am logged in as "kassi_testperson1"
When I follow inbox link
And I follow "Skip feedback"
And I should see "Feedback skipped" within ".conversation-status"
6 changes: 6 additions & 0 deletions features/payments/checkout_payment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Feature: User pays after accepted transaction
And the request is accepted
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to pay"
When I follow "I want to buy"
And I follow "Cancel"
And I fill in "Message" with "Sorry I gotta cancel"
And I choose "Skip feedback"
Expand All @@ -96,6 +98,8 @@ Feature: User pays after accepted transaction
And the request is accepted
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to pay"
When I follow "I want to buy"
And I follow "Cancel"
And I fill in "Message" with "Sorry I gotta cancel"
And I choose "Give feedback"
Expand All @@ -119,6 +123,8 @@ Feature: User pays after accepted transaction
Then I should see "Accepted"
When I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see "Waiting for you to pay"
When I follow "Ok, then pay!"
Then I should see "Pay"
When I follow "Pay"
Then I should see "New payment"
Expand Down
10 changes: 7 additions & 3 deletions features/payments/seller_creates_braintree_invoice.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ Feature: Seller creates an invoice with Braintree
And I am logged in as "kassi_testperson1"
When I follow inbox link
Then I should see that there is 1 new message
And I should see "Waiting for you to accept the request"

@javascript
Scenario: User can not accept request without Braintree account
When I follow "Accept request"
When I follow "I request this"
And I follow "Accept request"
Then I should see "You need to fill in payout details before you can accept the request"

@javascript
Scenario: User can not accept request without active Braintree account
Given there are following Braintree accounts:
| person | status | community |
| kassi_testperson1 | pending | test |
When I follow "Accept request"
When I follow "I request this"
And I follow "Accept request"
Then I should see "You need to fill in payout details before you can accept the request"

@javascript
Scenario: User accepts a payment-requiring request and creates an invoice
Given there are following Braintree accounts:
| person | status | community |
| kassi_testperson1 | active | test |
When I follow "Accept request"
When I follow "I request this"
And I follow "Accept request"
Then I should see "20.90" in the "conversation_payment_attributes_sum" input
And I should see "3" within "#service-fee"
And I should see "17.90" within "#payment-to-seller"
Expand Down
22 changes: 15 additions & 7 deletions features/step_definitions/payment_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,24 @@ def create_braintree_account(person, community, opts={})
end

Given /^I want to pay "(.*?)"$/ do |item_title|
steps %Q{Given I am on the messages page}
steps %Q{Then I should see "Pay"} # This probably fails if there are many payments waiting
steps %Q{When I follow "Pay"} # This probably fails if there are many payments waiting
steps %Q{Then I should see payment details form for Braintree}
# This probably fails if there are many payments waiting
steps %Q{
Given I am on the messages page
Then I should see "Waiting for you to pay"
When I click ".conversation-title-link"
And I follow "Pay"
Then I should see payment details form for Braintree
}
end

When /^I cancel the transaction$/ do
steps %Q{Given I am on the messages page}
steps %Q{Then I should see "Did not happen"} # This probably fails if there are many payments waiting
steps %Q{When I follow "Did not happen"} # This probably fails if there are many payments waiting
# This probably fails if there are many payments waiting
steps %Q{
Given I am on the messages page
Then I should see "Waiting for you to mark the request completed"
When I click ".conversation-title-link"
And I follow "Did not happen"
}
end

Then /^I should see payment details form for Braintree$/ do
Expand Down

0 comments on commit 3c99161

Please sign in to comment.