-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Save edited tags for omnichannel departments (#26481)
Co-authored-by: Aleksander Nicacio da Silva <6494543+aleksandernsilva@users.noreply.github.com> Co-authored-by: Guilherme Gazzo <5263975+ggazzo@users.noreply.github.com>
- Loading branch information
1 parent
fb3494b
commit 6a59a8a
Showing
5 changed files
with
142 additions
and
37 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
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
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 |
---|---|---|
@@ -1,51 +1,123 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import type { Page } from '@playwright/test'; | ||
|
||
import { test, expect } from './utils/test'; | ||
import { OmnichannelDepartaments } from './page-objects'; | ||
import { OmnichannelDepartments } from './page-objects'; | ||
|
||
test.use({ storageState: 'admin-session.json' }); | ||
|
||
test.describe.serial('omnichannel-departaments', () => { | ||
let poOmnichannelDepartaments: OmnichannelDepartaments; | ||
test.describe.serial('omnichannel-departments', () => { | ||
let poOmnichannelDepartments: OmnichannelDepartments; | ||
|
||
const departmentName = faker.datatype.uuid(); | ||
let departmentName: string; | ||
test.beforeAll(() => { | ||
departmentName = faker.datatype.uuid(); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
poOmnichannelDepartaments = new OmnichannelDepartaments(page); | ||
test.beforeEach(async ({ page }: { page: Page }) => { | ||
poOmnichannelDepartments = new OmnichannelDepartments(page); | ||
|
||
await page.goto('/omnichannel'); | ||
await poOmnichannelDepartaments.sidenav.linkDepartments.click(); | ||
await poOmnichannelDepartments.sidenav.linkDepartments.click(); | ||
}); | ||
|
||
test('expect create new department', async () => { | ||
await poOmnichannelDepartaments.btnNew.click(); | ||
await poOmnichannelDepartaments.btnEnabled.click(); | ||
await poOmnichannelDepartaments.inputName.fill(departmentName); | ||
await poOmnichannelDepartaments.inputEmail.fill(faker.internet.email()); | ||
await poOmnichannelDepartaments.btnSave.click(); | ||
|
||
await poOmnichannelDepartaments.inputSearch.fill(departmentName); | ||
await expect(poOmnichannelDepartaments.firstRowInTable).toBeVisible(); | ||
await poOmnichannelDepartments.btnNew.click(); | ||
await poOmnichannelDepartments.btnEnabled.click(); | ||
await poOmnichannelDepartments.inputName.fill(departmentName); | ||
await poOmnichannelDepartments.inputEmail.fill(faker.internet.email()); | ||
await poOmnichannelDepartments.btnSave.click(); | ||
|
||
await poOmnichannelDepartments.inputSearch.fill(departmentName); | ||
await expect(poOmnichannelDepartments.firstRowInTable).toBeVisible(); | ||
}); | ||
|
||
test('expect update department name', async () => { | ||
await poOmnichannelDepartaments.inputSearch.fill(departmentName); | ||
await poOmnichannelDepartments.inputSearch.fill(departmentName); | ||
|
||
await poOmnichannelDepartments.firstRowInTable.locator(`text=${departmentName}`).click(); | ||
await poOmnichannelDepartments.inputName.fill(`edited-${departmentName}`); | ||
await poOmnichannelDepartments.btnSave.click(); | ||
|
||
await poOmnichannelDepartments.inputSearch.fill(`edited-${departmentName}`); | ||
await expect(poOmnichannelDepartments.firstRowInTable).toBeVisible(); | ||
}); | ||
|
||
test.describe('Tags', () => { | ||
test.beforeEach(async () => { | ||
await poOmnichannelDepartments.inputSearch.fill(departmentName); | ||
await poOmnichannelDepartments.firstRowInTable.locator(`text=${departmentName}`).click(); | ||
}); | ||
|
||
test('expect save form button be disabled', async () => { | ||
await expect(poOmnichannelDepartments.btnSave).toBeDisabled(); | ||
}); | ||
|
||
test('Disabled tags state', async () => { | ||
await test.step('expect to have department tags toggle button', async () => { | ||
await expect(poOmnichannelDepartments.toggleRequestTags).toBeVisible(); | ||
}); | ||
await test.step('expect have no add tag to department', async () => { | ||
await expect(poOmnichannelDepartments.inputTags).not.toBeVisible(); | ||
await expect(poOmnichannelDepartments.btnTagsAdd).not.toBeVisible(); | ||
}); | ||
}); | ||
|
||
await poOmnichannelDepartaments.firstRowInTable.locator(`text=${departmentName}`).click(); | ||
await poOmnichannelDepartaments.inputName.fill(`edited-${departmentName}`); | ||
await poOmnichannelDepartaments.btnSave.click(); | ||
test('Enabled tags state', async ({ page }) => { | ||
await test.step('expect to have form save option disabled', async () => { | ||
await expect(poOmnichannelDepartments.btnSave).toBeDisabled(); | ||
}); | ||
|
||
await poOmnichannelDepartaments.inputSearch.fill(`edited-${departmentName}`); | ||
await expect(poOmnichannelDepartaments.firstRowInTable).toBeVisible(); | ||
await test.step('expect clicking on toggle button to enable tags', async () => { | ||
await poOmnichannelDepartments.toggleRequestTags.click(); | ||
await expect(poOmnichannelDepartments.inputTags).toBeVisible(); | ||
await expect(poOmnichannelDepartments.btnTagsAdd).toBeVisible(); | ||
}); | ||
await test.step('expect to be invalid if there is no tag added', async () => { | ||
await expect(poOmnichannelDepartments.btnSave).toBeDisabled(); | ||
await expect(poOmnichannelDepartments.invalidInputTags).toBeVisible(); | ||
}); | ||
|
||
await test.step('expect to be not possible adding empty tags', async () => { | ||
await poOmnichannelDepartments.inputTags.fill(''); | ||
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled(); | ||
}); | ||
|
||
await test.step('expect to have add and remove one tag properly tags', async () => { | ||
const tagName = faker.datatype.string(5); | ||
await poOmnichannelDepartments.inputTags.fill(tagName); | ||
await poOmnichannelDepartments.btnTagsAdd.click(); | ||
|
||
await expect(page.locator(`button`, { hasText: tagName })).toBeVisible(); | ||
|
||
await expect(poOmnichannelDepartments.btnSave).toBeEnabled(); | ||
|
||
await page.locator(`button`, { hasText: tagName }).click(); | ||
await expect(poOmnichannelDepartments.invalidInputTags).toBeVisible(); | ||
await expect(poOmnichannelDepartments.btnSave).toBeDisabled(); | ||
}); | ||
await test.step('expect to not be possible adding same tag twice', async () => { | ||
const tagName = faker.datatype.string(5); | ||
await poOmnichannelDepartments.inputTags.fill(tagName); | ||
await poOmnichannelDepartments.btnTagsAdd.click(); | ||
await poOmnichannelDepartments.inputTags.fill(tagName); | ||
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled(); | ||
}); | ||
}); | ||
}); | ||
|
||
test('expect delete department', async () => { | ||
await poOmnichannelDepartaments.inputSearch.fill(`edited-${departmentName}`); | ||
test('expect delete department', async ({ page }) => { | ||
await expect(poOmnichannelDepartments.firstRowInTable).toBeVisible(); | ||
|
||
await poOmnichannelDepartments.inputSearch.fill(`edited-${departmentName}`); | ||
|
||
await page.waitForRequest('**/livechat/department**'); | ||
|
||
await poOmnichannelDepartments.btnDeleteFirstRowInTable.click(); | ||
await poOmnichannelDepartments.btnModalConfirmDelete.click(); | ||
|
||
await poOmnichannelDepartaments.btnDeletefirstRowInTable.click(); | ||
await poOmnichannelDepartaments.btnModalConfirmDelete.click(); | ||
await poOmnichannelDepartments.inputSearch.fill(`edited-${departmentName}`); | ||
|
||
await poOmnichannelDepartaments.inputSearch.fill(`edited-${departmentName}`); | ||
await expect(poOmnichannelDepartaments.firstRowInTable).toBeHidden(); | ||
await expect(poOmnichannelDepartments.firstRowInTable).toHaveCount(0); | ||
}); | ||
}); |
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
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