mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* Fix OIDC household invitation (issue #900) - Auto-add existing user when inviting by email (no invite email sent) - Accept page: choose 'Create account' or 'Sign in' (supports OIDC) - Store invitation token in session on sign-in; accept after login (password, OIDC, OIDC link, OIDC JIT, MFA) - Invitation#accept_for!(user): add user to household and mark accepted - Defensive guards: nil/blank user, token normalization, accept_for! return check * Address PR review: rename accept_for! to accept_for, i18n OIDC notice, test fixes, stub Rails.application.config * Fix flaky system test: assert only configure step, not flash message Co-authored-by: Cursor <cursoragent@cursor.com> --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: mkdev11 <jaysmth689+github@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.4 KiB
Ruby
37 lines
1.4 KiB
Ruby
require "application_system_test_case"
|
|
|
|
class DragAndDropImportTest < ApplicationSystemTestCase
|
|
setup do
|
|
sign_in users(:family_admin)
|
|
end
|
|
|
|
test "upload csv via hidden input on transactions index" do
|
|
visit transactions_path
|
|
|
|
assert_selector "#transactions[data-controller*='drag-and-drop-import']"
|
|
|
|
# We can't easily simulate a true native drag-and-drop in headless chrome via Capybara without complex JS.
|
|
# However, we can verify that the hidden form exists and works when a file is "dropped" (input populated).
|
|
# The Stimulus controller's job is just to transfer the dropped file to the input and submit.
|
|
|
|
file_path = file_fixture("imports/transactions.csv")
|
|
|
|
# Manually make form and input visible
|
|
execute_script("
|
|
var form = document.querySelector('form[action=\"#{imports_path}\"]');
|
|
form.classList.remove('hidden');
|
|
var input = document.querySelector('input[name=\"import[import_file]\"]');
|
|
input.classList.remove('hidden');
|
|
input.style.display = 'block';
|
|
")
|
|
|
|
attach_file "import[import_file]", file_path
|
|
|
|
# Submit the form manually since we bypassed the 'drop' event listener which triggers submit
|
|
find("form[action='#{imports_path}']").evaluate_script("this.requestSubmit()")
|
|
|
|
# Redirect lands on configuration step; flash may not be visible in CI
|
|
assert_text "Configure your import"
|
|
end
|
|
end
|