Skip to content

[$250] [EX-43] - Onboarding - User should be redirected to #admins after taking a test drive #65274

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


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:

  1. Open an incognito window
  2. Navigate to ND stage
  3. Sign up with a gmail account
  4. In the onboarding modal - Open console > Application > Cookies
  5. Set the following cookies: lc-debug = 1, lc-qa = 2
  6. Refresh the page

Steps (after precondition is completed):

  1. Within 'What's your work email?' page, click "Skip"
  2. Click on "Manage my team expenses" > 1-10 employees > Other
  3. Check mark "Take a test drive", click 'Get started'
  4. Within the test drive, click 'Get started'

Expected Result:

The user should be redirected to #admins room.

Actual Result:

The user is redirected to concierge chat.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @s77rt
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021944692571985183814
  • Upwork Job ID: 1944692571985183814
  • Last Price Increase: 2025-07-21

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 1, 2025
  2. melvin-bot commented on Jul 1, 2025

    @melvin-bot

    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.

  3. melvin-bot commented on Jul 1, 2025

    @melvin-bot

    Triggered auto assignment to @mollfpr (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. github-actions commented on Jul 1, 2025

    @github-actions
    Contributor

    👋 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:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. melvin-bot commented on Jul 1, 2025

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. mollfpr commented on Jul 1, 2025

    @mollfpr
    Contributor

    Set the following cookies: lc-debug = 1, lc-qa = 2

    @jponikarchuk What are these cookies for?

  7. mollfpr commented on Jul 1, 2025

    @mollfpr
    Contributor

    I don't think this is a bug that the customer will face. I'm going demote this from the blockers.

  8. 29 remaining items

  9. barrettj12 commented on Jul 20, 2025

    @barrettj12

    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 closeModal function in the test drive is not programmed to handle the expected behaviour:

    const closeModal = useCallback(() => {
    setIsVisible(false);
    InteractionManager.runAfterInteractions(() => {
    Navigation.goBack();
    if (isAdminRoom(onboardingReport)) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(onboardingReport?.reportID));
    }
    });
    }, [onboardingReport]);

    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.

  10. s77rt commented on Jul 21, 2025

    @s77rt
    Member

    @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).

  11. melvin-bot commented on Jul 21, 2025

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  12. TaduJR commented on Jul 21, 2025

    @TaduJR
    Contributor

    🚨 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',
    
    // With
    TEST_DRIVE_DEMO_ROOT: {
        route: 'onboarding/test-drive/demo',
        getRoute: (adminsChatReportID?: string) => {
            const params = new URLSearchParams();
            if (adminsChatReportID) {
                params.set('adminsChatReportID', adminsChatReportID);
            }
            return `onboarding/test-drive/demo${params.toString() ? `?${params.toString()}` : ''}` as const;
        },
    },
    
    2. Update src/components/TestDrive/Modal/AdminTestDriveModal.tsx
    
    Why this change is needed: The modal receives adminsChatReportID from navigateAfterOnboarding but was not passing it to the demo component. This breaks the
    parameter chain needed for proper admin room navigation.
    
    // Add after existing imports
    import {useRoute} from '@react-navigation/native';
    import type {RouteProp} from '@react-navigation/native';
    
    // Add type definition after imports
    type AdminTestDriveModalParams = {
        adminsChatReportID?: string;
        bossEmail?: string;
    };
    
    // Inside function, add route reading
    const route = useRoute<RouteProp<{AdminTestDriveModal: AdminTestDriveModalParams}, 'AdminTestDriveModal'>>();
    
    // Replace the navigate function
    const navigate = () => {
        InteractionManager.runAfterInteractions(() => {
            // Pass admin chat report ID from modal route params to demo route params
            const adminsChatReportID = route.params?.adminsChatReportID;
            Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.getRoute(adminsChatReportID));
        });
    };
    
    3. Update src/components/TestDrive/TestDriveDemo.tsx
    
    Why this change is needed: The demo component was already set up to read adminsChatReportID from route params (from previous attempts), but now it will actually
    receive the parameter from the modal. This ensures the demo navigates to the correct admin room after completion.
    
    // Add after existing imports
    import {useRoute} from '@react-navigation/native';
    import type {RouteProp} from '@react-navigation/native';
    
    // Add type definition after imports
    type TestDriveRouteParams = {
        adminsChatReportID?: string;
        bossEmail?: string;
    };
    
    // Inside function, add route reading
    const route = useRoute<RouteProp<{TestDrive: TestDriveRouteParams}, 'TestDrive'>>();
    
    // Replace Onyx-based adminsChatReportID reading
    // Get adminsChatReportID from route params (passed by navigation) instead of Onyx
    const onboardingAdminsChatReportID = route.params?.adminsChatReportID;
    const [onboardingAdminsChatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${onboardingAdminsChatReportID}`, {canBeMissing: true});
    
    4. Update src/libs/navigateAfterOnboarding.ts
    
    Why this change is needed: Without this change, users would be navigated directly to the admin room before seeing the test drive modal, skipping the entire test
    drive experience. The condition ensures the test drive modal is shown first for the "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 case
    const isManageTeamFlow = onboardingPolicyID && onboardingAdminsChatReportID;
    if (onboardingAdminsChatReportID && !shouldPreventOpenAdminRoom && !isManageTeamFlow) {
        reportID = onboardingAdminsChatReportID;
    }
    
    5. Update src/pages/Search/EmptySearchView.tsx
    
    Why this change is needed: With the route structure change, we need to access the .route property instead of using the object directly to maintain backward
    compatibility for direct navigation calls.
    
    // Replace line 208
    Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
    
    // With
    Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.route);
    
    6. Update src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
    
    Why this change is needed: Same as above - the route structure change requires using .route property for direct navigation.
    
    // Replace line 519
    Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT);
    
    // With
    Navigation.navigate(ROUTES.TEST_DRIVE_DEMO_ROOT.route);
    
    7. Update src/libs/ReportUtils.ts
    
    Why this change is needed: The URL generation logic needs to use the .route property to get the base route string for constructing test drive URLs.
    
    // Replace lines 10090 and 10092
    testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT;
    
    // With (both occurrences)
    testDriveURL = ROUTES.TEST_DRIVE_DEMO_ROOT.route;
    
    8. Update src/libs/Navigation/linkingConfig/config.ts
    
    Why this change is needed: The navigation configuration needs the actual route string (.route property) to properly map URLs to screen components.
    
    // Replace line 99
    path: ROUTES.TEST_DRIVE_DEMO_ROOT,
    
    // With
    path: ROUTES.TEST_DRIVE_DEMO_ROOT.route,
    
    9. Update tests/actions/TaskTest.ts
    
    Why this change is needed: The test was constructing URLs using the route constant, so it needs to use the .route property to get the correct URL string.
    
    // Replace line 195
    childReportName: Parser.replace(translateLocal('onboarding.testDrive.name', {testDriveURL: `${CONST.STAGING_NEW_EXPENSIFY_URL}/${ROUTES.TEST_DRIVE_DEMO_ROOT}`})),
    
    // With
    childReportName: 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?

    1. 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.
    2. Route parameter passing test: Test that adminsChatReportID is correctly passed from AdminTestDriveModal to TestDriveDemo through route parameters.
    3. 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.
    4. Modal navigation test: Test that the test drive modal appears at the correct time in the onboarding flow and doesn't cause premature navigation.
    5. 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.

    Result:

    New.Expensify.-.Brave.2025-07-22.07-07-48.mp4
  13. s77rt commented on Jul 21, 2025

    @s77rt
    Member

    @TaduJR Thanks for the proposal.

    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?

  14. TaduJR commented on Jul 22, 2025

    @TaduJR
    Contributor

    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
  15. s77rt commented on Jul 22, 2025

    @s77rt
    Member

    @TaduJR

    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.

  16. TaduJR commented on Jul 23, 2025

    @TaduJR
    Contributor

    Thank you for your feedback @s77rt .

    The Issue:

    The onboardingAdminsChatReportID stored in Onyx is being cleared before TestDriveDemo can read it. This happens because:

    1. BaseOnboardingInterestedFeatures calls setOnboardingAdminsChatReportID() (clearing it) in line 211
    2. This cleanup happens immediately via InteractionManager.runAfterInteractions()
    3. 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

    1. Move the cleanup logic from InteractionManager.runAfterInteractions() to happen only after the test drive modal is dismissed
    2. 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.

  17. s77rt commented on Jul 23, 2025

    @s77rt
    Member

    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
  18. nkdengineer commented on Jul 23, 2025

    @nkdengineer
    Contributor

    @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.

  19. s77rt commented on Jul 23, 2025

    @s77rt
    Member

    @jponikarchuk Would you please retest with an new account that does not have a plus sign (+) in its email?

  20. TaduJR commented on Jul 23, 2025

    @TaduJR
    Contributor

    @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

  21. jponikarchuk commented on Jul 23, 2025

    @jponikarchuk
    Author

    @s77rt Not repro with an account without +

    Recording.375.mp4
  22. s77rt commented on Jul 23, 2025

    @s77rt
    Member

    Thanks for checking!

    We can close this one cc @mollfpr @dylanexpensify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions