|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
import { faker } from '@faker-js/faker'; |
|
|
|
|
|
|
|
|
|
import { createToken } from '../../client/lib/utils/createToken'; |
|
|
|
|
import { IS_EE } from './config/constants'; |
|
|
|
|
import { Users } from './fixtures/userStates'; |
|
|
|
|
import { OmnichannelContacts } from './page-objects/omnichannel-contacts-list'; |
|
|
|
|
import { OmnichannelSection } from './page-objects/omnichannel-section'; |
|
|
|
|
@ -18,6 +19,16 @@ const createContact = (generateToken = false) => ({ |
|
|
|
|
const NEW_CONTACT = createContact(); |
|
|
|
|
const EDIT_CONTACT = createContact(); |
|
|
|
|
const EXISTING_CONTACT = createContact(true); |
|
|
|
|
const NEW_CUSTOM_FIELD = { |
|
|
|
|
searchable: true, |
|
|
|
|
field: 'hiddenCustomField', |
|
|
|
|
label: 'hiddenCustomField', |
|
|
|
|
defaultValue: 'test_contact_center_hidden_customField', |
|
|
|
|
scope: 'visitor', |
|
|
|
|
visibility: 'hidden', |
|
|
|
|
required: true, |
|
|
|
|
regexp: '', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const URL = { |
|
|
|
|
contactCenter: '/omnichannel-directory/contacts', |
|
|
|
|
@ -47,12 +58,19 @@ test.describe('Omnichannel Contact Center', () => { |
|
|
|
|
// Add a contact
|
|
|
|
|
const { id: _, ...data } = EXISTING_CONTACT; |
|
|
|
|
await api.post('/omnichannel/contact', data); |
|
|
|
|
|
|
|
|
|
if (IS_EE) { |
|
|
|
|
await api.post('/livechat/custom.field', NEW_CUSTOM_FIELD); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.afterAll(async ({ api }) => { |
|
|
|
|
// Remove added contacts
|
|
|
|
|
await api.delete('/livechat/visitor', { token: EXISTING_CONTACT.token }); |
|
|
|
|
await api.delete('/livechat/visitor', { token: NEW_CONTACT.token }); |
|
|
|
|
if (IS_EE) { |
|
|
|
|
await api.post('method.call/livechat:removeCustomField', { message: NEW_CUSTOM_FIELD.field }); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => { |
|
|
|
|
|