Module: Spree::TestingSupport::AuthHelpers

Defined in:
lib/spree/testing_support/auth_helpers.rb

Instance Method Summary collapse

Instance Method Details

#log_in(email:, password:, remember_me: true) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/spree/testing_support/auth_helpers.rb', line 4

def (email:, password:, remember_me: true)
  visit spree.

  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_outObject



17
18
19
20
21
22
# 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_accountObject



28
29
30
31
32
33
# File 'lib/spree/testing_support/auth_helpers.rb', line 28

def 
  within '#nav-bar' do
    show_user_menu
    click_link 'MY ACCOUNT'
  end
end

#show_user_menuObject



24
25
26
# File 'lib/spree/testing_support/auth_helpers.rb', line 24

def show_user_menu
  find("button[aria-label='Show user menu']").click
end