Class: Booth::Testing::Support::Shortcuts::LoginWithPasskey

Inherits:
Object
  • Object
show all
Includes:
Logging, Booth::Testing::Shortcuts, CapybaraStepLogger, Calls, Capybara::DSL
Defined in:
lib/booth/testing/support/shortcuts/login_with_passkey.rb

Instance Method Summary collapse

Methods included from Booth::Testing::Shortcuts

#assert_logged_in, #assert_logged_out, #assert_userland_view, #clear_cookies, #create_and_onboard, #decrypt_session_cookie, #login_with_passkey, #register_new_passkey, #virtual_authenticators, #visit_namespaced

Instance Method Details

#callObject



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
# File 'lib/booth/testing/support/shortcuts/login_with_passkey.rb', line 18

def call
  log { Paint['Starting Subroutine LoginWithPasskey', '#ff9900'] }

  ::Booth::Testing::Support::Visit.call(routing_namespace:,
                                        controller: :logins,
                                        action: :new)

  ::Booth::Testing::Support::AssertPartial.call(namespace: :userland,
                                                controller: :logins,
                                                step: :enter_username)

  fill_in :username, with: username
  click_on :submit

  # Wait for HTML to be loaded before checking its <template>
  assert_selector 'template', visible: false

  if page.html.include?('userland/logins/remote_session_available')
    ::Booth::Testing::Support::AssertPartial.call(namespace: :userland,
                                                  controller: :logins,
                                                  step: :remote_session_available)
    click_on :skip
  end

  ::Booth::Testing::Support::AssertPartial.call(namespace: :userland,
                                                controller: :logins,
                                                step: :enter_webauth)
  click_on :authenticate

  ::Booth::Testing::Support::AssertLoggedIn.call(scope:, username:)

  log { Paint['Finished Subroutine LoginWithPasskey', '#ff9900'] }

  nil
end