Class: Booth::Test::Userland::Otps::Manage
- Inherits:
-
Object
- Object
- Booth::Test::Userland::Otps::Manage
- Includes:
- MethodObject, Helpers
- Defined in:
- lib/booth/test/userland/otps/manage.rb
Instance Method Summary collapse
Methods included from Helpers
#assert_logged_in, #assert_logged_out, #assert_userland_partial, #create_virtual_authenticator, #extract_otp_secret_key_and_generate_code, #setup_virtual_authenticator_environment, #soft_reset_session
Methods included from MethodObject
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/booth/test/userland/otps/manage.rb', line 15 def call # Setup credential = ::Booth::Models::Credential.create!( username: 'alice', password: 'qwrasfyxv', scope:, mode: :username_and_password, allowed_modes: %i[username_and_password username_password_and_otp] ) after_credential&.call(credential.id) # Login page.visit new_login_path assert_userland_partial controller: :login, step: :enter_username page.fill_in :username, with: 'alice' page.click_on :submit assert_userland_partial controller: :login, step: :enter_password page.fill_in :password, with: 'qwrasfyxv' page.click_on :submit # Add OTP assert_logged_in credential: credential page.visit show_otp_path assert_userland_partial controller: :otp, step: :add page.click_on :add assert_userland_partial controller: :otp, step: :register page.assert_selector '[data-booth=otpqr]' page.assert_text 'otpauth://totp/' page.click_on :registered # Back one step assert_userland_partial controller: :otp, step: :confirm page.click_on :change # Continue adding OTP assert_userland_partial controller: :otp, step: :register code = extract_otp_secret_key_and_generate_code page.click_on :registered assert_userland_partial controller: :otp, step: :confirm page.fill_in :code, with: code page.click_on :submit assert_userland_partial controller: :otp, step: :successfully_changed page.visit show_otp_path assert_userland_partial controller: :otp, step: :show page.assert_selector '[data-booth=otpqr]' page.assert_text 'otpauth://totp/' travel 19.minutes page.visit show_otp_path assert_userland_partial controller: :otp, step: :show travel 2.minutes page.visit show_otp_path assert_userland_partial controller: :otp, step: :sudo end |