From 23558c5eaa50ff88a31c28a1614bf969ff7b252e Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:32:18 +0100 Subject: [PATCH 1/9] Update Global Create and Workspace chat tooltips --- src/components/ProductTrainingContext/TOOLTIPS.ts | 9 ++++----- src/languages/en.ts | 8 ++++---- src/languages/es.ts | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index 0256c7f679884..3fe4c8dbde6cc 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -60,7 +60,7 @@ const TOOLTIPS: Record = { ], onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(GLOBAL_CREATE_TOOLTIP, isDismissedUsingCloseButton), name: GLOBAL_CREATE_TOOLTIP, - priority: 1200, + priority: 1950, shouldShow: () => true, }, [BOTTOM_NAV_INBOX_TOOLTIP]: { @@ -76,13 +76,12 @@ const TOOLTIPS: Record = { }, [LHN_WORKSPACE_CHAT_TOOLTIP]: { content: [ - {text: 'productTrainingTooltip.workspaceChatTooltip.part1', isBold: true}, - {text: 'productTrainingTooltip.workspaceChatTooltip.part2', isBold: false}, - {text: 'productTrainingTooltip.workspaceChatTooltip.part3', isBold: false}, + {text: 'productTrainingTooltip.workspaceChatTooltip.part1', isBold: false}, + {text: 'productTrainingTooltip.workspaceChatTooltip.part2', isBold: true}, ], onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(LHN_WORKSPACE_CHAT_TOOLTIP, isDismissedUsingCloseButton), name: LHN_WORKSPACE_CHAT_TOOLTIP, - priority: 800, + priority: 1800, shouldShow: () => true, }, [SCAN_TEST_TOOLTIP]: { diff --git a/src/languages/en.ts b/src/languages/en.ts index 02c53f7db7d74..e6ac6f072c949 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -6035,14 +6035,14 @@ const translations = { part3: ' 🔴 = needs review', }, workspaceChatTooltip: { - part1: 'Submit expenses', - part2: ' and chat with', - part3: '\napprovers here!', + part1: 'Chat with ', + part2: 'approvers', }, globalCreateTooltip: { part1: 'Create expenses', part2: ', start chatting,', - part3: '\nand more!', + part3: '\nand more.', + part4: ' Try it out!', }, scanTestTooltip: { part1: 'Want to see how Scan works?', diff --git a/src/languages/es.ts b/src/languages/es.ts index 655be267b9670..046509783295a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6556,14 +6556,14 @@ const translations = { part3: ' 🔴 = necesita revisión', }, workspaceChatTooltip: { - part1: 'Envía gastos', - part2: ' y chatea con', - part3: '\naprobadores aquí!', + part1: 'Chatea con ', + part2: 'aprobadores', }, globalCreateTooltip: { part1: 'Crea gastos', part2: ', comienza a chatear,', part3: '\ny mucho más!', + part4: ' ¡Pruébalo!', }, scanTestTooltip: { part1: '¿Quieres ver cómo funciona Escanear?', From 519706a544f97dff658a1098cac8e88bd71c3118 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:28:43 +0100 Subject: [PATCH 2/9] Add user policy employee check to tooltips visibility logic --- src/components/ProductTrainingContext/TOOLTIPS.ts | 7 ++++--- src/components/ProductTrainingContext/index.tsx | 14 +++++++++++++- src/libs/PolicyUtils.ts | 7 +++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index 27b5641a115d2..d3a367e1dc4a1 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -17,7 +17,8 @@ const { type ProductTrainingTooltipName = ValueOf; type ShouldShowConditionProps = { - shouldUseNarrowLayout?: boolean; + shouldUseNarrowLayout: boolean; + isUserPolicyEmployee: boolean; }; type TooltipData = { @@ -61,7 +62,7 @@ const TOOLTIPS: Record = { onHideTooltip: () => dismissProductTraining(GLOBAL_CREATE_TOOLTIP), name: GLOBAL_CREATE_TOOLTIP, priority: 1950, - shouldShow: () => true, + shouldShow: ({isUserPolicyEmployee}) => isUserPolicyEmployee, }, [BOTTOM_NAV_INBOX_TOOLTIP]: { content: [ @@ -82,7 +83,7 @@ const TOOLTIPS: Record = { onHideTooltip: () => dismissProductTraining(LHN_WORKSPACE_CHAT_TOOLTIP), name: LHN_WORKSPACE_CHAT_TOOLTIP, priority: 1800, - shouldShow: () => true, + shouldShow: ({isUserPolicyEmployee}) => isUserPolicyEmployee, }, [SCAN_TEST_TOOLTIP]: { content: [ diff --git a/src/components/ProductTrainingContext/index.tsx b/src/components/ProductTrainingContext/index.tsx index c877e1d45fbce..20bb90652b1e1 100644 --- a/src/components/ProductTrainingContext/index.tsx +++ b/src/components/ProductTrainingContext/index.tsx @@ -12,6 +12,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {parseFSAttributes} from '@libs/Fullstory'; import {hasCompletedGuidedSetupFlowSelector} from '@libs/onboardingSelectors'; +import {getActiveEmployeeWorkspaces} from '@libs/PolicyUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; @@ -51,6 +52,16 @@ function ProductTrainingContextProvider({children}: ChildrenProps) { selector: hasCompletedGuidedSetupFlowSelector, }); + const [allPolicies, allPoliciesMetadata] = useOnyx(ONYXKEYS.COLLECTION.POLICY); + const [currentUserLogin, currentUserLoginMetadata] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email}); + + const isUserPolicyEmployee = useMemo(() => { + if (!allPolicies || !currentUserLogin || isLoadingOnyxValue(allPoliciesMetadata, currentUserLoginMetadata)) { + return false; + } + return getActiveEmployeeWorkspaces(allPolicies, currentUserLogin).length > 0; + }, [allPolicies, currentUserLogin, allPoliciesMetadata, currentUserLoginMetadata]); + const [dismissedProductTraining] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING); const {shouldUseNarrowLayout} = useResponsiveLayout(); @@ -125,9 +136,10 @@ function ProductTrainingContextProvider({children}: ChildrenProps) { return tooltipConfig.shouldShow({ shouldUseNarrowLayout, + isUserPolicyEmployee, }); }, - [dismissedProductTraining, hasBeenAddedToNudgeMigration, isOnboardingCompleted, isOnboardingCompletedMetadata, shouldUseNarrowLayout, isModalVisible, isLoadingApp], + [dismissedProductTraining, hasBeenAddedToNudgeMigration, isOnboardingCompleted, isOnboardingCompletedMetadata, shouldUseNarrowLayout, isModalVisible, isLoadingApp, isUserPolicyEmployee], ); const registerTooltip = useCallback( diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 942dc2f35f57d..0a8b330988b6e 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -711,6 +711,12 @@ function getActiveAdminWorkspaces(policies: OnyxCollection | null, curre return activePolicies.filter((policy) => shouldShowPolicy(policy, isOfflineNetworkStore(), currentUserLogin) && isPolicyAdmin(policy, currentUserLogin)); } +/** Return active policies where current user is an employee (of the role "user") */ +function getActiveEmployeeWorkspaces(policies: OnyxCollection | null, currentUserLogin: string | undefined): Policy[] { + const activePolicies = getActivePolicies(policies, currentUserLogin); + return activePolicies.filter((policy) => shouldShowPolicy(policy, isOfflineNetworkStore(), currentUserLogin) && isPolicyUser(policy, currentUserLogin)); +} + /** * * Checks whether the current user has a policy with Xero accounting software integration @@ -1543,6 +1549,7 @@ export { isPrefferedExporter, isAutoSyncEnabled, areAllGroupPoliciesExpenseChatDisabled, + getActiveEmployeeWorkspaces, }; export type {MemberEmailsToAccountIDs}; From 447377c75b0905319e99661166aeed9766b4389f Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:35:15 +0100 Subject: [PATCH 3/9] Add fourth part to global create tooltip text --- src/components/ProductTrainingContext/TOOLTIPS.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index d3a367e1dc4a1..d35c0d8a095bd 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -58,6 +58,7 @@ const TOOLTIPS: Record = { {text: 'productTrainingTooltip.globalCreateTooltip.part1', isBold: true}, {text: 'productTrainingTooltip.globalCreateTooltip.part2', isBold: false}, {text: 'productTrainingTooltip.globalCreateTooltip.part3', isBold: false}, + {text: 'productTrainingTooltip.globalCreateTooltip.part4', isBold: false}, ], onHideTooltip: () => dismissProductTraining(GLOBAL_CREATE_TOOLTIP), name: GLOBAL_CREATE_TOOLTIP, From f1655f7d1a84a0c90b923d07bbe75dde6758ccd9 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:35:22 +0100 Subject: [PATCH 4/9] prettier --- src/components/ProductTrainingContext/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/ProductTrainingContext/index.tsx b/src/components/ProductTrainingContext/index.tsx index 20bb90652b1e1..e07ffbdf773f8 100644 --- a/src/components/ProductTrainingContext/index.tsx +++ b/src/components/ProductTrainingContext/index.tsx @@ -139,7 +139,16 @@ function ProductTrainingContextProvider({children}: ChildrenProps) { isUserPolicyEmployee, }); }, - [dismissedProductTraining, hasBeenAddedToNudgeMigration, isOnboardingCompleted, isOnboardingCompletedMetadata, shouldUseNarrowLayout, isModalVisible, isLoadingApp, isUserPolicyEmployee], + [ + dismissedProductTraining, + hasBeenAddedToNudgeMigration, + isOnboardingCompleted, + isOnboardingCompletedMetadata, + shouldUseNarrowLayout, + isModalVisible, + isLoadingApp, + isUserPolicyEmployee, + ], ); const registerTooltip = useCallback( From 534869966dedf4cd45cd86d638a33ce5daf67b2b Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:41:25 +0100 Subject: [PATCH 5/9] fix tests --- .../ProductTrainingContextProvider.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 66595066bc080..c507c6d37d896 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -92,7 +92,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.IS_LOADING_APP, true); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should not show @@ -104,7 +104,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: false}); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should not show @@ -116,7 +116,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should show @@ -124,7 +124,7 @@ describe('ProductTrainingContextProvider', () => { }); it('should keep tooltip visible when another tooltip with shouldShow=false is unmounted', async () => { - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const ref = createRef(); // When multiple tooltips with the same name but different shouldShow values are rendered @@ -177,7 +177,7 @@ describe('ProductTrainingContextProvider', () => { await waitForBatchedUpdatesWithAct(); // Then tooltips should not show - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Expect tooltip to be hidden @@ -194,7 +194,7 @@ describe('ProductTrainingContextProvider', () => { }); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should show @@ -207,7 +207,7 @@ describe('ProductTrainingContextProvider', () => { // When a tooltip has been dismissed const date = new Date(); Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: DateUtils.getDBTime(date.valueOf()), [testTooltip]: DateUtils.getDBTime(date.valueOf()), @@ -228,7 +228,7 @@ describe('ProductTrainingContextProvider', () => { migratedUserWelcomeModal: DateUtils.getDBTime(date.valueOf()), }); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result, rerender} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // When the user dismiss the tooltip result.current.hideProductTrainingTooltip(); @@ -305,8 +305,8 @@ describe('ProductTrainingContextProvider', () => { await waitForBatchedUpdatesWithAct(); // Then only highest priority tooltip should show - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook( () => ({ @@ -325,8 +325,8 @@ describe('ProductTrainingContextProvider', () => { // When higher priority tooltip is dismissed Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); const date = new Date(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: DateUtils.getDBTime(date.valueOf()), @@ -357,8 +357,8 @@ describe('ProductTrainingContextProvider', () => { }); await waitForBatchedUpdatesWithAct(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GLOBAL_CREATE_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; const {result} = renderHook( () => ({ From ba5f7df8be705898dba8140066539fb6dd8adcd2 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:07:21 +0100 Subject: [PATCH 6/9] update translations --- src/languages/es.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 8a24dd6d0c374..cf850d381f23b 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6736,12 +6736,12 @@ const translations = { }, workspaceChatTooltip: { part1: 'Chatea con ', - part2: 'aprobadores', + part2: 'los aprobadores', }, globalCreateTooltip: { part1: 'Crea gastos', - part2: ', comienza a chatear,', - part3: '\ny mucho más!', + part2: ', empieza a chatear', + part3: '\ny más.', part4: ' ¡Pruébalo!', }, scanTestTooltip: { From afd73206d2dec4e25583b310458e4720014aa323 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 28 Apr 2025 11:33:42 +0100 Subject: [PATCH 7/9] fix test --- tests/ui/components/ProductTrainingContextProvider.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 4f743c79d778a..542b3fcabc760 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -93,7 +93,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.IS_LOADING_APP, true); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should not show @@ -105,7 +105,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: false}); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should not show @@ -117,7 +117,7 @@ describe('ProductTrainingContextProvider', () => { Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // Then tooltip should show @@ -125,7 +125,7 @@ describe('ProductTrainingContextProvider', () => { }); it('should keep tooltip visible when another tooltip with shouldShow=false is unmounted', async () => { - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const ref = createRef(); // When multiple tooltips with the same name but different shouldShow values are rendered @@ -345,6 +345,7 @@ describe('ProductTrainingContextProvider', () => { it('should transition to next priority tooltip when current is dismissed', async () => { // When starting with all tooltips visible Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); + Onyx.merge(ONYXKEYS.NVP_TRYNEWDOT, {nudgeMigration: {timestamp: new Date()}}); const date = new Date(); Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: { From d4e1294b2be537bfb759132e5e2848cd314234f4 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 28 Apr 2025 11:40:13 +0100 Subject: [PATCH 8/9] fix test --- .../ui/components/ProductTrainingContextProvider.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 542b3fcabc760..6f919056bd91a 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -295,8 +295,8 @@ describe('ProductTrainingContextProvider', () => { await waitForBatchedUpdatesWithAct(); // Then only highest priority tooltip should show - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; const {result} = renderHook( () => ({ @@ -315,8 +315,8 @@ describe('ProductTrainingContextProvider', () => { // When higher priority tooltip is dismissed Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); const date = new Date(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: { @@ -354,8 +354,8 @@ describe('ProductTrainingContextProvider', () => { }); await waitForBatchedUpdatesWithAct(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; const {result} = renderHook( () => ({ From 8c425842651a69d9294e37390810ef0b53d4fcec Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 28 Apr 2025 11:47:47 +0100 Subject: [PATCH 9/9] Fix test --- .../ProductTrainingContextProvider.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 6f919056bd91a..d283f93626120 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -210,7 +210,7 @@ describe('ProductTrainingContextProvider', () => { // When a tooltip has been dismissed const date = new Date(); Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: { timestamp: DateUtils.getDBTime(date.valueOf()), @@ -237,7 +237,7 @@ describe('ProductTrainingContextProvider', () => { }, }); await waitForBatchedUpdatesWithAct(); - const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; + const testTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result, rerender} = renderHook(() => useProductTrainingContext(testTooltip), {wrapper}); // When the user dismiss the tooltip result.current.hideProductTrainingTooltip(); @@ -295,8 +295,8 @@ describe('ProductTrainingContextProvider', () => { await waitForBatchedUpdatesWithAct(); // Then only highest priority tooltip should show - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result} = renderHook( () => ({ @@ -315,8 +315,8 @@ describe('ProductTrainingContextProvider', () => { // When higher priority tooltip is dismissed Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); const date = new Date(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: { @@ -345,7 +345,6 @@ describe('ProductTrainingContextProvider', () => { it('should transition to next priority tooltip when current is dismissed', async () => { // When starting with all tooltips visible Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {hasCompletedGuidedSetupFlow: true}); - Onyx.merge(ONYXKEYS.NVP_TRYNEWDOT, {nudgeMigration: {timestamp: new Date()}}); const date = new Date(); Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { migratedUserWelcomeModal: { @@ -354,8 +353,8 @@ describe('ProductTrainingContextProvider', () => { }); await waitForBatchedUpdatesWithAct(); - const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP; - const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.RENAME_SAVED_SEARCH; + const highPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER; + const lowPriorityTooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP; const {result} = renderHook( () => ({