chore: fix datatestids

pull/3281/head
Audric Ackermann 5 months ago
parent 93c451048a
commit 89e2115f95
No known key found for this signature in database

@ -88,7 +88,7 @@ export const SessionSearchInput = () => {
const placeholder = isGroupCreationSearch ? window.i18n('searchContacts') : window.i18n('search');
return (
<StyledSearchInput>
<StyledSearchInput data-testid={isGroupCreationSearch ? 'search-contacts-field' : undefined}>
<SessionIconButton
iconColor="var(--search-bar-icon-color)"
iconSize="medium"

@ -112,7 +112,7 @@ export const ConversationMessageRequestButtons = () => {
onClick={() => {
handleDeclineConversationRequest(selectedConvoId, selectedConvoId, convoOrigin);
}}
dataTestId="decline-message-request"
dataTestId="delete-message-request"
/>
</ConversationBannerRow>
<ConversationIncomingRequestExplanation />

@ -91,7 +91,7 @@ export const ConversationOutgoingRequestExplanation = () => {
if (!contactFromLibsession || !contactFromLibsession.approvedMe) {
return (
<Container
data-testid={'empty-conversation-notification'}
data-testid={'empty-conversation-control-message'}
style={{ padding: 0 }}
noExtraPadding={true}
>
@ -249,12 +249,9 @@ export const NoMessageInConversation = () => {
return null;
}
const dataTestId: SessionDataTestId =
isGroupV2 && isKickedFromGroup ? 'empty-conversation-notification' : 'group-control-message';
return (
<TextNotification
dataTestId={dataTestId}
dataTestId={'empty-conversation-control-message'}
html={getHtmlToRender()}
noExtraPadding={false} // in this case, `TextNotification` is **not** part of a bigger component so we need to add some spacing
/>

@ -228,6 +228,7 @@ const InviteContactsDialogInner = (props: Props) => {
buttonType={SessionButtonType.Simple}
disabled={!hasContacts || isProcessingUIChange}
onClick={onClickOK}
dataTestId="session-confirm-ok-button"
/>
<SessionButton
text={cancelText}
@ -235,6 +236,7 @@ const InviteContactsDialogInner = (props: Props) => {
buttonType={SessionButtonType.Simple}
onClick={closeDialog}
disabled={isProcessingUIChange}
dataTestId="session-confirm-cancel-button"
/>
</div>
</SessionWrapperModal>

@ -63,7 +63,7 @@ export function OpenUrlModal(props: OpenUrlModalState) {
text={window.i18n('urlCopy')}
buttonType={SessionButtonType.Simple}
onClick={onClickCopy}
dataTestId="session-confirm-cancel-button"
dataTestId="copy-url-button"
/>
</div>
</SessionWrapperModal>

@ -238,7 +238,7 @@ export const OverlayClosedGroupV2 = () => {
text={window.i18n('create')}
disabled={disableCreateButton}
onClick={onEnterPressed}
dataTestId="next-button"
dataTestId="create-group-button"
margin="auto 0 var(--margins-lg) 0 " // just to keep that button at the bottom of the overlay (even with an empty list)
/>
</div>
@ -358,7 +358,7 @@ export const OverlayLegacyClosedGroup = () => {
text={window.i18n('create')}
disabled={disableCreateButton}
onClick={onEnterPressed}
dataTestId="next-button"
dataTestId="create-group-button"
margin="auto 0 0" // just to keep that button at the bottom of the overlay (even with an empty list)
/>
</Flex>

@ -448,6 +448,7 @@ export const AcceptMsgRequestMenuItem = () => {
convoId,
});
}}
dataTestId="accept-menu-item"
>
{window.i18n('accept')}
</ItemWithDataTestId>
@ -474,6 +475,7 @@ export const DeclineMsgRequestMenuItem = () => {
conversationIdOrigin: null,
});
}}
dataTestId="delete-menu-item"
>
{window.i18n('delete')}
</ItemWithDataTestId>
@ -503,6 +505,7 @@ export const DeclineAndBlockMsgRequestMenuItem = () => {
conversationIdOrigin: convoOrigin ?? null,
});
}}
dataTestId="block-menu-item"
>
{window.i18n('block')}
</ItemWithDataTestId>

@ -1,8 +1,13 @@
import React from 'react';
import { Item, ItemProps } from 'react-contexify';
export function ItemWithDataTestId({ children, ...props }: ItemProps) {
export function ItemWithDataTestId({
children,
dataTestId,
...props
}: Omit<ItemProps, 'data-testid'> & { dataTestId?: React.SessionDataTestId }) {
return (
<Item data-testid="context-menu-item" {...props}>
<Item data-testid={dataTestId || 'context-menu-item'} {...props}>
{children}
</Item>
);

12
ts/react.d.ts vendored

@ -77,6 +77,9 @@ declare module 'react' {
| 'help-settings-menu-item'
| 'permissions-settings-menu-item'
| 'clearData-settings-menu-item'
| 'block-menu-item'
| 'delete-menu-item'
| 'accept-menu-item'
// timer options
| 'time-option-0'
@ -107,8 +110,7 @@ declare module 'react' {
| 'group-request-explanation'
| 'conversation-request-explanation'
| 'group-invite-control-message'
| 'empty-conversation-notification'
| 'group-control-message'
| 'empty-conversation-control-message'
// call notification types
| 'call-notification-missed-call'
@ -177,6 +179,7 @@ declare module 'react' {
| 'contact-status'
| 'version-warning'
| 'open-url-confirm-button'
| 'copy-url-button'
| 'continue-session-button'
| 'next-new-conversation-button'
| 'reveal-recovery-phrase'
@ -199,7 +202,6 @@ declare module 'react' {
| 'hide-recovery-phrase-toggle'
| 'reveal-recovery-phrase-toggle'
| 'resend-promote-button'
| 'next-button'
| 'continue-button'
| 'back-button'
| 'empty-conversation'
@ -210,10 +212,12 @@ declare module 'react' {
| 'save-button-profile-update'
| 'copy-button-profile-update'
| 'disappear-set-button'
| 'decline-message-request'
| 'create-group-button'
| 'delete-message-request'
| 'accept-message-request'
| 'mentions-popup-row'
| 'session-id-signup'
| 'search-contacts-field'
| 'three-dot-loading-animation'
| 'recovery-phrase-input'
| 'display-name-input'

Loading…
Cancel
Save