1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-06 14:05:20 +02:00

Test fixes

This commit is contained in:
Zach Gollwitzer 2025-07-18 17:42:08 -04:00
parent 3baf60a24f
commit 88359be7e4
2 changed files with 18 additions and 18 deletions

View file

@ -124,17 +124,14 @@ class Settings::ApiKeysTest < ApplicationSystemTestCase
# Click the revoke button to open the modal
click_button "Revoke Key"
# Wait for the modal to appear and click Confirm
# The dialog might take a moment to appear
sleep 0.5
# Wait for the dialog and then confirm
assert_selector "#confirm-dialog", visible: true
within "#confirm-dialog" do
assert_text "Are you sure you want to revoke this API key?"
click_button "Confirm"
end
# Wait for the page to update after revoke
sleep 0.5
# Wait for redirect after revoke
assert_no_selector "#confirm-dialog"
assert_text "Create Your API Key"
assert_text "Get programmatic access to your Maybe data"

View file

@ -117,23 +117,26 @@ class TransactionsTest < ApplicationSystemTestCase
end
assert_text "No entries found"
# Wait for Turbo to finish updating the DOM
sleep 0.5
# Page reload doesn't affect results
visit current_url
assert_text "No entries found"
within "ul#transaction-search-filters" do
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
# Remove all filters by clicking their X buttons
# Get all the filter buttons at once to avoid stale elements
filter_count = page.all("ul#transaction-search-filters li button").count
# Click each one with a small delay to let Turbo update
filter_count.times do
page.all("ul#transaction-search-filters li button").first.click
sleep 0.1
end
assert_selector "#" + dom_id(@transaction), count: 1
assert_text @transaction.name
end
test "can select and deselect entire page of transactions" do
@ -191,7 +194,7 @@ class TransactionsTest < ApplicationSystemTestCase
fill_in "Date", with: transfer_date
fill_in "model[amount]", with: 175.25
click_button "Add transaction"
within "#entry-group-" + transfer_date.to_s do
within "#" + dom_id(investment_account, "entries_#{transfer_date}") do
assert_text "175.25"
end
end