Skip to content

Commit f35c57e

Browse files
committed
change testIDs to use CONST and displayName
1 parent 7b856e5 commit f35c57e

6 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5386,6 +5386,7 @@ const CONST = {
53865386
LOTTIE_VIEW_TEST_ID: 'LottieView',
53875387

53885388
DOT_INDICATOR_TEST_ID: 'DotIndicator',
5389+
ANIMATED_COLLAPSIBLE_CONTENT_TEST_ID: 'animated-collapsible-content',
53895390

53905391
CHAT_HEADER_LOADER_HEIGHT: 36,
53915392

src/components/AnimatedCollapsible/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function AnimatedCollapsible({isExpanded, children, header, duration = 300, styl
110110
<Animated.View style={[contentAnimatedStyle, contentStyle]}>
111111
{isExpanded || isRendered ? (
112112
<Animated.View
113-
testID="animated-collapsible-content"
113+
testID={CONST.ANIMATED_COLLAPSIBLE_CONTENT_TEST_ID}
114114
style={styles.stickToTop}
115115
onLayout={(e) => {
116116
const height = e.nativeEvent.layout.height;

src/components/ReportSearchHeader/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function ReportSearchHeader({report, style, transactions, avatarBorderColor}: Re
2525
<View
2626
dataSet={{dragArea: false}}
2727
style={[style, styles.reportSearchHeaderBar]}
28-
testID="report-search-header"
28+
testID={ReportSearchHeader.displayName}
2929
>
3030
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.flexGrow1, styles.justifyContentBetween, styles.overflowHidden]}>{middleContent}</View>
3131
</View>

src/components/SelectionListWithSections/Search/ActionCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function ActionCell({
110110

111111
return isLargeScreenWidth ? (
112112
<Button
113-
testID={`action-cell-button-${action}`}
113+
testID={ActionCell.displayName}
114114
text={text}
115115
onPress={goToItem}
116116
small

src/components/SelectionListWithSections/Search/TotalCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function TotalCell({total, currency}: TotalCellProps) {
1313

1414
return (
1515
<TextWithTooltip
16-
testID="total-cell"
16+
testID={TotalCell.displayName}
1717
shouldShowTooltip
1818
text={convertToDisplayString(total, currency)}
1919
style={[styles.optionDisplayName, styles.pre, styles.justifyContentCenter, styles.textBold, styles.textAlignRight]}

tests/unit/TransactionGroupListItemTest.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ describe('TransactionGroupListItem', () => {
203203

204204
expect(screen.getByRole(CONST.ROLE.CHECKBOX)).toBeTruthy();
205205
expect(screen.getByRole(CONST.ROLE.CHECKBOX)).not.toBeChecked();
206-
expect(screen.getByTestId('report-search-header')).toBeTruthy();
207-
expect(screen.getByTestId('total-cell')).toBeTruthy();
208-
expect(screen.getByTestId('action-cell-button-view')).toBeTruthy();
206+
expect(screen.getByTestId('ReportSearchHeader')).toBeTruthy();
207+
expect(screen.getByTestId('TotalCell')).toBeTruthy();
208+
expect(screen.getByTestId('ActionCell')).toBeTruthy();
209209
expect(screen.getByLabelText('Expand')).toBeTruthy();
210-
expect(screen.queryByTestId('animated-collapsible-content')).toBeNull();
210+
expect(screen.queryByTestId(CONST.ANIMATED_COLLAPSIBLE_CONTENT_TEST_ID)).toBeNull();
211211
});
212212

213213
it(`should toggle expansion state with ${CONST.TRANSACTION.RESULTS_PAGE_SIZE} items when Expand is triggered`, async () => {
@@ -216,7 +216,7 @@ describe('TransactionGroupListItem', () => {
216216
await expand();
217217

218218
expect(screen.getByLabelText('Collapse')).toBeTruthy();
219-
expect(screen.getByTestId('animated-collapsible-content')).toBeTruthy();
219+
expect(screen.getByTestId(CONST.ANIMATED_COLLAPSIBLE_CONTENT_TEST_ID)).toBeTruthy();
220220

221221
expect(getVisibleTransactionRowsCount()).toBe(CONST.TRANSACTION.RESULTS_PAGE_SIZE);
222222
});

0 commit comments

Comments
 (0)