Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Stabilize account sync UI tests across midnight (#4279)

Sure Admin (bot)aea278495a0c
diff --git a/test/system/accounts_sync_ui_test.rb b/test/system/accounts_sync_ui_test.rb
index 248abd4a94..bf66b2530c 100644
--- a/test/system/accounts_sync_ui_test.rb
+++ b/test/system/accounts_sync_ui_test.rb
@@ -3,7 +3,12 @@ require "application_system_test_case"
class AccountsSyncUiTest < ApplicationSystemTestCase
setup do
@user = users(:family_admin)
+ # These tests control sync state explicitly; login must not start a new
+ # sync when fixtures were loaded before midnight.
+ @user.family.update!(auto_sync_on_login: false)
Sync.for_family(@user.family).incomplete.destroy_all
+ # Exercise the previous-day fixture boundary without waiting for midnight.
+ @user.family.syncs.update_all(created_at: 1.day.ago)
sign_in @user
end
@@ -11,7 +16,7 @@ class AccountsSyncUiTest < ApplicationSystemTestCase
visit accounts_path
within "#accounts-sync-controls" do
- assert_selector "button[aria-label='#{I18n.t("accounts.index.sync")}']"
+ assert_selector "button:not([disabled])[aria-label='#{I18n.t("accounts.index.sync")}']"
assert_no_text I18n.t("accounts.index.cancel_sync")
end
end