Module: Spree::TestingSupport::AuthHelpers
- Defined in:
- lib/spree/testing_support/auth_helpers.rb
Instance Method Summary collapse
- #log_in(email:, password:, remember_me: true, locale: nil) ⇒ Object
- #log_out ⇒ Object
- #login_button ⇒ Object
- #logout_button ⇒ Object
- #show_user_account ⇒ Object
- #show_user_menu ⇒ Object
Instance Method Details
#log_in(email:, password:, remember_me: true, locale: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 12 def log_in(email:, password:, remember_me: true, locale: nil) visit spree.login_path(locale: locale) fill_in Spree.t(:email), with: email fill_in Spree.t(:password), with: password # Regression test for #1257 first('label', text: Spree.t(:remember_me)).click if remember_me expect(page).to have_content Spree.t(:logged_in_successfully) end |
#log_out ⇒ Object
25 26 27 28 29 30 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 25 def log_out click_link expect(page).to have_content 'Signed out successfully' end |
#login_button ⇒ Object
4 5 6 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 4 def Spree.version.to_f == 4.1 ? Spree.t(:log_in) : Spree.t(:login) end |
#logout_button ⇒ Object
8 9 10 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 8 def Spree.version.to_f == 4.1 ? Spree.t('nav_bar.log_out') : Spree.t(:logout).upcase end |
#show_user_account ⇒ Object
36 37 38 39 40 41 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 36 def show_user_account within '#nav-bar' do click_link Spree.t(:my_account).upcase end end |
#show_user_menu ⇒ Object
32 33 34 |
# File 'lib/spree/testing_support/auth_helpers.rb', line 32 def find("button[aria-label='#{Spree.t('nav_bar.show_user_menu')}']").click end |