@servicetitan/titan-chatbot-ui-cypress 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/tests/index.d.ts +30 -0
- package/dist/tests/index.d.ts.map +1 -0
- package/dist/tests/index.js +30 -0
- package/dist/tests/index.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-error.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chat-ui/chat-error.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-error.shared-tests.js +138 -0
- package/dist/tests/titan-chat-ui/chat-error.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-input-file.shared-tests.d.ts +7 -0
- package/dist/tests/titan-chat-ui/chat-input-file.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-input-file.shared-tests.js +123 -0
- package/dist/tests/titan-chat-ui/chat-input-file.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-input.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chat-ui/chat-input.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-input.shared-tests.js +71 -0
- package/dist/tests/titan-chat-ui/chat-input.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-log.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chat-ui/chat-log.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-log.shared-tests.js +73 -0
- package/dist/tests/titan-chat-ui/chat-log.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-messages.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chat-ui/chat-messages.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-messages.shared-tests.js +118 -0
- package/dist/tests/titan-chat-ui/chat-messages.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-notifications.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chat-ui/chat-notifications.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-notifications.shared-tests.js +110 -0
- package/dist/tests/titan-chat-ui/chat-notifications.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat-timer.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chat-ui/chat-timer.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat-timer.shared-tests.js +76 -0
- package/dist/tests/titan-chat-ui/chat-timer.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/chat.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chat-ui/chat.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/chat.shared-tests.js +111 -0
- package/dist/tests/titan-chat-ui/chat.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-agent.shared-tests.d.ts +27 -0
- package/dist/tests/titan-chat-ui/message-agent.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-agent.shared-tests.js +67 -0
- package/dist/tests/titan-chat-ui/message-agent.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-content-file.shared-tests.d.ts +10 -0
- package/dist/tests/titan-chat-ui/message-content-file.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-content-file.shared-tests.js +88 -0
- package/dist/tests/titan-chat-ui/message-content-file.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-system.shared-tests.d.ts +16 -0
- package/dist/tests/titan-chat-ui/message-system.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-system.shared-tests.js +65 -0
- package/dist/tests/titan-chat-ui/message-system.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-timeout.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chat-ui/message-timeout.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-timeout.shared-tests.js +63 -0
- package/dist/tests/titan-chat-ui/message-timeout.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-typing.shared-tests.d.ts +12 -0
- package/dist/tests/titan-chat-ui/message-typing.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-typing.shared-tests.js +46 -0
- package/dist/tests/titan-chat-ui/message-typing.shared-tests.js.map +1 -0
- package/dist/tests/titan-chat-ui/message-user.shared-tests.d.ts +10 -0
- package/dist/tests/titan-chat-ui/message-user.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chat-ui/message-user.shared-tests.js +64 -0
- package/dist/tests/titan-chat-ui/message-user.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-filters.shared-tests.d.ts +7 -0
- package/dist/tests/titan-chatbot-ui/chatbot-filters.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-filters.shared-tests.js +118 -0
- package/dist/tests/titan-chatbot-ui/chatbot-filters.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-help-center.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chatbot-ui/chatbot-help-center.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-help-center.shared-tests.js +162 -0
- package/dist/tests/titan-chatbot-ui/chatbot-help-center.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-links.shared-tests.d.ts +15 -0
- package/dist/tests/titan-chatbot-ui/chatbot-links.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-links.shared-tests.js +123 -0
- package/dist/tests/titan-chatbot-ui/chatbot-links.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-live.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chatbot-ui/chatbot-live.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-live.shared-tests.js +84 -0
- package/dist/tests/titan-chatbot-ui/chatbot-live.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer-readonly.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer-readonly.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer-readonly.shared-tests.js +142 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer-readonly.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer.shared-tests.js +105 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-answer.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form-guardrail.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form-guardrail.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form-guardrail.shared-tests.js +86 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form-guardrail.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form.shared-tests.d.ts +3 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form.shared-tests.js +143 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-form.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-popover.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-popover.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-popover.shared-tests.js +200 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-feedback-popover.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-typing.shared-tests.d.ts +11 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-typing.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-typing.shared-tests.js +81 -0
- package/dist/tests/titan-chatbot-ui/chatbot-message-typing.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-dialog.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-dialog.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-dialog.shared-tests.js +60 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-dialog.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-link.shared-tests.d.ts +8 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-link.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-link.shared-tests.js +77 -0
- package/dist/tests/titan-chatbot-ui/chatbot-restart-link.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-session-feedback-modal.shared-tests.d.ts +7 -0
- package/dist/tests/titan-chatbot-ui/chatbot-session-feedback-modal.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-session-feedback-modal.shared-tests.js +130 -0
- package/dist/tests/titan-chatbot-ui/chatbot-session-feedback-modal.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-titan-chatbot.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chatbot-ui/chatbot-titan-chatbot.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot-titan-chatbot.shared-tests.js +157 -0
- package/dist/tests/titan-chatbot-ui/chatbot-titan-chatbot.shared-tests.js.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot.shared-tests.d.ts +9 -0
- package/dist/tests/titan-chatbot-ui/chatbot.shared-tests.d.ts.map +1 -0
- package/dist/tests/titan-chatbot-ui/chatbot.shared-tests.js +114 -0
- package/dist/tests/titan-chatbot-ui/chatbot.shared-tests.js.map +1 -0
- package/dist/utils/chat-ui-selectors.d.ts +12 -0
- package/dist/utils/chat-ui-selectors.d.ts.map +1 -1
- package/dist/utils/chat-ui-selectors.js +24 -0
- package/dist/utils/chat-ui-selectors.js.map +1 -1
- package/dist/utils/test-utils-chatbot.d.ts +5 -0
- package/dist/utils/test-utils-chatbot.d.ts.map +1 -0
- package/dist/utils/test-utils-chatbot.js +55 -0
- package/dist/utils/test-utils-chatbot.js.map +1 -0
- package/dist/utils/test-utils.d.ts +6 -0
- package/dist/utils/test-utils.d.ts.map +1 -0
- package/dist/utils/test-utils.js +38 -0
- package/dist/utils/test-utils.js.map +1 -0
- package/package.json +10 -5
- package/src/index.ts +3 -0
- package/src/tests/index.ts +30 -0
- package/src/tests/titan-chat-ui/chat-error.shared-tests.tsx +185 -0
- package/src/tests/titan-chat-ui/chat-input-file.shared-tests.tsx +182 -0
- package/src/tests/titan-chat-ui/chat-input.shared-tests.tsx +99 -0
- package/src/tests/titan-chat-ui/chat-log.shared-tests.tsx +117 -0
- package/src/tests/titan-chat-ui/chat-messages.shared-tests.tsx +156 -0
- package/src/tests/titan-chat-ui/chat-notifications.shared-tests.tsx +153 -0
- package/src/tests/titan-chat-ui/chat-timer.shared-tests.tsx +106 -0
- package/src/tests/titan-chat-ui/chat.shared-tests.tsx +158 -0
- package/src/tests/titan-chat-ui/message-agent.shared-tests.tsx +170 -0
- package/src/tests/titan-chat-ui/message-content-file.shared-tests.tsx +139 -0
- package/src/tests/titan-chat-ui/message-system.shared-tests.tsx +147 -0
- package/src/tests/titan-chat-ui/message-timeout.shared-tests.tsx +117 -0
- package/src/tests/titan-chat-ui/message-typing.shared-tests.tsx +92 -0
- package/src/tests/titan-chat-ui/message-user.shared-tests.tsx +138 -0
- package/src/tests/titan-chatbot-ui/chatbot-filters.shared-tests.tsx +164 -0
- package/src/tests/titan-chatbot-ui/chatbot-help-center.shared-tests.tsx +225 -0
- package/src/tests/titan-chatbot-ui/chatbot-links.shared-tests.tsx +189 -0
- package/src/tests/titan-chatbot-ui/chatbot-live.shared-tests.tsx +127 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-answer-readonly.shared-tests.tsx +187 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-answer.shared-tests.tsx +144 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-feedback-form-guardrail.shared-tests.tsx +127 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-feedback-form.shared-tests.tsx +198 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-feedback-popover.shared-tests.tsx +285 -0
- package/src/tests/titan-chatbot-ui/chatbot-message-typing.shared-tests.tsx +112 -0
- package/src/tests/titan-chatbot-ui/chatbot-restart-dialog.shared-tests.tsx +91 -0
- package/src/tests/titan-chatbot-ui/chatbot-restart-link.shared-tests.tsx +116 -0
- package/src/tests/titan-chatbot-ui/chatbot-session-feedback-modal.shared-tests.tsx +182 -0
- package/src/tests/titan-chatbot-ui/chatbot-titan-chatbot.shared-tests.tsx +221 -0
- package/src/tests/titan-chatbot-ui/chatbot.shared-tests.tsx +158 -0
- package/src/utils/chat-ui-selectors.ts +24 -0
- package/src/utils/test-utils-chatbot.tsx +73 -0
- package/src/utils/test-utils.tsx +52 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Container } from '@servicetitan/react-ioc';
|
|
2
|
+
import {
|
|
3
|
+
CHAT_UI_BACKEND_STORE_TOKEN,
|
|
4
|
+
CHAT_UI_STORE_TOKEN,
|
|
5
|
+
ChatParticipantIcon,
|
|
6
|
+
ChatUiBackendEchoStore,
|
|
7
|
+
IChatUiBackendStore,
|
|
8
|
+
IChatUiStore,
|
|
9
|
+
} from '@servicetitan/titan-chat-ui-common';
|
|
10
|
+
import { FC, ReactNode } from 'react';
|
|
11
|
+
import { ChatUiSelectors } from '../../utils/chat-ui-selectors';
|
|
12
|
+
import { testInitContainer, testRenderWrapper } from '../../utils/test-utils';
|
|
13
|
+
|
|
14
|
+
interface MessageAgentSharedTestsOptions {
|
|
15
|
+
isAnvil2?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface MessageAgentProps {
|
|
19
|
+
'avatar'?: {
|
|
20
|
+
name: string;
|
|
21
|
+
icon: ChatParticipantIcon;
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
'children'?: ReactNode;
|
|
25
|
+
'messageFooter'?: ReactNode;
|
|
26
|
+
'fullWidth'?: boolean;
|
|
27
|
+
'data-cy'?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface MessageAgentComponents {
|
|
31
|
+
TextComponent: FC<any>;
|
|
32
|
+
ButtonComponent: FC<any>;
|
|
33
|
+
ContainerComponent: FC<any>;
|
|
34
|
+
MessageFooterComponent: FC<any>;
|
|
35
|
+
thumbUpIcon?: any;
|
|
36
|
+
thumbDownIcon?: any;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function runMessageAgentSharedTests(
|
|
40
|
+
MessageAgentComponent: FC<MessageAgentProps>,
|
|
41
|
+
components: MessageAgentComponents,
|
|
42
|
+
options: MessageAgentSharedTestsOptions = {}
|
|
43
|
+
) {
|
|
44
|
+
let container: Container;
|
|
45
|
+
let chatUiStore: IChatUiStore;
|
|
46
|
+
let chatUiBackendStore: IChatUiBackendStore;
|
|
47
|
+
|
|
48
|
+
beforeEach(() => {
|
|
49
|
+
container = testInitContainer();
|
|
50
|
+
chatUiStore = container.get<IChatUiStore>(CHAT_UI_STORE_TOKEN);
|
|
51
|
+
chatUiBackendStore = container.get<ChatUiBackendEchoStore>(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
52
|
+
cy.viewport(800, 800);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const render = (props?: any, onAfterInit?: () => void) => {
|
|
56
|
+
const defaultProps = {
|
|
57
|
+
avatar: {
|
|
58
|
+
name: 'Test User Name',
|
|
59
|
+
icon: ChatParticipantIcon.Bot,
|
|
60
|
+
},
|
|
61
|
+
children: options.isAnvil2 ? (
|
|
62
|
+
<components.TextComponent variant="body" data-cy="content">
|
|
63
|
+
message agent content
|
|
64
|
+
</components.TextComponent>
|
|
65
|
+
) : (
|
|
66
|
+
<components.TextComponent data-cy="content">
|
|
67
|
+
message agent content
|
|
68
|
+
</components.TextComponent>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return cy
|
|
73
|
+
.wrap(null)
|
|
74
|
+
.then(() =>
|
|
75
|
+
testRenderWrapper(
|
|
76
|
+
chatUiStore,
|
|
77
|
+
chatUiBackendStore,
|
|
78
|
+
<MessageAgentComponent {...defaultProps} {...props} />,
|
|
79
|
+
onAfterInit
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const createMessageFooter = () => {
|
|
85
|
+
if (options.isAnvil2) {
|
|
86
|
+
return (
|
|
87
|
+
<components.ContainerComponent
|
|
88
|
+
direction="row"
|
|
89
|
+
justifyContent="space-between"
|
|
90
|
+
alignItems="center"
|
|
91
|
+
>
|
|
92
|
+
<components.MessageFooterComponent
|
|
93
|
+
name="name"
|
|
94
|
+
timestamp={new Date('2022-01-01T10:10:00')}
|
|
95
|
+
/>
|
|
96
|
+
<components.ContainerComponent direction="row" gap="1" alignItems="center">
|
|
97
|
+
<components.ButtonComponent
|
|
98
|
+
icon={components.thumbUpIcon}
|
|
99
|
+
size="small"
|
|
100
|
+
appearance="ghost"
|
|
101
|
+
/>
|
|
102
|
+
<components.ButtonComponent
|
|
103
|
+
icon={components.thumbDownIcon}
|
|
104
|
+
size="small"
|
|
105
|
+
appearance="ghost"
|
|
106
|
+
/>
|
|
107
|
+
</components.ContainerComponent>
|
|
108
|
+
</components.ContainerComponent>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<components.ContainerComponent
|
|
114
|
+
direction="row"
|
|
115
|
+
justifyContent="space-between"
|
|
116
|
+
alignItems="center"
|
|
117
|
+
>
|
|
118
|
+
<components.MessageFooterComponent
|
|
119
|
+
name="name"
|
|
120
|
+
timestamp={new Date('2022-01-01T10:10:00')}
|
|
121
|
+
/>
|
|
122
|
+
<components.ContainerComponent direction="row" spacing="1">
|
|
123
|
+
<components.ButtonComponent iconName="thumb_up" xsmall fill="subtle" />
|
|
124
|
+
<components.ButtonComponent iconName="thumb_down" xsmall fill="subtle" />
|
|
125
|
+
</components.ContainerComponent>
|
|
126
|
+
</components.ContainerComponent>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
it('should be properly rendered', () => {
|
|
131
|
+
render({
|
|
132
|
+
avatar: {
|
|
133
|
+
name: 'Test User Name',
|
|
134
|
+
icon: ChatParticipantIcon.Bot,
|
|
135
|
+
className: 'custom-class',
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
ChatUiSelectors.chatMessageAgent.should('be.visible').children().should('have.length', 2);
|
|
140
|
+
ChatUiSelectors.chatAvatarBot.should('be.visible').should('have.class', 'custom-class');
|
|
141
|
+
ChatUiSelectors.chatMessageContentAgent.should('contain.text', 'message agent content');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should be full width', () => {
|
|
145
|
+
render({
|
|
146
|
+
fullWidth: true,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
ChatUiSelectors.chatMessageContentAgent.should('contain.text', 'message agent content');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should render with custom data-cy', () => {
|
|
153
|
+
render({
|
|
154
|
+
'data-cy': 'custom-data-cy',
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
cy.getCy('custom-data-cy').should('be.visible');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should render custom message footer', () => {
|
|
161
|
+
render({
|
|
162
|
+
messageFooter: createMessageFooter(),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
ChatUiSelectors.chatMessageAgent.should('be.visible').children().should('have.length', 2);
|
|
166
|
+
ChatUiSelectors.chatMessageFooter
|
|
167
|
+
.should('be.visible')
|
|
168
|
+
.should('contain.text', 'name • 10:10 AM');
|
|
169
|
+
});
|
|
170
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Container } from '@servicetitan/react-ioc';
|
|
2
|
+
import {
|
|
3
|
+
CHAT_UI_BACKEND_STORE_TOKEN,
|
|
4
|
+
CHAT_UI_STORE_TOKEN,
|
|
5
|
+
ChatMessageModelFile,
|
|
6
|
+
ChatMessageState,
|
|
7
|
+
ChatParticipantIcon,
|
|
8
|
+
ChatParticipantModel,
|
|
9
|
+
ChatUiBackendEchoStore,
|
|
10
|
+
IChatUiBackendStore,
|
|
11
|
+
IChatUiStore,
|
|
12
|
+
} from '@servicetitan/titan-chat-ui-common';
|
|
13
|
+
import { FC } from 'react';
|
|
14
|
+
import { testInitContainer, testRenderWrapper } from '../../utils/test-utils';
|
|
15
|
+
|
|
16
|
+
interface MessageContentFileSharedTestsOptions {
|
|
17
|
+
isAnvil2?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function runMessageContentFileSharedTests(
|
|
21
|
+
MessageContentFileComponent: FC<{ message: ChatMessageModelFile }>,
|
|
22
|
+
options: MessageContentFileSharedTestsOptions = {}
|
|
23
|
+
) {
|
|
24
|
+
let container: Container;
|
|
25
|
+
let chatUiStore: IChatUiStore;
|
|
26
|
+
let chatUiBackendStore: IChatUiBackendStore;
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
container = testInitContainer();
|
|
30
|
+
chatUiStore = container.get<IChatUiStore>(CHAT_UI_STORE_TOKEN);
|
|
31
|
+
chatUiBackendStore = container.get<ChatUiBackendEchoStore>(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
32
|
+
cy.viewport(800, 800);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const render = (message: ChatMessageModelFile, onAfterInit?: () => void) =>
|
|
36
|
+
cy
|
|
37
|
+
.wrap(null)
|
|
38
|
+
.then(() =>
|
|
39
|
+
testRenderWrapper(
|
|
40
|
+
chatUiStore,
|
|
41
|
+
chatUiBackendStore,
|
|
42
|
+
<MessageContentFileComponent message={message} />,
|
|
43
|
+
onAfterInit
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const createFileMessage = (
|
|
48
|
+
fileName: string,
|
|
49
|
+
state: ChatMessageState = ChatMessageState.Delivered
|
|
50
|
+
): ChatMessageModelFile => ({
|
|
51
|
+
id: 'test-file-message',
|
|
52
|
+
type: 'file',
|
|
53
|
+
participant: {
|
|
54
|
+
isAgent: false,
|
|
55
|
+
icon: ChatParticipantIcon.Empty,
|
|
56
|
+
name: 'Test User',
|
|
57
|
+
} as ChatParticipantModel,
|
|
58
|
+
fileName,
|
|
59
|
+
state,
|
|
60
|
+
timestamp: new Date(),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const getIconSelector = () => {
|
|
64
|
+
return options.isAnvil2 ? '[data-anv="icon"]' : '[data-anvil-component="Icon"]';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
it('should render file name with attach icon', () => {
|
|
68
|
+
const message = createFileMessage('test-document.pdf');
|
|
69
|
+
render(message);
|
|
70
|
+
|
|
71
|
+
cy.get(getIconSelector()).should('be.visible');
|
|
72
|
+
cy.contains('test-document.pdf').should('be.visible');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should display file name for different file types', () => {
|
|
76
|
+
const imageMessage = createFileMessage('image.jpg');
|
|
77
|
+
render(imageMessage);
|
|
78
|
+
|
|
79
|
+
cy.contains('image.jpg').should('be.visible');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should not show status text when message is in sent state', () => {
|
|
83
|
+
const message = createFileMessage('document.pdf', ChatMessageState.Delivered);
|
|
84
|
+
render(message);
|
|
85
|
+
|
|
86
|
+
cy.contains('File uploaded').should('exist');
|
|
87
|
+
cy.contains('Please wait while uploading...').should('not.exist');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should show "Please wait while uploading..." when message is delivering', () => {
|
|
91
|
+
const message = createFileMessage('document.pdf', ChatMessageState.Delivering);
|
|
92
|
+
render(message);
|
|
93
|
+
|
|
94
|
+
cy.contains('document.pdf').should('be.visible');
|
|
95
|
+
cy.contains('Please wait while uploading...').should('be.visible');
|
|
96
|
+
cy.contains('File uploaded').should('not.exist');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should show "File uploaded" when message is delivered', () => {
|
|
100
|
+
const message = createFileMessage('document.pdf', ChatMessageState.Delivered);
|
|
101
|
+
render(message);
|
|
102
|
+
|
|
103
|
+
cy.contains('document.pdf').should('be.visible');
|
|
104
|
+
cy.contains('File uploaded').should('be.visible');
|
|
105
|
+
cy.contains('Please wait while uploading...').should('not.exist');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should render with long file names', () => {
|
|
109
|
+
const message = createFileMessage('very-long-file-name-that-might-cause-layout-issues.pdf');
|
|
110
|
+
render(message);
|
|
111
|
+
|
|
112
|
+
cy.contains('very-long-file-name-that-might-cause-layout-issues.pdf').should('be.visible');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should render file with special characters in name', () => {
|
|
116
|
+
const message = createFileMessage('test file (1) - copy.pdf');
|
|
117
|
+
render(message);
|
|
118
|
+
|
|
119
|
+
cy.contains('test file (1) - copy.pdf').should('be.visible');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should not show status text when message is in pending state', () => {
|
|
123
|
+
const message = createFileMessage('document.pdf', ChatMessageState.Delivering);
|
|
124
|
+
render(message);
|
|
125
|
+
|
|
126
|
+
cy.contains('document.pdf').should('be.visible');
|
|
127
|
+
cy.contains('File uploaded').should('not.exist');
|
|
128
|
+
cy.contains('Please wait while uploading...').should('be.visible');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should not show status text when message is in error state', () => {
|
|
132
|
+
const message = createFileMessage('document.pdf', ChatMessageState.Failed);
|
|
133
|
+
render(message);
|
|
134
|
+
|
|
135
|
+
cy.contains('document.pdf').should('be.visible');
|
|
136
|
+
cy.contains('File uploaded').should('not.exist');
|
|
137
|
+
cy.contains('Please wait while uploading...').should('not.exist');
|
|
138
|
+
});
|
|
139
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Container } from '@servicetitan/react-ioc';
|
|
2
|
+
import {
|
|
3
|
+
CHAT_UI_BACKEND_STORE_TOKEN,
|
|
4
|
+
CHAT_UI_STORE_TOKEN,
|
|
5
|
+
ChatUiBackendEchoStore,
|
|
6
|
+
IChatUiBackendStore,
|
|
7
|
+
IChatUiStore,
|
|
8
|
+
} from '@servicetitan/titan-chat-ui-common';
|
|
9
|
+
import { FC, ReactNode } from 'react';
|
|
10
|
+
import { ChatUiSelectors } from '../../utils/chat-ui-selectors';
|
|
11
|
+
import { testInitContainer, testRenderWrapper } from '../../utils/test-utils';
|
|
12
|
+
|
|
13
|
+
interface MessageSystemSharedTestsOptions {
|
|
14
|
+
isAnvil2?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface MessageSystemProps {
|
|
18
|
+
className?: string;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface MessageSystemComponents {
|
|
24
|
+
TextComponent: FC<any>;
|
|
25
|
+
ContainerComponent: FC<any>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function runMessageSystemSharedTests(
|
|
29
|
+
MessageSystemComponent: FC<MessageSystemProps>,
|
|
30
|
+
components: MessageSystemComponents,
|
|
31
|
+
options: MessageSystemSharedTestsOptions = {}
|
|
32
|
+
) {
|
|
33
|
+
let container: Container;
|
|
34
|
+
let chatUiStore: IChatUiStore;
|
|
35
|
+
let chatUiBackendStore: IChatUiBackendStore;
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
container = testInitContainer();
|
|
39
|
+
chatUiStore = container.get<IChatUiStore>(CHAT_UI_STORE_TOKEN);
|
|
40
|
+
chatUiBackendStore = container.get<ChatUiBackendEchoStore>(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
41
|
+
cy.viewport(800, 800);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const render = (
|
|
45
|
+
props: { className?: string; fullWidth?: boolean; children?: ReactNode } = {},
|
|
46
|
+
onAfterInit?: () => void
|
|
47
|
+
) =>
|
|
48
|
+
cy.wrap(null).then(() =>
|
|
49
|
+
testRenderWrapper(
|
|
50
|
+
chatUiStore,
|
|
51
|
+
chatUiBackendStore,
|
|
52
|
+
<MessageSystemComponent className={props.className} fullWidth={props.fullWidth}>
|
|
53
|
+
{props.children}
|
|
54
|
+
</MessageSystemComponent>,
|
|
55
|
+
onAfterInit
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const createTestContent = () => {
|
|
60
|
+
if (options.isAnvil2) {
|
|
61
|
+
return (
|
|
62
|
+
<components.ContainerComponent>
|
|
63
|
+
<components.TextComponent variant="body" data-cy="content">
|
|
64
|
+
message system content
|
|
65
|
+
</components.TextComponent>
|
|
66
|
+
</components.ContainerComponent>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<components.ContainerComponent className="border">
|
|
72
|
+
<components.TextComponent data-cy="content">
|
|
73
|
+
message system content
|
|
74
|
+
</components.TextComponent>
|
|
75
|
+
</components.ContainerComponent>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const createSimpleTestContent = () => {
|
|
80
|
+
if (options.isAnvil2) {
|
|
81
|
+
return <components.TextComponent variant="body">Test content</components.TextComponent>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return <components.TextComponent>Test content</components.TextComponent>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
it('should be properly rendered', () => {
|
|
88
|
+
render({
|
|
89
|
+
className: 'custom-class',
|
|
90
|
+
children: createTestContent(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
ChatUiSelectors.chatMessageSystem.should('have.class', 'custom-class').should('be.visible');
|
|
94
|
+
cy.get('[data-cy="content"]').should('contain.text', 'message system content');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should be properly rendered fullwidth', () => {
|
|
98
|
+
render({
|
|
99
|
+
className: 'custom-class',
|
|
100
|
+
fullWidth: true,
|
|
101
|
+
children: createTestContent(),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
ChatUiSelectors.chatMessageSystem.should('have.class', 'custom-class').should('be.visible');
|
|
105
|
+
cy.get('[data-cy="content"]').should('contain.text', 'message system content');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should render with default data-cy attribute', () => {
|
|
109
|
+
render({
|
|
110
|
+
children: createSimpleTestContent(),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
ChatUiSelectors.chatMessageSystem.should(
|
|
114
|
+
'have.attr',
|
|
115
|
+
'data-cy',
|
|
116
|
+
'titan-chat-message-system'
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should render without children', () => {
|
|
121
|
+
render();
|
|
122
|
+
|
|
123
|
+
ChatUiSelectors.chatMessageSystem.should('not.be.visible');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should handle complex children structure', () => {
|
|
127
|
+
const complexChildren = options.isAnvil2 ? (
|
|
128
|
+
<components.ContainerComponent>
|
|
129
|
+
<components.TextComponent variant="body">First line</components.TextComponent>
|
|
130
|
+
<components.TextComponent variant="body">Second line</components.TextComponent>
|
|
131
|
+
</components.ContainerComponent>
|
|
132
|
+
) : (
|
|
133
|
+
<components.ContainerComponent>
|
|
134
|
+
<components.TextComponent>First line</components.TextComponent>
|
|
135
|
+
<components.TextComponent>Second line</components.TextComponent>
|
|
136
|
+
</components.ContainerComponent>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
render({
|
|
140
|
+
children: complexChildren,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
ChatUiSelectors.chatMessageSystem.should('be.visible');
|
|
144
|
+
cy.contains('First line').should('be.visible');
|
|
145
|
+
cy.contains('Second line').should('be.visible');
|
|
146
|
+
});
|
|
147
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Container } from '@servicetitan/react-ioc';
|
|
2
|
+
import {
|
|
3
|
+
CHAT_UI_BACKEND_STORE_TOKEN,
|
|
4
|
+
CHAT_UI_STORE_TOKEN,
|
|
5
|
+
ChatUiBackendEchoStore,
|
|
6
|
+
IChatUiBackendStore,
|
|
7
|
+
IChatUiStore,
|
|
8
|
+
} from '@servicetitan/titan-chat-ui-common';
|
|
9
|
+
import { FC } from 'react';
|
|
10
|
+
import { ChatUiSelectors } from '../../utils/chat-ui-selectors';
|
|
11
|
+
import { testInitContainer, testRenderWrapper } from '../../utils/test-utils';
|
|
12
|
+
|
|
13
|
+
interface MessageTimeoutProps {
|
|
14
|
+
onResume: () => void;
|
|
15
|
+
onReset: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function runMessageTimeoutSharedTests(MessageTimeoutComponent: FC<MessageTimeoutProps>) {
|
|
19
|
+
let container: Container;
|
|
20
|
+
let chatUiStore: IChatUiStore;
|
|
21
|
+
let chatUiBackendStore: IChatUiBackendStore;
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
container = testInitContainer();
|
|
25
|
+
chatUiStore = container.get<IChatUiStore>(CHAT_UI_STORE_TOKEN);
|
|
26
|
+
chatUiBackendStore = container.get<ChatUiBackendEchoStore>(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
27
|
+
cy.viewport(800, 800);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const render = (onResume?: () => void, onReset?: () => void, onAfterInit?: () => void) =>
|
|
31
|
+
cy
|
|
32
|
+
.wrap(null)
|
|
33
|
+
.then(() =>
|
|
34
|
+
testRenderWrapper(
|
|
35
|
+
chatUiStore,
|
|
36
|
+
chatUiBackendStore,
|
|
37
|
+
<MessageTimeoutComponent
|
|
38
|
+
onResume={onResume ?? cy.spy().as('onResume')}
|
|
39
|
+
onReset={onReset ?? cy.spy().as('onReset')}
|
|
40
|
+
/>,
|
|
41
|
+
onAfterInit
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
it('should render timeout message with proper text content', () => {
|
|
46
|
+
render();
|
|
47
|
+
|
|
48
|
+
ChatUiSelectors.chatMessageTimeout.should('be.visible');
|
|
49
|
+
ChatUiSelectors.chatMessageTimeout.should('contain.text', 'Your session has timed out.');
|
|
50
|
+
ChatUiSelectors.chatMessageTimeout.should(
|
|
51
|
+
'contain.text',
|
|
52
|
+
'Would you like to resume it or start a new one?'
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should render resume and reset links', () => {
|
|
57
|
+
render();
|
|
58
|
+
|
|
59
|
+
ChatUiSelectors.chatMessageTimeoutResume
|
|
60
|
+
.should('be.visible')
|
|
61
|
+
.should('contain.text', 'Continue session');
|
|
62
|
+
|
|
63
|
+
ChatUiSelectors.chatMessageTimeoutReset
|
|
64
|
+
.should('be.visible')
|
|
65
|
+
.should('contain.text', 'Start new session');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should call onResume when continue session link is clicked', () => {
|
|
69
|
+
const onResume = cy.spy().as('onResume');
|
|
70
|
+
render(onResume);
|
|
71
|
+
|
|
72
|
+
ChatUiSelectors.chatMessageTimeoutResume.click();
|
|
73
|
+
cy.get('@onResume').should('have.been.calledOnce');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should call onReset when start new session link is clicked', () => {
|
|
77
|
+
const onReset = cy.spy().as('onReset');
|
|
78
|
+
render(undefined, onReset);
|
|
79
|
+
|
|
80
|
+
ChatUiSelectors.chatMessageTimeoutReset.click();
|
|
81
|
+
cy.get('@onReset').should('have.been.calledOnce');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should handle both callbacks being provided', () => {
|
|
85
|
+
const onResume = cy.spy().as('onResume');
|
|
86
|
+
const onReset = cy.spy().as('onReset');
|
|
87
|
+
render(onResume, onReset);
|
|
88
|
+
|
|
89
|
+
ChatUiSelectors.chatMessageTimeoutResume.click();
|
|
90
|
+
cy.get('@onResume').should('have.been.calledOnce');
|
|
91
|
+
cy.get('@onReset').should('not.have.been.called');
|
|
92
|
+
|
|
93
|
+
ChatUiSelectors.chatMessageTimeoutReset.click();
|
|
94
|
+
cy.get('@onReset').should('have.been.calledOnce');
|
|
95
|
+
cy.get('@onResume').should('have.been.calledOnce');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should have proper data-cy attributes', () => {
|
|
99
|
+
render();
|
|
100
|
+
|
|
101
|
+
ChatUiSelectors.chatMessageTimeout.should(
|
|
102
|
+
'have.attr',
|
|
103
|
+
'data-cy',
|
|
104
|
+
'titan-chat-message-timeout'
|
|
105
|
+
);
|
|
106
|
+
ChatUiSelectors.chatMessageTimeoutResume.should(
|
|
107
|
+
'have.attr',
|
|
108
|
+
'data-cy',
|
|
109
|
+
'titan-chat-message-timeout-resume'
|
|
110
|
+
);
|
|
111
|
+
ChatUiSelectors.chatMessageTimeoutReset.should(
|
|
112
|
+
'have.attr',
|
|
113
|
+
'data-cy',
|
|
114
|
+
'titan-chat-message-timeout-reset'
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Container } from '@servicetitan/react-ioc';
|
|
2
|
+
import {
|
|
3
|
+
CHAT_UI_BACKEND_STORE_TOKEN,
|
|
4
|
+
CHAT_UI_STORE_TOKEN,
|
|
5
|
+
ChatParticipantIcon,
|
|
6
|
+
ChatUiBackendEchoStore,
|
|
7
|
+
IChatUiBackendStore,
|
|
8
|
+
IChatUiStore,
|
|
9
|
+
} from '@servicetitan/titan-chat-ui-common';
|
|
10
|
+
import { FC } from 'react';
|
|
11
|
+
import { ChatUiSelectors } from '../../utils/chat-ui-selectors';
|
|
12
|
+
import { testInitContainer, testRenderWrapper } from '../../utils/test-utils';
|
|
13
|
+
|
|
14
|
+
interface MessageTypingProps {
|
|
15
|
+
avatar: {
|
|
16
|
+
name: string;
|
|
17
|
+
icon: ChatParticipantIcon;
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function runMessageTypingSharedTests(MessageTypingComponent: FC<MessageTypingProps>) {
|
|
23
|
+
let container: Container;
|
|
24
|
+
let chatUiStore: IChatUiStore;
|
|
25
|
+
let chatUiBackendStore: IChatUiBackendStore;
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
container = testInitContainer();
|
|
29
|
+
chatUiStore = container.get<IChatUiStore>(CHAT_UI_STORE_TOKEN);
|
|
30
|
+
chatUiBackendStore = container.get<ChatUiBackendEchoStore>(CHAT_UI_BACKEND_STORE_TOKEN);
|
|
31
|
+
cy.viewport(800, 800);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const render = (icon: ChatParticipantIcon, onAfterInit?: () => void) =>
|
|
35
|
+
cy.wrap(null).then(() =>
|
|
36
|
+
testRenderWrapper(
|
|
37
|
+
chatUiStore,
|
|
38
|
+
chatUiBackendStore,
|
|
39
|
+
<MessageTypingComponent
|
|
40
|
+
avatar={{
|
|
41
|
+
name: 'Test User Name',
|
|
42
|
+
icon,
|
|
43
|
+
className: 'custom-class',
|
|
44
|
+
}}
|
|
45
|
+
/>,
|
|
46
|
+
onAfterInit
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
it('should render typing message with proper structure', () => {
|
|
51
|
+
render(ChatParticipantIcon.Bot);
|
|
52
|
+
|
|
53
|
+
ChatUiSelectors.chatMessageTyping.should('be.visible').children().should('have.length', 2);
|
|
54
|
+
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should render typing message with user icon', () => {
|
|
58
|
+
render(ChatParticipantIcon.Initials);
|
|
59
|
+
|
|
60
|
+
ChatUiSelectors.chatMessageTyping.should('be.visible');
|
|
61
|
+
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should render typing message with agent icon', () => {
|
|
65
|
+
render(ChatParticipantIcon.Bot);
|
|
66
|
+
|
|
67
|
+
ChatUiSelectors.chatMessageTyping.should('be.visible');
|
|
68
|
+
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should render typing message with empty icon', () => {
|
|
72
|
+
render(ChatParticipantIcon.Empty);
|
|
73
|
+
|
|
74
|
+
ChatUiSelectors.chatMessageTyping.should('be.visible');
|
|
75
|
+
ChatUiSelectors.chatMessageTypingDots.should('be.visible');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should have proper data-cy attributes', () => {
|
|
79
|
+
render(ChatParticipantIcon.Bot);
|
|
80
|
+
|
|
81
|
+
ChatUiSelectors.chatMessageTyping.should(
|
|
82
|
+
'have.attr',
|
|
83
|
+
'data-cy',
|
|
84
|
+
'titan-chat-message-typing'
|
|
85
|
+
);
|
|
86
|
+
ChatUiSelectors.chatMessageTypingDots.should(
|
|
87
|
+
'have.attr',
|
|
88
|
+
'data-cy',
|
|
89
|
+
'titan-chat-message-typing-dots'
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
}
|