Guest User

Untitled

a guest
May 5th, 2018
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. ## feature text file - gift.feature
  2. Feature: A User adds items to their Cart
  3. In order to checkout and purchase items
  4. As a User
  5. I want to add items to my cart
  6.  
  7. Scenario: Adding a gift
  8. Given that I am on the new gift page
  9. When I fill in "20" for "Gift Amount"
  10. And I fill in "test1@example.com" for "gift_email"
  11. And I fill in "test1@example.com" for "gift_email_confirmation"
  12. And I fill in "test2@example.com" for "gift_to_email"
  13. And I fill in "test2@example.com" for "gift_to_email_confirmation"
  14. And I press "Add to Cart"
  15. Then the Gift should appear in the Cart
  16. And there should be a link to Preview the Gift
  17. And there should be a link to Edit the Gift
  18. And there should be a link to Remove the Gift
  19. And the Cart Total should be $20.00
  20.  
  21. ## steps file (run the scenarios) - gift_steps.rb
  22. Given /I am on the new gift page/ do
  23. visits "/dt/gifts/new"
  24. end
  25.  
  26. Then /the Gift should appear in the Cart/ do
  27. response.should have_tag("#cart td div.gift")
  28. end
  29.  
  30. Then /there should be a link to Preview the Gift/ do
  31. response.should have_tag("#cart td div.gift input[type=button][value=Preview]")
  32. end
  33.  
  34. Then /there should be a link to Edit the Gift/ do
  35. response.should have_tag("#cart td a[href=/dt/gifts/0/edit]")
  36. end
  37.  
  38. Then /there should be a link to Remove the Gift/ do
  39. response.should have_tag("#cart td a[href=/dt/cart?id=0][onclick~=m.setAttribute('name', '_method'); m.setAttribute('value', 'delete');]", :count => 1) do |t|
  40. t.should have_tag("img[alt=Remove item from cart]")
  41. end
  42. end
  43.  
  44. Then /the Cart Total should be \$(\d+\.\d+)/ do |n|
  45. response.should have_tag("#cart tr.footer td:last-child") do |td|
  46. td.inner_text.should == "$#{n}"
  47. end
  48. end
  49.  
  50.  
  51. ## output
  52. timg-2:1-3-development tim$ rake features
  53. (in /Users/tim/projects/donortrust/branches/1-3-development)
  54. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Users/tim/projects/donortrust/branches/1-3-development/vendor/plugins/cucumber/lib" "/Users/tim/projects/donortrust/branches/1-3-development/vendor/plugins/cucumber/bin/cucumber" --format pretty --require features/steps/cart_steps.rb --require features/steps/checkout_steps.rb --require features/steps/common_webrat.rb --require features/steps/env.rb features/cart.feature
  55. Feature: A User adds items to their Cart
  56. In order to checkout and purchase items
  57. As a User
  58. I want to add items to my cart
  59.  
  60. Scenario: Adding a gift
  61. Given that I am on the new gift page
  62. When I fill in "20" for "Gift Amount"
  63. And I fill in "test1@example.com" for "gift_email"
  64. And I fill in "test1@example.com" for "gift_email_confirmation"
  65. And I fill in "test2@example.com" for "gift_to_email"
  66. And I fill in "test2@example.com" for "gift_to_email_confirmation"
  67. And I press "Add to Cart"
  68. Then the Gift should appear in the Cart
  69. And there should be a link to Preview the Gift
  70. And there should be a link to Edit the Gift
  71. And there should be a link to Remove the Gift
  72. And the Cart Total should be $20.00
  73.  
  74.  
  75. 12 steps passed
Add Comment
Please, Sign In to add comment