1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Preserve transaction filters and transaction focus across page visits (#1733)

* Preserve transaction filters across page visits

* Preserve params when per_page is updated

* Autofocus selected transactions

* Lint fixes

* Fix syntax error

* Fix filter clearing

* Update e2e tests for new UI

* Consolidate focus behavior into concern

* Lint fixes
This commit is contained in:
Zach Gollwitzer 2025-01-30 14:12:01 -05:00 committed by GitHub
parent 0b17976256
commit 282c05345d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 310 additions and 243 deletions

View file

@ -5,7 +5,7 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
Capybara.default_max_wait_time = 5
end
driven_by :selenium, using: ENV["CI"].present? ? :headless_chrome : :chrome, screen_size: [ 1400, 1400 ]
driven_by :selenium, using: ENV["CI"].present? ? :headless_chrome : ENV.fetch("E2E_BROWSER", :chrome).to_sym, screen_size: [ 1400, 1400 ]
private

View file

@ -1,13 +0,0 @@
require "test_helper"
class Account::EntriesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in @user = users(:family_admin)
@entry = account_entries(:transaction)
end
test "gets index" do
get account_entries_path(account_id: @entry.account.id)
assert_response :success
end
end

View file

@ -79,7 +79,7 @@ class TradesTest < ApplicationSystemTestCase
end
def visit_account_portfolio
visit account_path(@account)
visit account_path(@account, tab: "holdings")
end
def select_combobox_option(text)

View file

@ -6,7 +6,7 @@ class TransactionsTest < ApplicationSystemTestCase
Account::Entry.delete_all # clean slate
@uncategorized_transaction = create_transaction("one", 12.days.ago.to_date, 100)
create_transaction("one", 12.days.ago.to_date, 100)
create_transaction("two", 10.days.ago.to_date, 100)
create_transaction("three", 9.days.ago.to_date, 100)
create_transaction("four", 8.days.ago.to_date, 100)
@ -15,7 +15,7 @@ class TransactionsTest < ApplicationSystemTestCase
create_transaction("seven", 4.days.ago.to_date, 100)
create_transaction("eight", 3.days.ago.to_date, 100)
create_transaction("nine", 1.days.ago.to_date, 100)
create_transaction("ten", 1.days.ago.to_date, 100)
@uncategorized_transaction = create_transaction("ten", 1.days.ago.to_date, 100)
create_transaction("eleven", Date.current, 100, category: categories(:food_and_drink), tags: [ tags(:one) ], merchant: merchants(:amazon))
@transactions = @user.family.entries
@ -124,13 +124,13 @@ class TransactionsTest < ApplicationSystemTestCase
assert_text "No entries found"
within "ul#transaction-search-filters" do
find("li", text: account.name).first("a").click
find("li", text: "on or after #{10.days.ago.to_date}").first("a").click
find("li", text: "on or before #{1.day.ago.to_date}").first("a").click
find("li", text: "Income").first("a").click
find("li", text: "less than 200").first("a").click
find("li", text: category.name).first("a").click
find("li", text: merchant.name).first("a").click
find("li", text: account.name).first("button").click
find("li", text: "on or after #{10.days.ago.to_date}").first("button").click
find("li", text: "on or before #{1.day.ago.to_date}").first("button").click
find("li", text: "Income").first("button").click
find("li", text: "less than 200").first("button").click
find("li", text: category.name).first("button").click
find("li", text: merchant.name).first("button").click
end
assert_selector "#" + dom_id(@transaction), count: 1