mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* Add OpenID Connect login support * Add docs for OIDC config with Google Auth * Use Google styles for log in - Add support for linking existing account - Force users to sign-in with passoword first, when linking existing accounts - Add support to create new user when using OIDC - Add identities to user to prevent account take-ver - Make tests mocking instead of being integration tests - Manage session handling correctly - use OmniAuth.config.mock_auth instead of passing auth data via request env * Conditionally render Oauth button - Set a config item `configuration.x.auth.oidc_enabled` - Hide button if disabled --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: sokie <sokysrm@gmail.com>
42 lines
1.0 KiB
Ruby
42 lines
1.0 KiB
Ruby
require "test_helper"
|
|
|
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|
setup do
|
|
Capybara.default_max_wait_time = 5
|
|
end
|
|
|
|
driven_by :selenium, using: ENV["CI"].present? ? :headless_chrome : ENV.fetch("E2E_BROWSER", :chrome).to_sym, screen_size: [ 1400, 1400 ]
|
|
|
|
private
|
|
|
|
def sign_in(user)
|
|
visit new_session_path
|
|
within %(form[action='#{sessions_path}']) do
|
|
fill_in "Email", with: user.email
|
|
fill_in "Password", with: user_password_test
|
|
click_on "Log in"
|
|
end
|
|
|
|
# Trigger Capybara's wait mechanism to avoid timing issues with logins
|
|
find("h1", text: "Welcome back, #{user.first_name}")
|
|
end
|
|
|
|
def login_as(user)
|
|
sign_in(user)
|
|
end
|
|
|
|
def sign_out
|
|
find("#user-menu").click
|
|
click_button "Logout"
|
|
|
|
# Trigger Capybara's wait mechanism to avoid timing issues with logout
|
|
find("h2", text: "Sign in to your account")
|
|
end
|
|
|
|
def within_testid(testid)
|
|
within "[data-testid='#{testid}']" do
|
|
yield
|
|
end
|
|
end
|
|
end
|