Sha256: 4fd8952cbe48fb67a77dd55b409c740406d8fd5876bbd78c5951b1c0239fabba

Contents?: true

Size: 1.72 KB

Versions: 2

Compression:

Stored size: 1.72 KB

Contents

require 'test_helper'

module Workarea
  decorate Storefront::PasswordsSystemTest, with: :one_theme do
    def test_admin_forcing_password_resets
      Workarea.with_config do |config|
        config.password_lifetime = 1.second
        sleep(1)

        # sign in for the first time
        visit storefront.login_path

        within '#login_form' do
          fill_in 'email', with: @admin_email
          fill_in 'password', with: 'W3bl1nc!'
          click_button t('workarea.storefront.users.login')
        end

        assert_current_path(storefront.change_password_path)

        # sign out
        reset_session!

        visit storefront.login_path

        # sign in again
        within '#login_form' do
          fill_in 'email', with: @admin_email
          fill_in 'password', with: 'W3bl1nc!'
          click_button t('workarea.storefront.users.login')
        end

        assert_current_path(storefront.change_password_path)

        # disallow all other page movement
        visit storefront.root_path
        assert_current_path(storefront.change_password_path)

        config.password_lifetime = 1.hour
        fill_in 'old_password', with: 'W3bl1nc!'
        fill_in 'password', with: @password
        click_button t('workarea.storefront.users.change_password')

        assert_current_path(storefront.users_account_path)

        page.find(".page-header__user-link").click
        click_link t('workarea.storefront.users.logout')
        visit storefront.login_path

        within '#login_form' do
          fill_in 'email', with: @admin_email
          fill_in 'password', with: @password
          click_button t('workarea.storefront.users.login')
        end
        assert_current_path(admin.root_path)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-one_theme-1.3.1 test/system/workarea/storefront/passwords_system_test.decorator
workarea-one_theme-1.3.0 test/system/workarea/storefront/passwords_system_test.decorator