Advertisement
Guest User

robertopuzza

a guest
May 18th, 2017
593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1.  
  2. #STATIC PAGES FEATURE
  3. Given /^I am on the Home Page$/ do
  4. visit root_path
  5. end
  6.  
  7. Then /^I should see "You'll never play alone"$/ do
  8. expect(page).to have_content "You'll never play alone"
  9. end
  10.  
  11. When /^I follow "Contact"$/ do
  12. click_on "Contact"
  13. end
  14.  
  15. When /^I follow "About"$/ do
  16. click_on "About"
  17. end
  18.  
  19. Then /^I should see Contact Page$/ do
  20. expect(page).to have_content "Contact"
  21. end
  22.  
  23. Then /^I should see the About Page$/ do
  24. expect(page).to have_content "About"
  25. end
  26.  
  27.  
  28. #SIGN UP FEATURE
  29. When /^I follow "Sign Up"$/ do
  30. click_on "Sign Up"
  31. end
  32.  
  33. Then /^I should be on the Sign Up Page$/ do
  34. expect(page.current_path).to eq new_user_registration_path
  35. end
  36.  
  37. When /^I fill in "Username" with "rossimario95"$/ do
  38. fill_in("Username", with: "rossimario95")
  39. end
  40.  
  41. And /^I fill in "Email" with "mariorossi@gmail.com"$/ do
  42. fill_in("Email", with: "mariorossi@gmail.com")
  43. end
  44.  
  45. And /^I fill in "Password" with "123456"$/ do
  46. fill_in("Password", with: "123456")
  47. end
  48.  
  49. And /^I fill in "Password confirmation" with "123456"$/ do
  50. fill_in("Password confirmation", with: "123456")
  51. end
  52.  
  53. And /^I fill in "First name" with "Mario"$/ do
  54. fill_in("First name", with: "Mario")
  55. end
  56.  
  57. And /^I fill in "Last name" with "Rossi"$/ do
  58. fill_in("Last name", with: "Rossi")
  59. end
  60.  
  61. And /^I select "Male" from "Gender"$/ do
  62. find(:xpath, "//label[@for='user_gender']").click
  63. end
  64.  
  65. And /^I fill in "Birth date" with "22-02-1955"$/ do
  66. fill_in("Birth date", with: "22/02/1955")
  67. end
  68.  
  69. And /^I select "Italy" from "nation"$/ do
  70. select('Italy', from: 'nation')
  71. page.execute_script("$('#countries').trigger('change')")
  72. end
  73.  
  74. And /^I select "Latium" from "region"$/ do
  75. select('Latium', from: 'region')
  76. end
  77.  
  78. And /^I select "Drummer" from "Instrument played"$/ do
  79. select("Drummer", from: "Instrument played")
  80. end
  81.  
  82. And /^I select "Rock" from "Favourite musical genre"$/ do
  83. select("Rock", from: "Favourite musical genre")
  84. end
  85.  
  86. And /^I press "Submit"$/ do
  87. click_on "Submit"
  88. end
  89.  
  90. Then /^I should be on the User Home Page$/ do
  91. expect(page).to have_content "questa è l'home page che vede l'utente loggato"
  92. end
  93.  
  94.  
  95. #Sign in feature
  96.  
  97. When /^I follow "Sign In"$/ do
  98. click_on "Sign In"
  99. end
  100.  
  101. Then /^I should be on the Sign In Page$/ do
  102. expect(page).to have_content "Log in"
  103. end
  104.  
  105.  
  106. When /^I follow "Sign in with Google"$/ do
  107. click_on "Sign in with Google"
  108. end
  109.  
  110. When /^I follow "Sign in with Facebook"$/ do
  111. click_on "Sign in with Facebook"
  112. end
  113.  
  114. And /^Google authorizes me$/ do
  115. visit user_google_oauth2_omniauth_callback
  116. end
  117.  
  118. And /^Facebook authorizes me$/ do
  119. visit user_facebook_omniauth_callback
  120. end
  121.  
  122. #SIGN IN WITH GOOGLE
  123.  
  124.  
  125. #LOG OUT
  126. Given /^I am on the User Profile Page$/ do
  127. visit users_show_path
  128. end
  129.  
  130. When /^I follow "Sign Out"$/ do
  131.  
  132. #find(:css, ".btn-primary[id="SignOut"]").click
  133. find(:xpath, '/input[@id="SignOut"]')
  134. end
  135.  
  136. Then /^I should be on the Home Page$/ do
  137. expect(page.current_path).to eq root_path
  138. end
  139.  
  140. #MODIFY PROFILE INFORMATIONS
  141.  
  142. Given /^Exists user "Mario Rossi" with email: "mariorossi1998@randomdomain.com" and password: "123456"$/ do
  143. user = User.new({
  144. :email => "mariorossi1998@randomdomain.com",
  145. :username => "mario1998",
  146. :password => "123456",
  147. :password_confirmation => "123456"
  148. })
  149. user.skip_confirmation!
  150. expect(user.save).to eq true
  151. end
  152.  
  153. And /^I am logged in as "Mario Rossi"$/ do
  154. visit root_path
  155. click_on "Sign In"
  156. fill_in("Email", with: "mariorossi1998@randomdomain.com")
  157. fill_in("Password", with: "123456")
  158. click_on "Log in"
  159. expect(page.current_path).to eq root_path #deve stare sulla root, per essere sicuri che si è loggati, altrimenti rimane sulla login
  160. end
  161.  
  162. And /^I am on the User Home Page$/ do
  163. visit root_path
  164. expect(page).to have_content "questa è l'home page che vede l'utente loggato"
  165. end
  166.  
  167. And /^I follow "Settings"$/ do
  168.  
  169. end
  170.  
  171. Then /^I should be on the Edit User Profile Page$/ do
  172.  
  173. end
  174.  
  175. When /^I fill "First Name" with "Carlo"$/ do
  176.  
  177. end
  178.  
  179. And /^I fill "Last Name" with "Rossi"$/ do
  180.  
  181. end
  182.  
  183. And /^I follow "Update"$/ do
  184.  
  185. end
  186.  
  187.  
  188. And /^I should see a feedback that confirm the changes$/ do
  189.  
  190. end
  191.  
  192. When /^I fill "First Name" with "carlo"$/ do
  193. end
  194.  
  195. And /^I fill "Last Name" with "rossi"$/ do
  196.  
  197. end
  198.  
  199. And /^I should see a feedback that shows error$/ do
  200.  
  201. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement