Skip to content

Commit 5a3eb1f

Browse files
committed
test: fix e2e test
1 parent 72abb5a commit 5a3eb1f

File tree

2 files changed

+24
-67
lines changed

2 files changed

+24
-67
lines changed

apps/meteor/tests/e2e/omnichannel/omnichannel-departaments.spec.ts

Lines changed: 24 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -202,82 +202,43 @@ test.describe('OC - Manage Departments', () => {
202202
});
203203

204204
test('Request tag(s) before closing conversation', async () => {
205-
await test.step('expect create new department', async () => {
205+
await test.step('should create new department', async () => {
206206
await poOmnichannelDepartments.search(department.name);
207207
await expect(poOmnichannelDepartments.firstRowInTable).toBeVisible();
208208
});
209209

210-
await test.step('expect save form button be disabled', async () => {
211-
await poOmnichannelDepartments.search(department.name);
212-
await poOmnichannelDepartments.firstRowInTableMenu.click();
213-
await poOmnichannelDepartments.menuEditOption.click();
210+
const tagName = faker.string.sample(5);
211+
await poOmnichannelDepartments.firstRowInTableMenu.click();
212+
await poOmnichannelDepartments.menuEditOption.click();
213+
214+
await test.step('should form save button be disabled', async () => {
214215
await expect(poOmnichannelDepartments.btnSave).toBeDisabled();
215-
await poOmnichannelDepartments.btnBack.click();
216216
});
217217

218-
await test.step('Disabled tags state', async () => {
219-
await poOmnichannelDepartments.search(department.name);
220-
await poOmnichannelDepartments.firstRowInTableMenu.click();
221-
await poOmnichannelDepartments.menuEditOption.click();
222-
223-
await test.step('expect to have department tags toggle button', async () => {
224-
await expect(poOmnichannelDepartments.toggleRequestTags).toBeVisible();
225-
});
218+
await test.step('should be able to add a tag properly', async () => {
219+
await poOmnichannelDepartments.inputTags.fill(tagName);
220+
await poOmnichannelDepartments.btnTagsAdd.click();
226221

227-
await test.step('expect tag input to be visible but disabled', async () => {
228-
await expect(poOmnichannelDepartments.inputTags).toBeVisible();
229-
await expect(poOmnichannelDepartments.btnTagsAdd).toBeVisible();
222+
await expect(poOmnichannelDepartments.btnTag(tagName)).toBeVisible();
223+
await expect(poOmnichannelDepartments.btnSave).toBeEnabled();
224+
});
230225

231-
await expect(poOmnichannelDepartments.inputTags).toBeDisabled();
232-
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
226+
await test.step('should be able to remove a tag properly', async () => {
227+
await poOmnichannelDepartments.btnTag(tagName).click();
228+
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
229+
});
233230

234-
await poOmnichannelDepartments.btnBack.click();
235-
});
231+
await test.step('should not be possible to add empty tags', async () => {
232+
await poOmnichannelDepartments.inputTags.fill('');
233+
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
236234
});
237235

238-
await test.step('Enabled tags state', async () => {
236+
await test.step('should not be possible to add same tag twice', async () => {
239237
const tagName = faker.string.sample(5);
240-
241-
await poOmnichannelDepartments.search(department.name);
242-
await poOmnichannelDepartments.firstRowInTableMenu.click();
243-
await poOmnichannelDepartments.menuEditOption.click();
244-
245-
await test.step('expect to have form save option disabled', async () => {
246-
await expect(poOmnichannelDepartments.btnSave).toBeDisabled();
247-
});
248-
249-
await test.step('expect clicking on toggle button to enable tags', async () => {
250-
await poOmnichannelDepartments.toggleRequestTags.click();
251-
252-
await expect(poOmnichannelDepartments.inputTags).toBeEnabled();
253-
});
254-
255-
await test.step('expect to have add and remove one tag properly tags', async () => {
256-
await poOmnichannelDepartments.inputTags.fill(tagName);
257-
await poOmnichannelDepartments.btnTagsAdd.click();
258-
259-
await expect(poOmnichannelDepartments.btnTag(tagName)).toBeVisible();
260-
await expect(poOmnichannelDepartments.btnSave).toBeEnabled();
261-
});
262-
263-
await test.step('expect to be invalid if there is no tag added', async () => {
264-
await poOmnichannelDepartments.btnTag(tagName).click();
265-
await expect(poOmnichannelDepartments.invalidInputTags).toBeVisible();
266-
await expect(poOmnichannelDepartments.btnSave).toBeDisabled();
267-
});
268-
269-
await test.step('expect to be not possible adding empty tags', async () => {
270-
await poOmnichannelDepartments.inputTags.fill('');
271-
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
272-
});
273-
274-
await test.step('expect to not be possible adding same tag twice', async () => {
275-
const tagName = faker.string.sample(5);
276-
await poOmnichannelDepartments.inputTags.fill(tagName);
277-
await poOmnichannelDepartments.btnTagsAdd.click();
278-
await poOmnichannelDepartments.inputTags.fill(tagName);
279-
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
280-
});
238+
await poOmnichannelDepartments.inputTags.fill(tagName);
239+
await poOmnichannelDepartments.btnTagsAdd.click();
240+
await poOmnichannelDepartments.inputTags.fill(tagName);
241+
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();
281242
});
282243
});
283244

apps/meteor/tests/e2e/page-objects/omnichannel-departments.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ export class OmnichannelDepartments {
4949
return this.page.locator('[data-qa="DepartmentEditTextInput-ConversationClosingTags"]');
5050
}
5151

52-
get invalidInputTags() {
53-
return this.page.locator('[data-qa="DepartmentEditTextInput-ConversationClosingTags"]:invalid');
54-
}
55-
5652
get invalidInputName() {
5753
return this.page.locator('[data-qa="DepartmentEditTextInput-Name"]:invalid');
5854
}

0 commit comments

Comments
 (0)