Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactored current chats e2e tests #31100

Merged
merged 9 commits into from
Dec 7, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const CurrentChatsPage = ({ id, onRowClick }: { id?: string; onRowClick: (_id: s
};

return (
<GenericTableRow key={_id} onClick={(): void => onRowClick(_id)} action>
<GenericTableRow key={_id} onClick={(): void => onRowClick(_id)} action data-qa-id={fname}>
{isPriorityEnabled && (
<GenericTableCell withTruncatedText data-qa='current-chats-cell-priority'>
<PriorityIcon level={priorityWeight} />
Expand Down
24 changes: 20 additions & 4 deletions apps/meteor/client/views/omnichannel/currentChats/FilterByText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ const FilterByText: FilterByTextType = ({ setFilter, reload, customFields, setCu
};

setModal(
<GenericModal variant='danger' onConfirm={onDeleteAll} onClose={handleClose} onCancel={handleClose} confirmText={t('Delete')} />,
<GenericModal
variant='danger'
data-qa-id='current-chats-modal-remove-all-closed'
onConfirm={onDeleteAll}
onClose={handleClose}
onCancel={handleClose}
confirmText={t('Delete')}
/>,
);
});

Expand All @@ -114,8 +121,17 @@ const FilterByText: FilterByTextType = ({ setFilter, reload, customFields, setCu
<AutoCompleteAgent haveAll value={servedBy} onChange={handleServedBy} />
</Box>
<Box display='flex' mie={8} flexGrow={1} flexDirection='column'>
<Label mb={4}>{t('Status')}</Label>
<Select options={statusOptions} value={status} onChange={handleStatus} placeholder={t('Status')} data-qa='current-chats-status' />
<Label mb={4} id='current-chats-status'>
{t('Status')}
</Label>
<Select
options={statusOptions}
value={status}
onChange={handleStatus}
placeholder={t('Status')}
aria-labelledby='current-chats-status'
data-qa='current-chats-status'
/>
</Box>
<Box display='flex' mie={8} flexGrow={0} flexDirection='column'>
<Label mb={4}>{t('From')}</Label>
Expand All @@ -140,7 +156,7 @@ const FilterByText: FilterByTextType = ({ setFilter, reload, customFields, setCu
</Box>
{CurrentChatTags && (
<Box display='flex' flexDirection='row' marginBlockStart={8} {...props}>
<Box display='flex' mie={8} flexGrow={1} flexDirection='column'>
<Box display='flex' mie={8} flexGrow={1} flexDirection='column' data-qa='current-chats-tags'>
<Label mb={4}>{t('Tags')}</Label>
<CurrentChatTags value={tags} handler={handleTags} viewAll />
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ const RemoveChatButton: FC<{ _id: string }> = ({ _id }) => {
};

setModal(
<GenericModal variant='danger' onConfirm={onDeleteAgent} onClose={handleClose} onCancel={handleClose} confirmText={t('Delete')} />,
<GenericModal
variant='danger'
data-qa-id='current-chats-modal-remove'
onConfirm={onDeleteAgent}
onClose={handleClose}
onCancel={handleClose}
confirmText={t('Delete')}
/>,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test.describe('Omnichannel close inquiry', () => {

await test.step('Expect to have 1 omnichannel assigned to agent 1', async () => {
await agent.poHomeOmnichannel.sidenav.openQueuedOmnichannelChat(newUser.name);
await expect(agent.poHomeOmnichannel.content.takeOmnichannelChatButton).toBeVisible();
await expect(agent.poHomeOmnichannel.content.btnTakeChat).toBeVisible();
});

await test.step('Expect to be able to close an inquiry conversation', async () => {
Expand All @@ -62,8 +62,8 @@ test.describe('Omnichannel close inquiry', () => {
await test.step('Expect to inquiry be closed when navigate back', async () => {
await agent.poHomeOmnichannel.sidenav.openAdministrationByLabel('Omnichannel');
await agent.poHomeOmnichannel.omnisidenav.linkCurrentChats.click();
await agent.poHomeOmnichannel.currentChats.openChat(newUser.name);
await expect(agent.poHomeOmnichannel.content.takeOmnichannelChatButton).not.toBeVisible();
await agent.poHomeOmnichannel.currentChats.findRowByName(newUser.name).click();
await expect(agent.poHomeOmnichannel.content.btnTakeChat).not.toBeVisible();
});
});
});
Loading
Loading