mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-18 20:59:39 +02:00
* WIP * WIP * WIP * WIP * WIP * WIP * WIP * format * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * fix conflict * fix conflict * chore: run rubocop * fix test * update PWA logo * fix tests * chore: lint * fix test * Refactor: Remove duplicate data attribute in activity partial and add chat form rendering in chats index --------- Co-authored-by: Josh Pigford <josh@joshpigford.com>
168 lines
3.6 KiB
Ruby
168 lines
3.6 KiB
Ruby
require "application_system_test_case"
|
|
|
|
class ImportsTest < ApplicationSystemTestCase
|
|
include ActiveJob::TestHelper
|
|
|
|
setup do
|
|
sign_in @user = users(:family_admin)
|
|
|
|
# Trade securities will be imported as "offline" tickers
|
|
Security.stubs(:provider).returns(nil)
|
|
end
|
|
|
|
test "transaction import" do
|
|
visit new_import_path
|
|
|
|
click_on "Import transactions"
|
|
|
|
find("button[data-id='csv-paste-tab']").click
|
|
|
|
fill_in "import[raw_file_str]", with: file_fixture("imports/transactions.csv").read
|
|
|
|
find('input[type="submit"][value="Upload CSV"]').click
|
|
|
|
select "Date", from: "Date*"
|
|
select "YYYY-MM-DD", from: "Date format"
|
|
select "Amount", from: "Amount"
|
|
select "Account", from: "Account (optional)"
|
|
select "Name", from: "Name (optional)"
|
|
select "Category", from: "Category (optional)"
|
|
select "Tags", from: "Tags (optional)"
|
|
select "Notes", from: "Notes (optional)"
|
|
|
|
click_on "Apply configuration"
|
|
|
|
click_on "Next step"
|
|
|
|
assert_selector "h1", text: "Assign your categories"
|
|
click_on "Next"
|
|
|
|
assert_selector "h1", text: "Assign your tags"
|
|
click_on "Next"
|
|
|
|
assert_selector "h1", text: "Assign your accounts"
|
|
click_on "Next"
|
|
|
|
click_on "Publish import"
|
|
|
|
assert_text "Import in progress"
|
|
|
|
perform_enqueued_jobs
|
|
|
|
click_on "Check status"
|
|
|
|
assert_text "Import successful"
|
|
|
|
click_on "Back to dashboard"
|
|
end
|
|
|
|
test "trade import" do
|
|
visit new_import_path
|
|
|
|
click_on "Import investments"
|
|
|
|
find("button[data-id='csv-paste-tab']").click
|
|
|
|
fill_in "import[raw_file_str]", with: file_fixture("imports/trades.csv").read
|
|
|
|
find('input[type="submit"][value="Upload CSV"]').click
|
|
|
|
select "YYYY-MM-DD", from: "Date format"
|
|
|
|
click_on "Apply configuration"
|
|
|
|
click_on "Next step"
|
|
|
|
assert_selector "h1", text: "Assign your accounts"
|
|
click_on "Next"
|
|
|
|
click_on "Publish import"
|
|
|
|
assert_text "Import in progress"
|
|
|
|
perform_enqueued_jobs
|
|
|
|
click_on "Check status"
|
|
|
|
assert_text "Import successful"
|
|
|
|
click_on "Back to dashboard"
|
|
end
|
|
|
|
test "account import" do
|
|
visit new_import_path
|
|
|
|
click_on "Import accounts"
|
|
|
|
find("button[data-id='csv-paste-tab']").click
|
|
|
|
fill_in "import[raw_file_str]", with: file_fixture("imports/accounts.csv").read
|
|
|
|
find('input[type="submit"][value="Upload CSV"]').click
|
|
|
|
click_on "Apply configuration"
|
|
|
|
click_on "Next step"
|
|
|
|
assert_selector "h1", text: "Assign your account types"
|
|
|
|
all("form").each do |form|
|
|
within(form) do
|
|
select = form.find("select")
|
|
select "Depository", from: select["id"]
|
|
sleep 0.5
|
|
end
|
|
end
|
|
|
|
click_on "Next"
|
|
|
|
click_on "Publish import"
|
|
|
|
assert_text "Import in progress"
|
|
|
|
perform_enqueued_jobs
|
|
|
|
click_on "Check status"
|
|
|
|
assert_text "Import successful"
|
|
|
|
click_on "Back to dashboard"
|
|
end
|
|
|
|
test "mint import" do
|
|
visit new_import_path
|
|
|
|
click_on "Import from Mint"
|
|
|
|
find("button[data-id='csv-paste-tab']").click
|
|
|
|
fill_in "import[raw_file_str]", with: file_fixture("imports/mint.csv").read
|
|
|
|
find('input[type="submit"][value="Upload CSV"]').click
|
|
|
|
click_on "Apply configuration"
|
|
|
|
click_on "Next step"
|
|
|
|
assert_selector "h1", text: "Assign your categories"
|
|
click_on "Next"
|
|
|
|
assert_selector "h1", text: "Assign your tags"
|
|
click_on "Next"
|
|
|
|
assert_selector "h1", text: "Assign your accounts"
|
|
click_on "Next"
|
|
|
|
click_on "Publish import"
|
|
|
|
assert_text "Import in progress"
|
|
|
|
perform_enqueued_jobs
|
|
|
|
click_on "Check status"
|
|
|
|
assert_text "Import successful"
|
|
|
|
click_on "Back to dashboard"
|
|
end
|
|
end
|