Sha256: 2548dbf9173550a24157f4e6fa9ce16e9fbed44a1de0dae2b73e4921f558516c

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class ImpersonationSystemTest < SystemTest
      def test_impersonating_a_user
        user = create_user(email: 'impersonated@workarea.com')
        create_user(
          email: 'bcrouse@workarea.com',
          password: 'W3bl1nc!',
          super_admin: true
        )

        visit storefront.login_path

        within '#login_form' do
          fill_in 'email', with: 'bcrouse@workarea.com'
          fill_in 'password', with: 'W3bl1nc!'
          click_button 'login'
        end

        visit admin.user_path(user)
        click_button t('workarea.admin.users.show.impersonate')

        assert_equal(storefront.users_account_path, current_path)
        assert(page.has_content?('Success'))
        assert(page.has_content?('impersonated@workarea.com'))

        visit storefront.root_path

        within_frame find('.admin-toolbar') do
          wait_for_iframe
          assert(page.has_content?('impersonated@workarea.com'))
          click_button 'Stop Impersonation'
        end

        assert_equal(storefront.root_path, current_path)
        assert(page.has_content?('Success'))

        visit storefront.users_account_path
        assert(page.has_no_content?('impersonated@workarea.com'))

        visit admin.user_path(user)
        click_button t('workarea.admin.users.show.impersonate')

        visit admin.root_path
        within '.header' do
          assert(page.has_content?('impersonated@workarea.com'))
          click_button 'Stop Impersonation'
        end

        assert_equal(admin.user_path(user), current_path)
        assert(page.has_content?('Success'))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-admin-3.5.21 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.42 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.20 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.41 test/system/workarea/admin/impersonation_system_test.rb