-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d56a9b
commit b06f616
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,15 +129,24 @@ test.describe('Omnichannel - Livechat API', () => { | |
let poAuxContext: { page: Page; poHomeOmnichannel: HomeOmnichannel }; | ||
let poLiveChat: OmnichannelLiveChatEmbedded; | ||
let page: Page; | ||
const depId = faker.string.uuid(); | ||
let depId; | ||
|
||
test.beforeAll(async ({ api }) => { | ||
const statusCode = (await api.post('/livechat/users/agent', { username: 'user1' })).status(); | ||
await expect(statusCode).toBe(200); | ||
|
||
// await expect((await api.post('/livechat/department', { _id: depId, name: 'TestDep', email: 'TestDep@email.com' })).status()).toBe(200); | ||
const response = await api.post('/livechat/department', { _id: depId, name: 'TestDep', email: '[email protected]' }); | ||
console.log(response); | ||
const response = await api.post('/livechat/department', {department: { | ||
enabled: true, | ||
email: faker.internet.email(), | ||
showOnRegistration: true, | ||
showOnOfflineForm: true, | ||
name: `new department ${Date.now()}`, | ||
description: 'created from api', | ||
}}); | ||
console.log('response', response.data) | ||
depId = response.data?.department?._id; | ||
expect(response.status()).toBe(200); | ||
await expect((await api.post('/settings/Enable_CSP', { value: false })).status()).toBe(200); | ||
await expect((await api.post('/settings/Livechat_offline_email', { value: '[email protected]' })).status()).toBe(200); | ||
}); | ||
|
@@ -167,9 +176,12 @@ test.describe('Omnichannel - Livechat API', () => { | |
|
||
test.afterAll(async ({ api }) => { | ||
// await expect((await api.post('/settings/Enable_CSP', { value: true })).status()).toBe(200); | ||
console.log('depId', depId); | ||
await api.delete('/livechat/users/agent/user1'); | ||
await expect((await api.post('/settings/Omnichannel_enable_department_removal', { value: true })).status()).toBe(200); | ||
await expect((await api.delete(`/livechat/department/${depId}`, { name: 'TestDep', email: '[email protected]' })).status()).toBe(200); | ||
const response = await api.delete(`/livechat/department/${depId}`, { name: 'TestDep', email: '[email protected]' }); | ||
console.log('response', response); | ||
expect(response.status()).toBe(200); | ||
await expect((await api.post('/settings/Omnichannel_enable_department_removal', { value: false })).status()).toBe(200); | ||
}); | ||
|
||
|