Skip to content

Commit

Permalink
Chore: Remove & Test old closeChat templates (#26631)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Gazzo <[email protected]>
Co-authored-by: Guilherme Gazzo <[email protected]>
  • Loading branch information
3 people authored Aug 25, 2022
1 parent 12481d5 commit 3ae6fbb
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 307 deletions.
1 change: 0 additions & 1 deletion apps/meteor/app/livechat/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ import './voip';
import './ui';
import './tabBar';
import './startup/notifyUnreadRooms';
import './views/app/dialog/closeRoom';
import './stylesheets/livechat.css';
import './externalFrame';
72 changes: 0 additions & 72 deletions apps/meteor/app/livechat/client/views/app/dialog/closeRoom.html

This file was deleted.

192 changes: 0 additions & 192 deletions apps/meteor/app/livechat/client/views/app/dialog/closeRoom.js

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/app/livechat/client/views/regular.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import './app/livechatReadOnly';
import './app/livechatNotSubscribed.html';
import './app/livechatRoomTagSelector';
import './app/tabbar/agentEdit';
import './app/tabbar/agentInfo';
import './app/tabbar/visitorEdit';
Expand Down
62 changes: 62 additions & 0 deletions apps/meteor/tests/e2e/omnichannel-close-chat.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { faker } from '@faker-js/faker';
import type { Browser, Page } from '@playwright/test';

import { test, expect } from './utils/test';
import { OmnichannelLiveChat, HomeChannel } from './page-objects';

const createAuxContext = async (browser: Browser, storageState: string): Promise<{ page: Page; poHomeChannel: HomeChannel }> => {
const page = await browser.newPage({ storageState });
const poHomeChannel = new HomeChannel(page);
await page.goto('/');
await page.locator('.main-content').waitFor();

return { page, poHomeChannel };
};

test.describe('Omnichannel close chat', () => {
let poLiveChat: OmnichannelLiveChat;
let newUser: { email: string; name: string };

let agent: { page: Page; poHomeChannel: HomeChannel };

test.beforeAll(async ({ api, browser }) => {
newUser = {
name: faker.name.firstName(),
email: faker.internet.email(),
};

// Set user user 1 as manager and agent
await api.post('/livechat/users/agent', { username: 'user1' });
await api.post('/livechat/users/manager', { username: 'user1' });
agent = await createAuxContext(browser, 'user1-session.json');
});
test.beforeEach(async ({ page }) => {
poLiveChat = new OmnichannelLiveChat(page);
});

test.afterAll(async ({ api }) => {
await api.delete('/livechat/users/agent/user1');
await api.delete('/livechat/users/manager/user1');
});

test('Receiving a message from visitor', async ({ page }) => {
await test.step('Expect send a message as a visitor', async () => {
await page.goto('/livechat');
await poLiveChat.btnOpenLiveChat('R').click();
await poLiveChat.sendMessage(newUser, false);
await poLiveChat.onlineAgentMessage.type('this_a_test_message_from_visitor');
await poLiveChat.btnSendMessageToOnlineAgent.click();
});

await test.step('Expect to have 1 omnichannel assigned to agent 1', async () => {
await agent.poHomeChannel.sidenav.openChat(newUser.name);
});

await test.step('Expect to be able to close an omnichannel to conversation', async () => {
await agent.poHomeChannel.content.btnCloseChat.click();
await agent.poHomeChannel.content.inputModalClosingComment.type('any_comment');
await agent.poHomeChannel.content.btnModalConfirm.click();
await expect(agent.poHomeChannel.toastSuccess).toBeVisible();
});
});
});
Loading

0 comments on commit 3ae6fbb

Please sign in to comment.