You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] [EX-43] - Onboarding - User should be redirected to #admins after taking a test drive #65274
Version Number: v9.1.73-0 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from TestRail:https://expensify.testrail.io/index.php?/tests/view/6409257 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Device used: Macbook pro M1 MAX, Chrome v137.0.7151.122 App Component: Other
Action Performed:
Precondition:
Open an incognito window
Navigate to ND stage
Sign up with a gmail account
In the onboarding modal - Open console > Application > Cookies
Set the following cookies: lc-debug = 1, lc-qa = 2
Refresh the page
Steps (after precondition is completed):
Within 'What's your work email?' page, click "Skip"
Click on "Manage my team expenses" > 1-10 employees > Other
Check mark "Take a test drive", click 'Get started'
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
When a user registers as a team admin, once they enter and exit the test drive, the #admins room should be shown. Instead, the Concierge chat is shown.
What is the root cause of that problem?
The closeModal function in the test drive is not programmed to handle the expected behaviour:
What changes do you think we should make in order to solve the problem?
We should add a check in closeModal that if the preconditions are met (user is a workspace admin), then we should explicitly redirect/navigate to the admins page.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
A new test case should be added to verify that when a user registers as a team admin and enters and exits the test drive, they are correctly redirected to the #admins room and not the Concierge chat.
We should also add a test case to ensure there is no regression in behaviour for non-admins, i.e. if a user is not a workspace admin, then they should not be redirected to #admins but instead to the Concierge chat.
@barrettj12 Thanks for the proposal. The RCA is not correct. The closeModal function already handles navigation to the admin room (as you can see there is a isAdminRoom condition).
🚨 Edited by proposal-police: This proposal was edited at 2025-07-22 04:02:51 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users completing the "Manage my team expenses" onboarding flow should be redirected to the #admins room after clicking "Get started" in the test drive demo. However, they are being redirected to the Concierge chat instead.
What is the root cause of that problem?
The issue occurs due to a timing problem with route parameter passing in the navigation flow. The navigation flow is: navigateAfterOnboarding → TEST_DRIVE_MODAL_ROOT → AdminTestDriveModal → TEST_DRIVE_DEMO_ROOT → TestDriveDemo.
The root cause is that AdminTestDriveModal was not passing the adminsChatReportID parameter to TestDriveDemo, even though the modal was receiving it correctly from the initial navigation call. The TestDriveDemo component needs this parameter to navigate to the correct admin room after the test drive completes.
What changes do you think we should make in order to solve the problem?
1. Update src/ROUTES.ts
Why this change is needed: The current TEST_DRIVE_DEMO_ROOT is a simple string that cannot accept parameters. We need to convert it to an object with a getRoute method to support passing adminsChatReportID from the modal to the demo component.
// Replace line 2042
TEST_DRIVE_DEMO_ROOT: 'onboarding/test-drive/demo',// WithTEST_DRIVE_DEMO_ROOT: {route: 'onboarding/test-drive/demo',getRoute: (adminsChatReportID?: string)=>{constparams=newURLSearchParams();if(adminsChatReportID){params.set('adminsChatReportID',adminsChatReportID);}return`onboarding/test-drive/demo${params.toString() ? `?${params.toString()}` : ''}`asconst;},},2.Updatesrc/components/TestDrive/Modal/AdminTestDriveModal.tsxWhythischangeis needed: ThemodalreceivesadminsChatReportIDfromnavigateAfterOnboardingbutwasnotpassingittothedemocomponent.Thisbreakstheparameterchainneededforproperadminroomnavigation.// Add after existing importsimport{useRoute}from'@react-navigation/native';importtype{RouteProp}from'@react-navigation/native';// Add type definition after importstypeAdminTestDriveModalParams={adminsChatReportID?: string;bossEmail?: string;};// Inside function, add route readingconstroute=useRoute<RouteProp<{AdminTestDriveModal: AdminTestDriveModalParams},'AdminTestDriveModal'>>();// Replace the navigate functionconstnavigate=()=>{InteractionManager.runAfterInteractions(()=>{// Pass admin chat report ID from modal route params to demo route paramsconstadminsChatReportID=route.params?.adminsChatReportID;Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.getRoute(adminsChatReportID));});};3.Updatesrc/components/TestDrive/TestDriveDemo.tsxWhythischangeis needed: ThedemocomponentwasalreadysetuptoreadadminsChatReportIDfromrouteparams(frompreviousattempts),butnowitwillactuallyreceivetheparameterfromthemodal.Thisensuresthedemonavigatestothecorrectadminroomaftercompletion.// Add after existing importsimport{useRoute}from'@react-navigation/native';importtype{RouteProp}from'@react-navigation/native';// Add type definition after importstypeTestDriveRouteParams={adminsChatReportID?: string;bossEmail?: string;};// Inside function, add route readingconstroute=useRoute<RouteProp<{TestDrive: TestDriveRouteParams},'TestDrive'>>();// Replace Onyx-based adminsChatReportID reading// Get adminsChatReportID from route params (passed by navigation) instead of OnyxconstonboardingAdminsChatReportID=route.params?.adminsChatReportID;const[onboardingAdminsChatReport]=useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${onboardingAdminsChatReportID}`,{canBeMissing: true});4.Updatesrc/libs/navigateAfterOnboarding.tsWhythischangeis needed: Withoutthischange,userswouldbenavigateddirectlytotheadminroombeforeseeingthetestdrivemodal,skippingtheentiretestdriveexperience.Theconditionensuresthetestdrivemodalisshownfirstforthe"Manage team"flow.// Replace lines 33-36 with// For the "Manage team" onboarding flow, we want to show the test drive modal first// before navigating to admin room, so skip immediate navigation in that caseconstisManageTeamFlow=onboardingPolicyID&&onboardingAdminsChatReportID;if(onboardingAdminsChatReportID&&!shouldPreventOpenAdminRoom&&!isManageTeamFlow){reportID=onboardingAdminsChatReportID;}5.Updatesrc/pages/Search/EmptySearchView.tsxWhythischangeisneeded: Withtheroutestructurechange,weneedtoaccessthe.routepropertyinsteadof using theobjectdirectlytomaintainbackwardcompatibilityfordirectnavigationcalls.// Replace line 208Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);// WithNavigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.route);6.Updatesrc/pages/home/sidebar/FloatingActionButtonAndPopover.tsxWhythischange is needed: Sameasabove-theroutestructurechangerequiresusing.routepropertyfordirectnavigation.// Replace line 519Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);// WithNavigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.route);7.Updatesrc/libs/ReportUtils.tsWhythischange is needed: TheURLgenerationlogicneedstousethe.routepropertytogetthebaseroutestringforconstructingtestdriveURLs.// Replace lines 10090 and 10092testDriveURL=ROUTES.TEST_DRIVE_DEMO_ROOT;// With (both occurrences)testDriveURL=ROUTES.TEST_DRIVE_DEMO_ROOT.route;8.Updatesrc/libs/Navigation/linkingConfig/config.tsWhythischange is needed: Thenavigationconfigurationneedstheactualroutestring(.routeproperty)toproperlymapURLstoscreencomponents.// Replace line 99path: ROUTES.TEST_DRIVE_DEMO_ROOT,// Withpath: ROUTES.TEST_DRIVE_DEMO_ROOT.route,9.Updatetests/actions/TaskTest.tsWhythischange is needed: ThetestwasconstructingURLs using therouteconstant,soitneedstousethe.routepropertytogetthecorrectURLstring.// Replace line 195childReportName: Parser.replace(translateLocal('onboarding.testDrive.name',{testDriveURL: `${CONST.STAGING_NEW_EXPENSIFY_URL}/${ROUTES.TEST_DRIVE_DEMO_ROOT}`})),// WithchildReportName: Parser.replace(translateLocal('onboarding.testDrive.name',{testDriveURL:
`${CONST.STAGING_NEW_EXPENSIFY_URL}/${ROUTES.TEST_DRIVE_DEMO_ROOT.route}`})),
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
End-to-end onboarding flow test: Test the complete "Manage my team expenses" onboarding flow to ensure users are redirected to the admin room after completing
the test drive demo.
Route parameter passing test: Test that adminsChatReportID is correctly passed from AdminTestDriveModal to TestDriveDemo through route parameters.
Admin room navigation test: Test that TestDriveDemo correctly navigates to the admin room when adminsChatReportID is provided and falls back to the onboarding
report when it's not.
Modal navigation test: Test that the test drive modal appears at the correct time in the onboarding flow and doesn't cause premature navigation.
Route structure test: Test that all TEST_DRIVE_DEMO_ROOT references use the correct format (.route for direct navigation, .getRoute() for parameterized
navigation).
What alternative solutions did you explore? (Optional)
Alternative 1: Continue using Onyx state management to pass the admin chat report ID. This was rejected because it creates timing issues where the Onyx cleanup happens before the TestDriveDemo component can read the value.
Alternative 2: Pass the parameter through a global variable or context. This was rejected because it's less clean than using React Navigation's built-in parameter passing mechanism and could cause issues with concurrent navigation flows.
Alternative 3: Modify the navigation flow to skip the modal entirely. This was rejected because the modal serves an important UX purpose in the onboarding flow and removing it would impact the user experience.
Early Cleanup: InteractionManager.runAfterInteractions() in accounting flow clears the onboardingAdminsChatReportID from Onyx before test drive completes
Can you please link to that clean up logic and why it happens too early?
The root cause is that AdminTestDriveModal was not passing the adminsChatReportID parameter to TestDriveDemo
We don't have to pass adminsChatReportID as a parameter. TestDriveDemo uses useOnyx hook to get the onboarding data (including onboarding report id). We should investigate why it's not present in our case.
The onboardingAdminsChatReportID stored in Onyx is being cleared before TestDriveDemo can read it. This happens because:
BaseOnboardingInterestedFeatures calls setOnboardingAdminsChatReportID() (clearing it) in line 211
This cleanup happens immediately via InteractionManager.runAfterInteractions()
By the time TestDriveDemo mounts and tries to read from Onyx, the value is already undefined
Alternative Solution:
Instead of passing parameters or delaying cleanup, here's a cleaner approach:
Option 1: Store the admin chat report ID in a separate Onyx key that persists through test drive
// Add a new Onyx key: ONBOARDING_TEST_DRIVE_ADMIN_CHAT_REPORT_ID
// Set it when navigating to test drive, clear it only after test drive completes
Option 2: Fix the timing issue directly
Move the cleanup logic from InteractionManager.runAfterInteractions() to happen only after the test drive modal is dismissed
Add a check in the cleanup to see if test drive is active before clearing
Which approach would you prefer? I believe Option 2 is the cleanest as it maintains the existing data flow while fixing the timing issue.
Thanks for looking into that. I think we should try remove that clean up logic. I'm not too sure if it's needed. It was added in this PR #49161 but I don't recall why it was required. I have ased here #49161 (comment), #41593 (comment) and #41990 (comment)
Can you please check as well if removing that clean up won't cause any regression including:
No duplicated workspace will be created. Only one should be created even if you refresh the page and/or restart the onboarding flow
@s77rt Not sure if it's a bug or not because the account is a test account. The onboarding task is added to the concierge task then we should see the concierge report instead of admin room after going back from test driver. If you test with the account without +, you can see the admin room in the background.
@nkdengineer is right @s77rt. Regular accounts are navigated to admins page start test drive
After deeper investigation I found that test accounts are navigated to concierge on accident, when it is preparing navigation also for other onboarding options.
Activity
melvin-bot commentedon Jul 1, 2025
Triggered auto assignment to @twisterdotcom (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon Jul 1, 2025
Triggered auto assignment to @mollfpr (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.github-actions commentedon Jul 1, 2025
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
melvin-bot commentedon Jul 1, 2025
💬 A slack conversation has been started in #expensify-open-source
mollfpr commentedon Jul 1, 2025
@jponikarchuk What are these cookies for?
mollfpr commentedon Jul 1, 2025
I don't think this is a bug that the customer will face. I'm going demote this from the blockers.
29 remaining items
barrettj12 commentedon Jul 20, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user registers as a team admin, once they enter and exit the test drive, the #admins room should be shown. Instead, the Concierge chat is shown.
What is the root cause of that problem?
The
closeModalfunction in the test drive is not programmed to handle the expected behaviour:App/src/components/TestDrive/TestDriveDemo.tsx
Lines 42 to 51 in 691e120
What changes do you think we should make in order to solve the problem?
We should add a check in
closeModalthat if the preconditions are met (user is a workspace admin), then we should explicitly redirect/navigate to the admins page.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
A new test case should be added to verify that when a user registers as a team admin and enters and exits the test drive, they are correctly redirected to the #admins room and not the Concierge chat.
We should also add a test case to ensure there is no regression in behaviour for non-admins, i.e. if a user is not a workspace admin, then they should not be redirected to #admins but instead to the Concierge chat.
s77rt commentedon Jul 21, 2025
@barrettj12 Thanks for the proposal. The RCA is not correct. The
closeModalfunction already handles navigation to the admin room (as you can see there is aisAdminRoomcondition).melvin-bot commentedon Jul 21, 2025
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
TaduJR commentedon Jul 21, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-07-22 04:02:51 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Users completing the "Manage my team expenses" onboarding flow should be redirected to the #admins room after clicking "Get started" in the test drive demo. However, they are being redirected to the Concierge chat instead.
What is the root cause of that problem?
The issue occurs due to a timing problem with route parameter passing in the navigation flow. The navigation flow is:
navigateAfterOnboarding→TEST_DRIVE_MODAL_ROOT→AdminTestDriveModal→TEST_DRIVE_DEMO_ROOT→TestDriveDemo.The root cause is that
AdminTestDriveModalwas not passing theadminsChatReportIDparameter toTestDriveDemo, even though the modal was receiving it correctly from the initial navigation call. TheTestDriveDemocomponent needs this parameter to navigate to the correct admin room after the test drive completes.What changes do you think we should make in order to solve the problem?
1. Update src/ROUTES.ts
Why this change is needed: The current
TEST_DRIVE_DEMO_ROOTis a simple string that cannot accept parameters. We need to convert it to an object with agetRoutemethod to support passingadminsChatReportIDfrom the modal to the demo component.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
the test drive demo.
report when it's not.
navigation).
What alternative solutions did you explore? (Optional)
Alternative 1: Continue using Onyx state management to pass the admin chat report ID. This was rejected because it creates timing issues where the Onyx cleanup happens before the TestDriveDemo component can read the value.
Alternative 2: Pass the parameter through a global variable or context. This was rejected because it's less clean than using React Navigation's built-in parameter passing mechanism and could cause issues with concurrent navigation flows.
Alternative 3: Modify the navigation flow to skip the modal entirely. This was rejected because the modal serves an important UX purpose in the onboarding flow and removing it would impact the user experience.
Result:
New.Expensify.-.Brave.2025-07-22.07-07-48.mp4
s77rt commentedon Jul 21, 2025
@TaduJR Thanks for the proposal.
Can you please link to that clean up logic and why it happens too early?
TaduJR commentedon Jul 22, 2025
Hello @s77rt
I updated the Proposal. Please check it out.
Also this issue is existing also for the customer unlike the discussion above.
Before Setting the Cookies:
New.Expensify.-.Brave.2025-07-21.17-07-20.mp4
After Setting the Cookies:
New.Expensify.-.Brave.2025-07-21.17-09-23.mp4
s77rt commentedon Jul 22, 2025
@TaduJR
We don't have to pass
adminsChatReportIDas a parameter.TestDriveDemousesuseOnyxhook to get the onboarding data (including onboarding report id). We should investigate why it's not present in our case.TaduJR commentedon Jul 23, 2025
Thank you for your feedback @s77rt .
The Issue:
The onboardingAdminsChatReportID stored in Onyx is being cleared before TestDriveDemo can read it. This happens because:
Alternative Solution:
Instead of passing parameters or delaying cleanup, here's a cleaner approach:
Option 1: Store the admin chat report ID in a separate Onyx key that persists through test drive
// Add a new Onyx key: ONBOARDING_TEST_DRIVE_ADMIN_CHAT_REPORT_ID
// Set it when navigating to test drive, clear it only after test drive completes
Option 2: Fix the timing issue directly
Which approach would you prefer? I believe Option 2 is the cleanest as it maintains the existing data flow while fixing the timing issue.
s77rt commentedon Jul 23, 2025
Thanks for looking into that. I think we should try remove that clean up logic. I'm not too sure if it's needed. It was added in this PR #49161 but I don't recall why it was required. I have ased here #49161 (comment), #41593 (comment) and #41990 (comment)
Can you please check as well if removing that clean up won't cause any regression including:
nkdengineer commentedon Jul 23, 2025
@s77rt Not sure if it's a bug or not because the account is a test account. The onboarding task is added to the concierge task then we should see the concierge report instead of admin room after going back from test driver. If you test with the account without
+, you can see the admin room in the background.s77rt commentedon Jul 23, 2025
@jponikarchuk Would you please retest with an new account that does not have a plus sign (
+) in its email?TaduJR commentedon Jul 23, 2025
@nkdengineer is right @s77rt. Regular accounts are navigated to admins page start test drive
After deeper investigation I found that test accounts are navigated to concierge on accident, when it is preparing navigation also for other onboarding options.
Also check this out
https://github.com/TaduJR/App/blob/474cc0a228cecdf9da6897a0d98496d2b38cf378/tests/unit/navigateAfterOnboardingTest.ts#L117-L126
jponikarchuk commentedon Jul 23, 2025
@s77rt Not repro with an account without +
Recording.375.mp4
s77rt commentedon Jul 23, 2025
Thanks for checking!
We can close this one cc @mollfpr @dylanexpensify