Chore: e2e omnichannel tests - Close every opened page after the test (#28152)

pull/28154/head
Guilherme Gazzo 3 years ago committed by GitHub
parent 16e7bf9b18
commit fb7251b85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      apps/meteor/tests/e2e/omnichannel-auto-onhold-chat-closing.spec.ts
  2. 22
      apps/meteor/tests/e2e/omnichannel-auto-transfer-unanswered-chat.spec.ts
  3. 24
      apps/meteor/tests/e2e/omnichannel-changing-room-priority-and-sla.spec.ts
  4. 1
      apps/meteor/tests/e2e/omnichannel-close-chat.spec.ts
  5. 1
      apps/meteor/tests/e2e/omnichannel-send-transcript.spec.ts
  6. 20
      apps/meteor/tests/e2e/omnichannel-takeChat.spec.ts
  7. 23
      apps/meteor/tests/e2e/omnichannel-transfer-to-another-agents.spec.ts

@ -26,6 +26,15 @@ test.describe('omnichannel-auto-onhold-chat-closing', () => {
const { page } = await createAuxContext(browser, Users.user1);
agent = { page, poHomeChannel: new HomeChannel(page) };
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_auto_close_on_hold_chats_timeout', { value: 3600 }).then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_allow_manual_on_hold', { value: false }).then((res) => expect(res.status()).toBe(200)),
]);
await agent.page.close();
});
test.beforeEach(async ({ page }) => {
// make "user-1" online
@ -71,14 +80,4 @@ test.describe('omnichannel-auto-onhold-chat-closing', () => {
'Conversation closed: Closed automatically because chat was On Hold for 5 seconds.',
);
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_auto_close_on_hold_chats_timeout', { value: 3600 }).then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_allow_manual_on_hold', { value: false }).then((res) => expect(res.status()).toBe(200)),
]);
await agent.page.close();
});
});

@ -31,6 +31,17 @@ test.describe('omnichannel-auto-transfer-unanswered-chat', () => {
agent2 = { page: page2, poHomeChannel: new HomeChannel(page2) };
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/agent/user2').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_auto_transfer_chat_timeout', { value: 0 }).then((res) => expect(res.status()).toBe(200)),
]);
await agent1.page.close();
await agent2.page.close();
});
test.beforeEach(async ({ page }) => {
// make "user-1" online
await agent1.poHomeChannel.sidenav.switchOmnichannelStatus('online');
@ -59,15 +70,4 @@ test.describe('omnichannel-auto-transfer-unanswered-chat', () => {
await agent2.poHomeChannel.sidenav.openChat(newVisitor.name);
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/agent/user2').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_auto_transfer_chat_timeout', { value: 0 }).then((res) => expect(res.status()).toBe(200)),
]);
await agent1.page.close();
await agent2.page.close();
});
});

@ -44,6 +44,19 @@ test.describe('omnichannel-changing-room-priority-and-sla', () => {
await agent.poHomeChannel.sidenav.switchStatus('online');
});
test.afterAll(async ({ api }) => {
let statusCode = (await api.delete(`/livechat/users/agent/${ADMIN_CREDENTIALS.username}`)).status();
await expect(statusCode).toBe(200);
statusCode = (await api.delete(`/livechat/users/manager/${ADMIN_CREDENTIALS.username}`)).status();
await expect(statusCode).toBe(200);
statusCode = (await api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' })).status();
await expect(statusCode).toBe(200);
await agent.page.close();
});
test('expect to initiate a new livechat conversation', async ({ page }) => {
newVisitor = {
name: faker.name.firstName(),
@ -92,15 +105,4 @@ test.describe('omnichannel-changing-room-priority-and-sla', () => {
expect(status).toBe(200);
});
});
test.afterAll(async ({ api }) => {
let statusCode = (await api.delete(`/livechat/users/agent/${ADMIN_CREDENTIALS.username}`)).status();
await expect(statusCode).toBe(200);
statusCode = (await api.delete(`/livechat/users/manager/${ADMIN_CREDENTIALS.username}`)).status();
await expect(statusCode).toBe(200);
statusCode = (await api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' })).status();
await expect(statusCode).toBe(200);
});
});

@ -32,6 +32,7 @@ test.describe('Omnichannel close chat', () => {
test.afterAll(async ({ api }) => {
await api.delete('/livechat/users/agent/user1');
await api.delete('/livechat/users/manager/user1');
await agent.page.close();
});
test('Receiving a message from visitor', async ({ page }) => {

@ -32,6 +32,7 @@ test.describe('omnichannel-transcript', () => {
test.afterAll(async ({ api }) => {
await api.delete('/livechat/users/agent/user1');
await api.delete('/livechat/users/manager/user1');
await agent.page.close();
});
test('Receiving a message from visitor', async ({ page }) => {

@ -23,6 +23,16 @@ test.describe('omnichannel-takeChat', () => {
agent = { page, poHomeChannel: new HomeChannel(page) };
});
test.afterAll(async ({ api }) => {
await Promise.all([
await api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' }).then((res) => expect(res.status()).toBe(200)),
await api.post('/settings/Livechat_enabled_when_agent_idle', { value: false }).then((res) => expect(res.status()).toBe(200)),
await api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
]);
await agent.page.close();
});
test.beforeEach(async ({ page }) => {
// make "user-1" online
await agent.poHomeChannel.sidenav.switchStatus('online');
@ -40,16 +50,6 @@ test.describe('omnichannel-takeChat', () => {
await poLiveChat.btnSendMessageToOnlineAgent.click();
});
test.afterAll(async ({ api }) => {
await Promise.all([
await api.post('/settings/Livechat_Routing_Method', { value: 'Auto_Selection' }).then((res) => expect(res.status()).toBe(200)),
await api.post('/settings/Livechat_enabled_when_agent_idle', { value: false }).then((res) => expect(res.status()).toBe(200)),
await api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
]);
await agent.page.close();
});
test('expect "user1" to be able to take the chat from the queue', async () => {
await agent.poHomeChannel.sidenav.openQueuedOmnichannelChat(newVisitor.name);
await expect(agent.poHomeChannel.content.takeOmnichannelChatButton).toBeVisible();

@ -27,6 +27,17 @@ test.describe('omnichannel-transfer-to-another-agent', () => {
agent2 = { page: page2, poHomeOmnichannel: new HomeOmnichannel(page2) };
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/manager/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/agent/user2').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_enabled_when_agent_idle', { value: true }).then((res) => expect(res.status()).toBe(200)),
]);
await agent1.page.close();
await agent2.page.close();
});
test.beforeEach(async ({ page }) => {
// make "user-1" online & "user-2" offline so that chat can be automatically routed to "user-1"
await agent1.poHomeOmnichannel.sidenav.switchStatus('online');
@ -45,18 +56,6 @@ test.describe('omnichannel-transfer-to-another-agent', () => {
await poLiveChat.btnSendMessageToOnlineAgent.click();
});
test.afterAll(async ({ api }) => {
await Promise.all([
api.delete('/livechat/users/agent/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/manager/user1').then((res) => expect(res.status()).toBe(200)),
api.delete('/livechat/users/agent/user2').then((res) => expect(res.status()).toBe(200)),
api.post('/settings/Livechat_enabled_when_agent_idle', { value: true }).then((res) => expect(res.status()).toBe(200)),
]);
await agent1.page.close();
await agent2.page.close();
});
test('transfer omnichannel chat to another agent', async () => {
await test.step('Expect to have 1 omnichannel assigned to agent 1', async () => {
await agent1.poHomeOmnichannel.sidenav.openChat(newVisitor.name);

Loading…
Cancel
Save