Skip to content

Commit

Permalink
chore: refactored current chats e2e tests (#31100)
Browse files Browse the repository at this point in the history
* chore: added necessary id's for current chats e2e tests

* chore: methods to test current chats, on hold and return button

* chore: renamed take chat button locator

* chore: current chats page object

* chore: refactored current chats e2e tests

* chore: skipping test on community edition

* chore: allow agent to place room on hold

* chore: allow agent to place room on hold without engaging

* chore: queued conversation adjustments
  • Loading branch information
aleksandernsilva committed Dec 13, 2023
1 parent b78845a commit 185e36f
Show file tree
Hide file tree
Showing 10 changed files with 442 additions and 86 deletions.
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

0 comments on commit 185e36f

Please sign in to comment.