mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-08 06:55:21 +02:00
Update onboarding system tests to reflect UI changes and improve assertions
- Changed button labels from "Get started" to "Continue" and "Complete" to align with updated UI. - Updated text assertions for clarity, changing "Set your preferences" to "Configure your preferences". - Adjusted locale selection options to include language codes. - Enhanced validation error handling in preferences form. - Improved navigation assertions to ensure accurate path checks.
This commit is contained in:
parent
d7256af705
commit
5ab9c4a725
1 changed files with 22 additions and 19 deletions
|
@ -16,25 +16,25 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
visit onboarding_path
|
visit onboarding_path
|
||||||
|
|
||||||
assert_text "Let's set up your account"
|
assert_text "Let's set up your account"
|
||||||
assert_button "Get started"
|
assert_button "Continue"
|
||||||
|
|
||||||
# Navigate to preferences
|
# Navigate to preferences
|
||||||
click_button "Get started"
|
click_button "Continue"
|
||||||
|
|
||||||
assert_current_path preferences_onboarding_path
|
assert_current_path preferences_onboarding_path
|
||||||
assert_text "Set your preferences"
|
assert_text "Configure your preferences"
|
||||||
|
|
||||||
# Test that the chart renders without errors (this would catch the Series bug)
|
# Test that the chart renders without errors (this would catch the Series bug)
|
||||||
assert_selector "[data-controller='time-series-chart']"
|
assert_selector "[data-controller='time-series-chart']"
|
||||||
|
|
||||||
# Fill out preferences form
|
# Fill out preferences form
|
||||||
select "English", from: "user_family_attributes_locale"
|
select "English (en)", from: "user_family_attributes_locale"
|
||||||
select "United States Dollar (USD)", from: "user_family_attributes_currency"
|
select "United States Dollar (USD)", from: "user_family_attributes_currency"
|
||||||
select "MM/DD/YYYY", from: "user_family_attributes_date_format"
|
select "MM/DD/YYYY", from: "user_family_attributes_date_format"
|
||||||
select "Light", from: "user_theme"
|
select "Light", from: "user_theme"
|
||||||
|
|
||||||
# Submit preferences
|
# Submit preferences
|
||||||
click_button "Continue"
|
click_button "Complete"
|
||||||
|
|
||||||
# Should redirect to goals page
|
# Should redirect to goals page
|
||||||
assert_current_path goals_onboarding_path
|
assert_current_path goals_onboarding_path
|
||||||
|
@ -100,22 +100,25 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
|
|
||||||
# Clear required fields and try to submit
|
# Clear required fields and try to submit
|
||||||
select "", from: "user_family_attributes_locale"
|
select "", from: "user_family_attributes_locale"
|
||||||
click_button "Continue"
|
click_button "Complete"
|
||||||
|
|
||||||
# Should stay on preferences page with validation errors
|
# Should stay on preferences page with validation errors (may have query params)
|
||||||
assert_current_path preferences_onboarding_path
|
assert_match %r{/onboarding/preferences}, current_path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "preferences form saves data correctly" do
|
test "preferences form saves data correctly" do
|
||||||
visit preferences_onboarding_path
|
visit preferences_onboarding_path
|
||||||
|
|
||||||
# Fill out form with specific values
|
# Fill out form with specific values
|
||||||
select "Spanish", from: "user_family_attributes_locale"
|
select "Spanish (es)", from: "user_family_attributes_locale"
|
||||||
select "Euro (EUR)", from: "user_family_attributes_currency"
|
select "Euro (EUR)", from: "user_family_attributes_currency"
|
||||||
select "DD/MM/YYYY", from: "user_family_attributes_date_format"
|
select "DD/MM/YYYY", from: "user_family_attributes_date_format"
|
||||||
select "Dark", from: "user_theme"
|
select "Dark", from: "user_theme"
|
||||||
|
|
||||||
click_button "Continue"
|
click_button "Complete"
|
||||||
|
|
||||||
|
# Wait for redirect to goals page to ensure form was submitted
|
||||||
|
assert_current_path goals_onboarding_path
|
||||||
|
|
||||||
# Verify data was saved
|
# Verify data was saved
|
||||||
@family.reload
|
@family.reload
|
||||||
|
@ -123,7 +126,7 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
|
|
||||||
assert_equal "es", @family.locale
|
assert_equal "es", @family.locale
|
||||||
assert_equal "EUR", @family.currency
|
assert_equal "EUR", @family.currency
|
||||||
assert_equal "DD/MM/YYYY", @family.date_format
|
assert_equal "%d/%m/%Y", @family.date_format
|
||||||
assert_equal "dark", @user.theme
|
assert_equal "dark", @user.theme
|
||||||
assert_not_nil @user.set_onboarding_preferences_at
|
assert_not_nil @user.set_onboarding_preferences_at
|
||||||
end
|
end
|
||||||
|
@ -135,7 +138,7 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
visit goals_onboarding_path
|
visit goals_onboarding_path
|
||||||
|
|
||||||
assert_text "What brings you to Maybe?"
|
assert_text "What brings you to Maybe?"
|
||||||
assert_button "Continue"
|
assert_button "Next"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "trial page renders correctly" do
|
test "trial page renders correctly" do
|
||||||
|
@ -147,16 +150,16 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
test "navigation between onboarding steps" do
|
test "navigation between onboarding steps" do
|
||||||
# Start at main onboarding
|
# Start at main onboarding
|
||||||
visit onboarding_path
|
visit onboarding_path
|
||||||
click_button "Get started"
|
click_button "Continue"
|
||||||
|
|
||||||
# Should be at preferences
|
# Should be at preferences
|
||||||
assert_current_path preferences_onboarding_path
|
assert_current_path preferences_onboarding_path
|
||||||
|
|
||||||
# Complete preferences
|
# Complete preferences
|
||||||
select "English", from: "user_family_attributes_locale"
|
select "English (en)", from: "user_family_attributes_locale"
|
||||||
select "United States Dollar (USD)", from: "user_family_attributes_currency"
|
select "United States Dollar (USD)", from: "user_family_attributes_currency"
|
||||||
select "MM/DD/YYYY", from: "user_family_attributes_date_format"
|
select "MM/DD/YYYY", from: "user_family_attributes_date_format"
|
||||||
click_button "Continue"
|
click_button "Complete"
|
||||||
|
|
||||||
# Should be at goals
|
# Should be at goals
|
||||||
assert_current_path goals_onboarding_path
|
assert_current_path goals_onboarding_path
|
||||||
|
@ -166,14 +169,14 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
visit preferences_onboarding_path
|
visit preferences_onboarding_path
|
||||||
|
|
||||||
# Check that navigation shows current step
|
# Check that navigation shows current step
|
||||||
assert_selector ".onboarding-nav" # Adjust selector based on actual implementation
|
assert_selector "ul.hidden.md\\:flex.items-center.gap-2"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "logout option is available during onboarding" do
|
test "logout option is available during onboarding" do
|
||||||
visit preferences_onboarding_path
|
visit preferences_onboarding_path
|
||||||
|
|
||||||
# Should have logout option
|
# Should have logout option (rendered as a button component)
|
||||||
assert_link "Sign out" # Adjust based on actual implementation
|
assert_text "Sign out"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -188,5 +191,5 @@ class OnboardingsTest < ApplicationSystemTestCase
|
||||||
|
|
||||||
# Wait for successful login
|
# Wait for successful login
|
||||||
assert_current_path root_path
|
assert_current_path root_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue