module Spree::TestingSupport::AuthHelpers

Public Instance Methods

log_in(email:, password:, remember_me: true) click to toggle source
# File lib/spree/testing_support/auth_helpers.rb, line 4
def log_in(email:, password:, remember_me: true)
  visit spree.login_path

  fill_in 'Email', with: email
  fill_in 'Password', with: password

  # Regression test for #1257
  first('label', text: 'Remember me').click if remember_me
  click_button 'Log in'

  expect(page).to have_content 'Logged in successfully'
end
log_out() click to toggle source
# File lib/spree/testing_support/auth_helpers.rb, line 17
def log_out
  show_user_menu
  click_link 'LOG OUT'

  expect(page).to have_content 'Signed out successfully'
end
show_user_account() click to toggle source
# File lib/spree/testing_support/auth_helpers.rb, line 28
def show_user_account
  within '#nav-bar' do
    show_user_menu
    click_link 'MY ACCOUNT'
  end
end
show_user_menu() click to toggle source
# File lib/spree/testing_support/auth_helpers.rb, line 24
def show_user_menu
  find("button[aria-label='Show user menu']").click
end