Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const CustomFieldsPage = ({ data, header, setParams, params, title, renderRow, c
<Page flexDirection='row'>
<Page>
<Page.Header title={title}>
<Button onClick={onAddNew}>
<Button data-qa-id='CustomFieldPageBtnNew' onClick={onAddNew}>
<Icon name='plus' size='x16' /> {t('New')}
</Button>
</Page.Header>
<Page.Content>
<GenericTable
data-qa='GenericTableCustomFieldsInfoBody'
header={header}
renderRow={renderRow}
results={data && data.customFields}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const EditCustomFieldsPage = ({ customField, id, reload }) => {
<Icon size='x16' name='back' />
{t('Back')}
</Button>
<Button primary onClick={handleSave} disabled={!canSave}>
<Button data-qa-id='BtnSaveEditCustomFieldsPage' primary onClick={handleSave} disabled={!canSave}>
{t('Save')}
</Button>
</ButtonGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const NewCustomFieldsPage = ({ reload }) => {
<Icon size='x16' name='back' />
{t('Back')}
</Button>
<Button primary onClick={handleSave} disabled={!canSave}>
<Button data-qa-id='NewCustomFieldsPageButtonSave' primary onClick={handleSave} disabled={!canSave}>
{t('Save')}
</Button>
</ButtonGroup>
Expand Down
47 changes: 47 additions & 0 deletions apps/meteor/tests/e2e/omnichannel-custom-fields.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { test, expect } from './utils/test';
import { OmnichannelCustomFields } from './page-objects';

test.use({ storageState: 'admin-session.json' });

test.describe.serial('omnichannel-agents', () => {
let poOmnichannelCustomFields: OmnichannelCustomFields;
const newField = 'any_field';
test.beforeEach(async ({ page }) => {
poOmnichannelCustomFields = new OmnichannelCustomFields(page);

await page.goto('/omnichannel');
await poOmnichannelCustomFields.sidenav.linkCustomFields.click();
});
Comment thread
tassoevan marked this conversation as resolved.
Resolved

test('expect add new "custom field"', async ({ page }) => {
await poOmnichannelCustomFields.btnAdd.click();

await page.waitForURL('/omnichannel/customfields/new');
await poOmnichannelCustomFields.inputField.type(newField);
await poOmnichannelCustomFields.inputLabel.type('any_label');

await poOmnichannelCustomFields.btnSave.click();

await expect(poOmnichannelCustomFields.firstRowInTable(newField)).toBeVisible();
});

test('expect update "newField"', async ({ page }) => {
const newLabel = 'new_any_label';
await poOmnichannelCustomFields.inputSearch.fill(newField);
await poOmnichannelCustomFields.firstRowInTable(newField).click();

await poOmnichannelCustomFields.inputLabel.fill('new_any_label');
await poOmnichannelCustomFields.btnEditSave.click();

await expect(page.locator(`[qa-user-id="${newField}"] td:nth-child(2)`)).toHaveText(newLabel);
});

test('expect remove "new_field"', async () => {
await poOmnichannelCustomFields.inputSearch.fill(newField);
await poOmnichannelCustomFields.btnDeletefirstRowInTable.click();
await poOmnichannelCustomFields.btnModalRemove.click();

await poOmnichannelCustomFields.inputSearch.fill(newField);
expect(poOmnichannelCustomFields.firstRowInTable(newField)).toBeHidden();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export class OmnichannelSidenav {
return this.page.locator('a[href="omnichannel/agents"]');
}

get linkCustomFields(): Locator {
return this.page.locator('a[href="/omnichannel/customfields"]');
}

get linkCurrentChats(): Locator {
return this.page.locator('a[href="omnichannel/current"]');
}
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/tests/e2e/page-objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from './omnichannel-agents';
export * from './omnichannel-departments';
export * from './omnichannel-current-chats';
export * from './omnichannel-livechat';
export * from './omnichannel-custom-fields';
50 changes: 50 additions & 0 deletions apps/meteor/tests/e2e/page-objects/omnichannel-custom-fields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Locator, Page } from '@playwright/test';

import { OmnichannelSidenav } from './fragments';

export class OmnichannelCustomFields {
private readonly page: Page;

readonly sidenav: OmnichannelSidenav;

constructor(page: Page) {
this.page = page;
this.sidenav = new OmnichannelSidenav(page);
}

get btnAdd(): Locator {
return this.page.locator('[data-qa-id="CustomFieldPageBtnNew"]');
}

get inputField(): Locator {
return this.page.locator('[placeholder="Field"]');
}

get inputLabel(): Locator {
return this.page.locator('[placeholder="Label"]');
}

get btnSave(): Locator {
return this.page.locator('[data-qa-id="NewCustomFieldsPageButtonSave"]');
}

get inputSearch(): Locator {
return this.page.locator('[placeholder="Search"]');
}

get btnEditSave(): Locator {
return this.page.locator('[data-qa-id="BtnSaveEditCustomFieldsPage"]');
}

firstRowInTable(filedName: string) {
return this.page.locator(`[qa-user-id="${filedName}"]`);
}

get btnDeletefirstRowInTable() {
return this.page.locator('button[title="Remove"]');
}

get btnModalRemove(): Locator {
return this.page.locator('#modal-root dialog .rcx-modal__inner .rcx-modal__footer .rcx-button--danger');
}
}