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'); const placeholder = isGroupCreationSearch ? window.i18n('searchContacts') : window.i18n('search');
return ( return (
<StyledSearchInput> <StyledSearchInput data-testid={isGroupCreationSearch ? 'search-contacts-field' : undefined}>
<SessionIconButton <SessionIconButton
iconColor="var(--search-bar-icon-color)" iconColor="var(--search-bar-icon-color)"
iconSize="medium" iconSize="medium"

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

@ -91,7 +91,7 @@ export const ConversationOutgoingRequestExplanation = () => {
if (!contactFromLibsession || !contactFromLibsession.approvedMe) { if (!contactFromLibsession || !contactFromLibsession.approvedMe) {
return ( return (
<Container <Container
data-testid={'empty-conversation-notification'} data-testid={'empty-conversation-control-message'}
style={{ padding: 0 }} style={{ padding: 0 }}
noExtraPadding={true} noExtraPadding={true}
> >
@ -249,12 +249,9 @@ export const NoMessageInConversation = () => {
return null; return null;
} }
const dataTestId: SessionDataTestId =
isGroupV2 && isKickedFromGroup ? 'empty-conversation-notification' : 'group-control-message';
return ( return (
<TextNotification <TextNotification
dataTestId={dataTestId} dataTestId={'empty-conversation-control-message'}
html={getHtmlToRender()} html={getHtmlToRender()}
noExtraPadding={false} // in this case, `TextNotification` is **not** part of a bigger component so we need to add some spacing 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} buttonType={SessionButtonType.Simple}
disabled={!hasContacts || isProcessingUIChange} disabled={!hasContacts || isProcessingUIChange}
onClick={onClickOK} onClick={onClickOK}
dataTestId="session-confirm-ok-button"
/> />
<SessionButton <SessionButton
text={cancelText} text={cancelText}
@ -235,6 +236,7 @@ const InviteContactsDialogInner = (props: Props) => {
buttonType={SessionButtonType.Simple} buttonType={SessionButtonType.Simple}
onClick={closeDialog} onClick={closeDialog}
disabled={isProcessingUIChange} disabled={isProcessingUIChange}
dataTestId="session-confirm-cancel-button"
/> />
</div> </div>
</SessionWrapperModal> </SessionWrapperModal>

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

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

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

@ -1,8 +1,13 @@
import React from 'react';
import { Item, ItemProps } from 'react-contexify'; 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 ( return (
<Item data-testid="context-menu-item" {...props}> <Item data-testid={dataTestId || 'context-menu-item'} {...props}>
{children} {children}
</Item> </Item>
); );

12
ts/react.d.ts vendored

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

Loading…
Cancel
Save