diff --git a/src/containers/Chat/ChatMessages/AddToMessageTemplate/AddToMessageTemplate.tsx b/src/containers/Chat/ChatMessages/AddToMessageTemplate/AddToMessageTemplate.tsx index 62e8fe30fc..9173e3b664 100644 --- a/src/containers/Chat/ChatMessages/AddToMessageTemplate/AddToMessageTemplate.tsx +++ b/src/containers/Chat/ChatMessages/AddToMessageTemplate/AddToMessageTemplate.tsx @@ -29,7 +29,7 @@ export const AddToMessageTemplate = ({ id, message, changeDisplay }: AddToMessag refetchQueries: [ { query: FILTER_TEMPLATES, - variables: setVariables({ term: '' }), + variables: setVariables({ term: '' }, 50), }, ], }); diff --git a/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.test.tsx b/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.test.tsx index 73109f606b..5dd0b73d6c 100644 --- a/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.test.tsx +++ b/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.test.tsx @@ -14,6 +14,13 @@ vi.mock('react-tiny-link', () => { }; }); +// mock react player +vi.mock('react-player', () => { + return { + default: () => , + }; +}); + HTMLAnchorElement.prototype.click = vi.fn(); const insertedAt = '2020-06-19T18:44:02Z'; diff --git a/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.tsx b/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.tsx index cacfe6bd21..fca42d8cf4 100644 --- a/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.tsx +++ b/src/containers/Chat/ChatMessages/ChatMessage/ChatMessage.tsx @@ -181,7 +181,6 @@ export const ChatMessage = ({ if (testForValidUrl.test(mediaUrl)) { const link = document.createElement('a'); link.href = mediaUrl; - console.log(mediaUrl); link.setAttribute('download', link.href); document.body.appendChild(link); link.click(); diff --git a/src/containers/Collection/CollectionContact/CollectionContact.test.tsx b/src/containers/Collection/CollectionContact/CollectionContact.test.tsx index dcc8e2e439..01642f20b9 100644 --- a/src/containers/Collection/CollectionContact/CollectionContact.test.tsx +++ b/src/containers/Collection/CollectionContact/CollectionContact.test.tsx @@ -1,5 +1,5 @@ -import { render } from '@testing-library/react'; -import { MockedProvider } from '@apollo/client/testing'; +import { getByText, render, screen, waitFor } from '@testing-library/react'; +import { MockedProvider, wait } from '@apollo/client/testing'; import { MemoryRouter } from 'react-router'; import { vi } from 'vitest'; @@ -35,9 +35,11 @@ const wrapper = ( describe('', () => { test('should render CollectionContact', async () => { - const { getByTestId } = render(wrapper); - + const { getByTestId, getByText } = render(wrapper); // loading is show initially expect(getByTestId('loading')).toBeInTheDocument(); + await waitFor(() => { + expect(getByText('Collection')).toBeInTheDocument(); + }); }); }); diff --git a/src/containers/Consulting/ConsultingList/ExportConsulting/ExportConsulting.tsx b/src/containers/Consulting/ConsultingList/ExportConsulting/ExportConsulting.tsx index 72d16f6598..5caa43407e 100644 --- a/src/containers/Consulting/ConsultingList/ExportConsulting/ExportConsulting.tsx +++ b/src/containers/Consulting/ConsultingList/ExportConsulting/ExportConsulting.tsx @@ -99,8 +99,8 @@ export const ExportConsulting = ({ setFilters }: ExportConsultingPropTypes) => {
{formFields.map((field) => ( -
- +
+
))} diff --git a/src/containers/Flow/Flow.tsx b/src/containers/Flow/Flow.tsx index f2e2fd07c0..d1f0a9f92a 100644 --- a/src/containers/Flow/Flow.tsx +++ b/src/containers/Flow/Flow.tsx @@ -36,7 +36,7 @@ export const Flow = () => { const [isPinnedDisable, setIsPinnedDisable] = useState(false); const [keywords, setKeywords] = useState(''); const [description, setDescription] = useState(''); - const [tagId, setTagId] = useState({ id: '', label: '' }); + const [tagId, setTagId] = useState(null); const [isActive, setIsActive] = useState(true); const [isPinned, setIsPinned] = useState(false); const [roles, setRoles] = useState>([]); diff --git a/src/containers/Flow/FlowList/FlowList.test.tsx b/src/containers/Flow/FlowList/FlowList.test.tsx index 82108f23e8..2f25ae96df 100644 --- a/src/containers/Flow/FlowList/FlowList.test.tsx +++ b/src/containers/Flow/FlowList/FlowList.test.tsx @@ -2,6 +2,11 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import { MockedProvider } from '@apollo/client/testing'; import { vi } from 'vitest'; +import { loadErrorMessages, loadDevMessages } from '@apollo/client/dev'; + +// Adds messages only in a dev environment +loadDevMessages(); +loadErrorMessages(); import { getFlowCountQuery, @@ -135,7 +140,10 @@ describe('', () => { test('should export flow to json file', async () => { global.URL.createObjectURL = vi.fn(); render(flowList); - await waitFor(async () => await new Promise((resolve) => setTimeout(resolve, 0))); + + await waitFor(() => { + const moreButton = screen.getByTestId('MoreIcon'); + }); const moreButton = screen.getByTestId('MoreIcon'); fireEvent.click(moreButton); diff --git a/src/containers/List/List.test.tsx b/src/containers/List/List.test.tsx index e68f317a87..c4ddb1a371 100644 --- a/src/containers/List/List.test.tsx +++ b/src/containers/List/List.test.tsx @@ -115,7 +115,6 @@ describe(' actions', () => { fireEvent.click(moreButton); await waitFor(() => { const button = queryByTestId('DeleteIcon') as HTMLButtonElement; - console.log(button); fireEvent.click(button); }); await waitFor(() => { diff --git a/src/containers/List/List.tsx b/src/containers/List/List.tsx index 8c43fa8f83..1d42264f4c 100644 --- a/src/containers/List/List.tsx +++ b/src/containers/List/List.tsx @@ -587,10 +587,12 @@ export const List = ({ horizontal: 'right', }} > - {editButton} - - {deleteButton(id, labelValue)} - {actionListMap(item, actionsInsideMore, true)} +
+ {editButton} + + {deleteButton(id, labelValue)} + {actionListMap(item, actionsInsideMore, true)} +
)}
diff --git a/src/containers/TemplateOptions/TemplateOptions.tsx b/src/containers/TemplateOptions/TemplateOptions.tsx index 0d9b2f047e..49a5e7742c 100644 --- a/src/containers/TemplateOptions/TemplateOptions.tsx +++ b/src/containers/TemplateOptions/TemplateOptions.tsx @@ -92,7 +92,7 @@ export const TemplateOptions = ({ if (templateType === CALL_TO_ACTION) { template = ( - +
@@ -286,9 +286,9 @@ export const TemplateOptions = ({ name="templateButtons" render={(arrayHelpers: any) => (
- {values.templateButtons.map((row: any, index: any) => - getButtons(row, index, arrayHelpers) - )} + {values.templateButtons.map((row: any, index: any) => ( +
{getButtons(row, index, arrayHelpers)}
+ ))}
)} /> diff --git a/src/graphql/queries/Contact.ts b/src/graphql/queries/Contact.ts index dc9238ffbc..fb7198f282 100644 --- a/src/graphql/queries/Contact.ts +++ b/src/graphql/queries/Contact.ts @@ -120,6 +120,7 @@ export const GET_CONTACT_DETAILS = gql` export const GET_CONTACT_HISTORY = gql` query ContactHistory($filter: ContactsHistoryFilter, $opts: Opts) { contactHistory(filter: $filter, opts: $opts) { + id eventDatetime eventLabel eventMeta diff --git a/src/mocks/Flow.tsx b/src/mocks/Flow.tsx index ec061c2c12..d4e7123d4a 100644 --- a/src/mocks/Flow.tsx +++ b/src/mocks/Flow.tsx @@ -37,6 +37,7 @@ export const getFlowQuery = { id: '1', name: 'Help', isActive: true, + description: 'Help flow', uuid: 'b050c652-65b5-4ccf-b62b-1e8b3f328676', keywords: ['help'], isPinned: false, @@ -101,6 +102,7 @@ const filterFlowResult = { id: '1', ignoreKeywords: true, isActive: true, + description: 'Help flow', keywords: ['help', 'मदद'], lastChangedAt: '2021-03-05T04:32:23Z', lastPublishedAt: null, @@ -180,6 +182,7 @@ export const filterFlowWithNameOrKeywordOrTagQuery = { ignoreKeywords: true, isActive: true, keywords: ['help', 'मदद'], + description: 'Help flow', lastChangedAt: '2021-03-05T04:32:23Z', lastPublishedAt: null, name: 'Help Workflow', @@ -371,8 +374,10 @@ export const importFlow = { result: { data: { importFlow: { - errors: null, - success: true, + status: { + flowName: 'flow 1', + status: 'success', + }, }, }, }, @@ -450,6 +455,7 @@ export const updateFlowQuery = { isActive: true, isPinned: false, isBackground: false, + description: 'Help flow', name: 'New Flow', keywords: ['मदद'], ignoreKeywords: false, @@ -468,6 +474,7 @@ export const updateFlowQuery = { id: '1', isActive: true, ignoreKeywords: false, + description: 'Help flow', keywords: ['मदद'], name: 'New Flow', isBackground: false, @@ -506,6 +513,7 @@ export const copyFlowQuery = { isActive: true, isPinned: false, isBackground: false, + description: 'Help flow', name: 'Copy of Help', keywords: ['help', 'activity'], ignoreKeywords: false, @@ -524,7 +532,7 @@ export const copyFlowQuery = { id: '1', isActive: true, keywords: ['help', 'activity'], - + description: 'Help flow', name: 'Copy of Help', isBackground: false, updatedAt: '2021-03-05T04:32:23Z',