The personal finance app for everyone (by everyone)
Ruby
Improve chat tracking and system test assertions
Juan José Matab438a1c8ddef
diff --git a/test/controllers/chats_controller_test.rb b/test/controllers/chats_controller_test.rbindex a3f7f58ebe..79b3641f3a 100644--- a/test/controllers/chats_controller_test.rb+++ b/test/controllers/chats_controller_test.rb@@ -21,8 +21,13 @@ class ChatsControllerTest < ActionDispatch::IntegrationTestendtest "shows chat" do- get chat_url(chats(:one))+ chat = chats(:one)+ @user.update!(last_viewed_chat: nil)++ get chat_url(chat)+assert_response :success+ assert_equal chat, @user.reload.last_viewed_chatendtest "destroys chat" dodiff --git a/test/system/chats_test.rb b/test/system/chats_test.rbindex 3796211078..23aa48aec8 100644--- a/test/system/chats_test.rb+++ b/test/system/chats_test.rb@@ -31,24 +31,13 @@ class ChatsTest < ApplicationSystemTestCasetest "sidebar shows last viewed chat" dowith_env_overrides OPENAI_ACCESS_TOKEN: "test-token" do- @user.update!(ai_enabled: true)- chat_title = @user.chats.first.title-- visit root_url-- click_on chat_title-- # Wait for the chat to actually load before refreshing- within "#chat-container" do- assert_selector "h1", text: chat_title- end+ chat = @user.chats.first+ @user.update!(ai_enabled: true, last_viewed_chat: chat)- # Page refreshvisit root_url- # After page refresh, we're still on the last chat we were viewingwithin "#chat-container" do- assert_selector "h1", text: chat_title+ assert_selector "h1", text: chat.titleendendenddiff --git a/test/system/property_test.rb b/test/system/property_test.rbindex 19941144f6..7e905b645a 100644--- a/test/system/property_test.rb+++ b/test/system/property_test.rb@@ -14,7 +14,7 @@ class PropertiesEditTest < ApplicationSystemTestCasetest "can persist property subtype" doclick_link "[system test] Property Account"open_account_edit_dialog- assert_equal "single_family_home", find("#account_accountable_attributes_subtype").value+ assert_field "account_accountable_attributes_subtype", with: "single_family_home"endprivatediff --git a/test/system/transaction_category_select_test.rb b/test/system/transaction_category_select_test.rbindex c219cdbec5..1ae2b9fc07 100644--- a/test/system/transaction_category_select_test.rb+++ b/test/system/transaction_category_select_test.rb@@ -17,7 +17,11 @@ class TransactionCategorySelectTest < ApplicationSystemTestCaseassert_text 'Create "Inline Test Category"'click_button 'Create "Inline Test Category"'- assert_text "Inline Test Category"+ assert_selector(+ "[data-category-select-target='option'][aria-selected='true']",+ text: "Inline Test Category",+ visible: :all+ )endend