Sha256: 85efcb1551ee9f02288abda6283592d67015c1526d336c6790faeae3bab0f5d4

Contents?: true

Size: 1.76 KB

Versions: 42

Compression:

Stored size: 1.76 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(admin.user_path(user), current_path)
        assert(page.has_content?('Success'))

        find('.view').hover # Ensure tooltipster menu isn't open
        assert(page.has_content?('bcrouse@workarea.com'))

        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

42 entries across 42 versions & 1 rubygems

Version Path
workarea-admin-3.5.19 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.40 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.18 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.39 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.17 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.38 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.16 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.37 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.15 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.36 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.14 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.35 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.13 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.34 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.12 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.33 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.11 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.10 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.4.32 test/system/workarea/admin/impersonation_system_test.rb
workarea-admin-3.5.9 test/system/workarea/admin/impersonation_system_test.rb