Skip to content

Commit 4e1fa19

Browse files
committed
ref: Remove testableTransition utility
Animations are now disabled globally in tests via framer-motion's MotionGlobalConfig, making the per-transition testableTransition wrapper unnecessary.
1 parent ce960bb commit 4e1fa19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+114
-219
lines changed

static/app/bootstrap/commonInitialization.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import {NODE_ENV, UI_DEV_ENABLE_PROFILING} from 'sentry/constants';
1+
import {MotionGlobalConfig} from 'framer-motion';
2+
3+
import {IS_ACCEPTANCE_TEST, NODE_ENV, UI_DEV_ENABLE_PROFILING} from 'sentry/constants';
24
import {ConfigStore} from 'sentry/stores/configStore';
35
import type {Config} from 'sentry/types/system';
46

7+
if (IS_ACCEPTANCE_TEST || NODE_ENV === 'test') {
8+
MotionGlobalConfig.skipAnimations = true;
9+
}
10+
511
export function commonInitialization(config: Config) {
612
if (NODE_ENV === 'development') {
713
import(/* webpackMode: "eager" */ 'sentry/utils/silence-react-unsafe-warnings');

static/app/components/checkInTimeline/timelineCursor.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {AnimatePresence, motion} from 'framer-motion';
44

55
import {Overlay} from 'sentry/components/overlay';
66
import {Sticky} from 'sentry/components/sticky';
7-
import {testableTransition} from 'sentry/utils/testableTransition';
87

98
const TOOLTIP_OFFSET = 10;
109

@@ -142,7 +141,7 @@ function useTimelineCursor<E extends HTMLElement>({
142141
initial="initial"
143142
animate="animate"
144143
exit="exit"
145-
transition={testableTransition({duration: 0.1})}
144+
transition={{duration: 0.1}}
146145
variants={{
147146
initial: {opacity: 0},
148147
animate: {opacity: 1},

static/app/components/checkInTimeline/timelineZoom.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import {useCallback, useEffect, useRef, useState} from 'react';
22
import styled from '@emotion/styled';
33
import {AnimatePresence, motion} from 'framer-motion';
44

5-
import {testableTransition} from 'sentry/utils/testableTransition';
6-
75
/**
86
* The minimum number in pixels which the selection should be considered valid
97
* and will fire the onSelect handler.
@@ -157,7 +155,7 @@ function useTimelineZoom<E extends HTMLElement>({enabled = true, onSelect}: Opti
157155
initial="initial"
158156
animate="animate"
159157
exit="exit"
160-
transition={testableTransition({duration: 0.2})}
158+
transition={{duration: 0.2}}
161159
variants={{
162160
initial: {opacity: 0},
163161
animate: {opacity: 1},

static/app/components/core/loader/indeterminateLoader.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {AnimatePresence, motion} from 'framer-motion';
77

88
import {Stack} from '@sentry/scraps/layout';
99

10-
import {testableTransition} from 'sentry/utils/testableTransition';
11-
1210
// required to break import cycle
1311
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
1412
import {Text} from '../text/text';
@@ -131,7 +129,7 @@ export function IndeterminateLoader({
131129
initial={{opacity: 0}}
132130
animate={{opacity: 1}}
133131
exit={{opacity: 0}}
134-
transition={testableTransition({duration: 0.3})}
132+
transition={{duration: 0.3}}
135133
>
136134
<Text monospace variant="muted" size="lg">
137135
{currentMessage}

static/app/components/core/toast/toast.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {LoadingIndicator} from 'sentry/components/loadingIndicator';
1111
import {TextOverflow} from 'sentry/components/textOverflow';
1212
import {IconCheckmark, IconRefresh, IconWarning} from 'sentry/icons';
1313
import {t} from 'sentry/locale';
14-
import {testableTransition} from 'sentry/utils/testableTransition';
1514
import type {Theme} from 'sentry/utils/theme';
1615

1716
interface ToastProps {
@@ -55,11 +54,11 @@ const TOAST_TRANSITION = {
5554
initial: {opacity: 0, y: 70},
5655
animate: {opacity: 1, y: 0},
5756
exit: {opacity: 0, y: 70},
58-
transition: testableTransition({
57+
transition: {
5958
type: 'spring',
6059
stiffness: 450,
6160
damping: 25,
62-
}),
61+
},
6362
};
6463

6564
function ToastIcon({type}: {type: Indicator['type']}) {

static/app/components/events/autofix/autofixChanges.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {t} from 'sentry/locale';
3333
import {singleLineRenderer} from 'sentry/utils/marked/marked';
3434
import {MarkedText} from 'sentry/utils/marked/markedText';
3535
import {useMutation, useQueryClient} from 'sentry/utils/queryClient';
36-
import {testableTransition} from 'sentry/utils/testableTransition';
3736
import {useApi} from 'sentry/utils/useApi';
3837
import {useCopyToClipboard} from 'sentry/utils/useCopyToClipboard';
3938
import {useOrganization} from 'sentry/utils/useOrganization';
@@ -109,7 +108,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
109108
exit: {opacity: 0, height: 0, scale: 0.8, y: -20},
110109
initial: {opacity: 0, height: 0, scale: 0.8},
111110
animate: {opacity: 1, height: 'auto', scale: 1},
112-
transition: testableTransition({
111+
transition: {
113112
duration: 1.0,
114113
height: {
115114
type: 'spring',
@@ -123,7 +122,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
123122
type: 'tween',
124123
ease: 'easeOut',
125124
},
126-
}),
125+
},
127126
};
128127

129128
function BranchButton({change}: {change: AutofixCodebaseChange}) {

static/app/components/events/autofix/autofixHighlightPopup.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {IconClose, IconSeer} from 'sentry/icons';
2929
import {t} from 'sentry/locale';
3030
import {trackAnalytics} from 'sentry/utils/analytics';
3131
import {MarkedText} from 'sentry/utils/marked/markedText';
32-
import {testableTransition} from 'sentry/utils/testableTransition';
3332
import {useApi} from 'sentry/utils/useApi';
3433
import {useMedia} from 'sentry/utils/useMedia';
3534
import {useOrganization} from 'sentry/utils/useOrganization';
@@ -646,9 +645,9 @@ export function AutofixHighlightPopup(props: Props) {
646645
initial={{opacity: 0, x: 10}}
647646
animate={{opacity: 1, x: 0}}
648647
exit={{opacity: 0, x: 10}}
649-
transition={testableTransition({
648+
transition={{
650649
duration: 0.2,
651-
})}
650+
}}
652651
style={{
653652
left: `${position.left}px`,
654653
top: `${position.top}px`,

static/app/components/events/autofix/autofixOutputStream.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {IconRefresh, IconSeer} from 'sentry/icons';
2020
import {t} from 'sentry/locale';
2121
import {singleLineRenderer} from 'sentry/utils/marked/marked';
2222
import {useMutation, useQueryClient} from 'sentry/utils/queryClient';
23-
import {testableTransition} from 'sentry/utils/testableTransition';
2423
import {useApi} from 'sentry/utils/useApi';
2524
import {useOrganization} from 'sentry/utils/useOrganization';
2625

@@ -269,25 +268,25 @@ export function AutofixOutputStream({
269268
initial={{opacity: 0, height: 0}}
270269
animate={{opacity: 1, height: 'auto'}}
271270
exit={{opacity: 0, height: 0}}
272-
transition={testableTransition({
271+
transition={{
273272
duration: 0.2,
274273
height: {
275274
type: 'spring',
276275
bounce: 0.2,
277276
},
278-
})}
277+
}}
279278
>
280279
<ScaleContainer
281280
initial={{scaleY: 0.8}}
282281
animate={{scaleY: 1}}
283282
exit={{scaleY: 0.8}}
284-
transition={testableTransition({
283+
transition={{
285284
duration: 0.2,
286285
scaleY: {
287286
type: 'spring',
288287
bounce: 0.2,
289288
},
290-
})}
289+
}}
291290
>
292291
<VerticalLine />
293292
<Container required={responseRequired}>

static/app/components/events/autofix/autofixRootCause.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import type {Event} from 'sentry/types/event';
3333
import {trackAnalytics} from 'sentry/utils/analytics';
3434
import {singleLineRenderer} from 'sentry/utils/marked/marked';
3535
import {useMutation, useQuery, useQueryClient} from 'sentry/utils/queryClient';
36-
import {testableTransition} from 'sentry/utils/testableTransition';
3736
import {useApi} from 'sentry/utils/useApi';
3837
import {useCopyToClipboard} from 'sentry/utils/useCopyToClipboard';
3938
import {useLocalStorageState} from 'sentry/utils/useLocalStorageState';
@@ -99,7 +98,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
9998
exit: {opacity: 0, height: 0, scale: 0.8, y: -20},
10099
initial: {opacity: 0, height: 0, scale: 0.8},
101100
animate: {opacity: 1, height: 'auto', scale: 1},
102-
transition: testableTransition({
101+
transition: {
103102
duration: 1.0,
104103
height: {
105104
type: 'spring',
@@ -113,7 +112,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
113112
type: 'tween',
114113
ease: 'easeOut',
115114
},
116-
}),
115+
},
117116
};
118117

119118
export function replaceHeadersWithBold(markdown: string) {

static/app/components/events/autofix/autofixSolution.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {trackAnalytics} from 'sentry/utils/analytics';
3434
import {singleLineRenderer} from 'sentry/utils/marked/marked';
3535
import {valueIsEqual} from 'sentry/utils/object/valueIsEqual';
3636
import {setApiQueryData, useMutation, useQueryClient} from 'sentry/utils/queryClient';
37-
import {testableTransition} from 'sentry/utils/testableTransition';
3837
import {useApi} from 'sentry/utils/useApi';
3938
import {useCopyToClipboard} from 'sentry/utils/useCopyToClipboard';
4039
import {useOrganization} from 'sentry/utils/useOrganization';
@@ -134,7 +133,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
134133
exit: {opacity: 0, height: 0, scale: 0.8, y: -20},
135134
initial: {opacity: 0, height: 0, scale: 0.8},
136135
animate: {opacity: 1, height: 'auto', scale: 1},
137-
transition: testableTransition({
136+
transition: {
138137
duration: 1.0,
139138
height: {
140139
type: 'spring',
@@ -148,7 +147,7 @@ const cardAnimationProps: MotionNodeAnimationOptions = {
148147
type: 'tween',
149148
ease: 'easeOut',
150149
},
151-
}),
150+
},
152151
};
153152

154153
function SolutionDescription({

0 commit comments

Comments
 (0)