-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ACS-8951] [E2E] tags and categories e2es added in ACA #4210
Changes from all commits
0c0224b
2758c88
ab91c4c
02c84f8
15da386
c8287c0
49abaaf
516e6df
513528f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/*! | ||
Check failure on line 1 in e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts GitHub Actions / E2E Playwright - info-drawer[Info Drawer] › src/tests/file-folder-properties.e2e.ts:228:7 › Info Drawer - File Folder Properties › [XAT-17241] Add a new category to a node
Check failure on line 1 in e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts GitHub Actions / E2E Playwright - info-drawer[Info Drawer] › src/tests/file-folder-properties.e2e.ts:228:7 › Info Drawer - File Folder Properties › [XAT-17241] Add a new category to a node
|
||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Alfresco Example Content Application | ||
|
@@ -23,13 +23,64 @@ | |
*/ | ||
|
||
import { expect } from '@playwright/test'; | ||
import { ApiClientFactory, Utils, test, TrashcanApi, NodesApi, FileActionsApi } from '@alfresco/aca-playwright-shared'; | ||
import { | ||
ApiClientFactory, | ||
Utils, | ||
test, | ||
TrashcanApi, | ||
NodesApi, | ||
FileActionsApi, | ||
TagsApi, | ||
CategoriesApi, | ||
PersonalFilesPage | ||
} from '@alfresco/aca-playwright-shared'; | ||
|
||
test.describe('Info Drawer - File Folder Properties', () => { | ||
let nodesApi: NodesApi; | ||
let trashcanApi: TrashcanApi; | ||
let fileActionsApi: FileActionsApi; | ||
let tagsApi: TagsApi; | ||
let categoriesApi: CategoriesApi; | ||
let responseCategoryId: string; | ||
let responseTagsId: string; | ||
let Folder17239Id: string; | ||
let Folder17240Id: string; | ||
let Folder17242Id: string; | ||
const username = `user-e2e-${Utils.random()}`; | ||
const manualTagName = `e2e-tag-${Utils.random()}`; | ||
const FolderC299162 = `C299162-e2e-${Utils.random()}`; | ||
const FolderC599174 = `C599174-e2e-${Utils.random()}`; | ||
const Folder17238 = `xat-17238-e2e-${Utils.random()}`; | ||
const Folder17239 = `xat-17239-e2e-${Utils.random()}`; | ||
const Folder17240 = `xat-17240-e2e-${Utils.random()}`; | ||
const Folder17241 = `xat-17241-e2e-${Utils.random()}`; | ||
const Folder17242 = `xat-17242-e2e-${Utils.random()}`; | ||
const Folder17243 = `xat-17243-e2e-${Utils.random()}`; | ||
const Folder17244 = `xat-17244-e2e-${Utils.random()}`; | ||
const tagBody = { tag: `tag-${Utils.random()}` }; | ||
const categoryName = Utils.random(); | ||
const noCategoriesText = 'There are currently no categories added'; | ||
const noTagsText = 'There are currently no tags added'; | ||
|
||
async function createCategoryGetId(): Promise<string> { | ||
const createdCategory = await categoriesApi.createCategory(`-root-`, [{ name: categoryName }]); | ||
if ('entry' in createdCategory) { | ||
return createdCategory.entry.id; | ||
} else { | ||
console.error('Unexpected response format:', createdCategory); | ||
return null; | ||
} | ||
} | ||
|
||
async function createTagGetId(): Promise<string> { | ||
const createdTag = await tagsApi.createTags([tagBody]); | ||
if ('entry' in createdTag) { | ||
return (createdTag as { entry: { id: string } }).entry.id; | ||
} else { | ||
console.error('Unexpected response format:', createdTag); | ||
return null; | ||
} | ||
} | ||
|
||
test.beforeAll(async () => { | ||
try { | ||
|
@@ -39,6 +90,24 @@ | |
nodesApi = await NodesApi.initialize(username, username); | ||
trashcanApi = await TrashcanApi.initialize(username, username); | ||
fileActionsApi = await FileActionsApi.initialize(username, username); | ||
tagsApi = await TagsApi.initialize('admin'); | ||
categoriesApi = await CategoriesApi.initialize('admin'); | ||
responseCategoryId = await createCategoryGetId(); | ||
responseTagsId = await createTagGetId(); | ||
|
||
if (responseCategoryId === null || responseTagsId === null) { | ||
throw new Error('Failed to create category or tag - check API manually'); | ||
} | ||
|
||
await nodesApi.createFolder(FolderC299162); | ||
await nodesApi.createFolder(FolderC599174); | ||
await nodesApi.createFolder(Folder17238); | ||
Folder17239Id = (await nodesApi.createFolder(Folder17239)).entry.id; | ||
Folder17240Id = (await nodesApi.createFolder(Folder17240)).entry.id; | ||
await nodesApi.createFolder(Folder17241); | ||
Folder17242Id = (await nodesApi.createFolder(Folder17242)).entry.id; | ||
await nodesApi.createFolder(Folder17243); | ||
await nodesApi.createFolder(Folder17244); | ||
} catch (error) { | ||
console.error(`beforeAll failed : ${error}`); | ||
} | ||
|
@@ -50,41 +119,151 @@ | |
|
||
test.afterAll(async () => { | ||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); | ||
await categoriesApi.deleteCategory(responseCategoryId); | ||
await tagsApi.deleteTag(responseTagsId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, please check if properly. |
||
}); | ||
|
||
test('[C299162] View properties - Default tabs', async ({ personalFiles }) => { | ||
const defaultTabsFolderName = `defaultTabsFolder-e2e-${Utils.random()}`; | ||
await nodesApi.createFolder(defaultTabsFolderName); | ||
await fileActionsApi.waitForNodes(defaultTabsFolderName, { expect: 1 }); | ||
async function navigateAndOpenInfoDrawer(personalFiles: PersonalFilesPage, folderName: string) { | ||
await fileActionsApi.waitForNodes(folderName, { expect: 1 }); | ||
await personalFiles.navigate(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, defaultTabsFolderName); | ||
await expect(personalFiles.dataTable.getRowByName(defaultTabsFolderName)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(defaultTabsFolderName).click(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, folderName); | ||
await expect(personalFiles.dataTable.getRowByName(folderName)).toBeVisible(); | ||
Check failure on line 130 in e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts GitHub Actions / E2E Playwright - info-drawer[Info Drawer] › src/tests/file-folder-properties.e2e.ts:228:7 › Info Drawer - File Folder Properties › [XAT-17241] Add a new category to a node
|
||
await personalFiles.dataTable.getRowByName(folderName).click(); | ||
await personalFiles.acaHeader.viewDetails.click(); | ||
} | ||
|
||
async function waitForTagToBeAdded(folderId: string, personalFiles: PersonalFilesPage, maxRetries: number) { | ||
let retries = 0; | ||
|
||
while ((await tagsApi.listTagsForNode(folderId)).list.entries.length === 0) { | ||
if (retries >= maxRetries) { | ||
throw new Error('Tag was not added within the expected time frame.'); | ||
} | ||
await personalFiles.page.waitForTimeout(1000); | ||
retries++; | ||
} | ||
} | ||
|
||
expect(await personalFiles.infoDrawer.getHeaderTitle()).toEqual(defaultTabsFolderName); | ||
test('[C299162] View properties - Default tabs', async ({ personalFiles }) => { | ||
await navigateAndOpenInfoDrawer(personalFiles, FolderC299162); | ||
expect(await personalFiles.infoDrawer.getHeaderTitle()).toEqual(FolderC299162); | ||
await expect(personalFiles.infoDrawer.propertiesTab).toBeVisible(); | ||
await expect(personalFiles.infoDrawer.commentsTab).toBeVisible(); | ||
expect(await personalFiles.infoDrawer.getTabsCount()).toEqual(2); | ||
}); | ||
|
||
test('[C599174] View properties - Should be able to make the files/folders info drawer expandable as for Sites', async ({ personalFiles }) => { | ||
const expandDetailsFolderName = `expandDetailsFolder-e2e-${Utils.random()}`; | ||
await nodesApi.createFolder(expandDetailsFolderName); | ||
await fileActionsApi.waitForNodes(expandDetailsFolderName, { expect: 1 }); | ||
await personalFiles.navigate(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, expandDetailsFolderName); | ||
await expect(personalFiles.dataTable.getRowByName(expandDetailsFolderName)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(expandDetailsFolderName).click(); | ||
await personalFiles.acaHeader.viewDetails.click(); | ||
|
||
await navigateAndOpenInfoDrawer(personalFiles, FolderC599174); | ||
await personalFiles.infoDrawer.expandDetailsButton.click(); | ||
await expect(personalFiles.infoDrawer.expandedDetailsPermissionsTab).toBeVisible(); | ||
|
||
await personalFiles.navigate(); | ||
await expect(personalFiles.dataTable.getRowByName(expandDetailsFolderName)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(expandDetailsFolderName).click({ button: 'right' }); | ||
await expect(personalFiles.dataTable.getRowByName(FolderC599174)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(FolderC599174).click({ button: 'right' }); | ||
await personalFiles.pagination.clickMenuItem('Permissions'); | ||
await expect(personalFiles.infoDrawer.expandedDetailsPermissionsTab).toBeVisible(); | ||
}); | ||
|
||
test('[XAT-17238] State for no tags and categories - accordion expanded', async ({ personalFiles }) => { | ||
await navigateAndOpenInfoDrawer(personalFiles, Folder17238); | ||
await personalFiles.infoDrawer.tagsAccordion.click(); | ||
await expect(personalFiles.infoDrawer.tagsAccordion).toContainText(noTagsText); | ||
|
||
await personalFiles.infoDrawer.categoriesAccordion.click(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordion).toContainText(noCategoriesText); | ||
}); | ||
|
||
test('[XAT-17239] Add a new tag to a node', async ({ personalFiles }) => { | ||
await navigateAndOpenInfoDrawer(personalFiles, Folder17239); | ||
await personalFiles.infoDrawer.tagsAccordionPenButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionPenButton).toBeHidden(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionCancelButton).toBeEnabled(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionConfirmButton).toBeDisabled(); | ||
await personalFiles.infoDrawer.tagsInput.fill(manualTagName); | ||
await personalFiles.infoDrawer.createTagButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsChips.first()).toContainText(manualTagName); | ||
await expect(personalFiles.infoDrawer.tagsChipsXButton.first()).toBeVisible(); | ||
await personalFiles.infoDrawer.tagsAccordionConfirmButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsChipsXButton.first()).toBeHidden(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionPenButton).toBeVisible(); | ||
|
||
await waitForTagToBeAdded(Folder17239Id, personalFiles, 10); | ||
const tagId = (await tagsApi.listTagsForNode(Folder17239Id)).list.entries[0].entry.id; | ||
await tagsApi.deleteTag(tagId); | ||
}); | ||
|
||
test('[XAT-17240] Remove a tag from a node', async ({ personalFiles }) => { | ||
await fileActionsApi.waitForNodes(Folder17240, { expect: 1 }); | ||
await tagsApi.assignTagToNode(Folder17240Id, tagBody); | ||
await personalFiles.navigate(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, Folder17240); | ||
await expect(personalFiles.dataTable.getRowByName(Folder17240)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(Folder17240).click(); | ||
await personalFiles.acaHeader.viewDetails.click(); | ||
|
||
await personalFiles.infoDrawer.tagsAccordion.click(); | ||
await expect(personalFiles.infoDrawer.tagsChipsXButton.first()).toBeHidden(); | ||
await personalFiles.infoDrawer.tagsAccordionPenButton.click(); | ||
await personalFiles.infoDrawer.tagsChipsXButton.first().click(); | ||
await personalFiles.infoDrawer.tagsAccordionConfirmButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsChips.first()).toBeHidden(); | ||
await expect(personalFiles.infoDrawer.tagsAccordion).toContainText(noTagsText); | ||
}); | ||
|
||
test('[XAT-17243] Cancel adding a tag to a node', async ({ personalFiles }) => { | ||
await fileActionsApi.waitForNodes(Folder17243, { expect: 1 }); | ||
await personalFiles.navigate(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, Folder17243); | ||
await expect(personalFiles.dataTable.getRowByName(Folder17243)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(Folder17243).click(); | ||
await personalFiles.acaHeader.viewDetails.click(); | ||
|
||
await personalFiles.infoDrawer.tagsAccordionPenButton.click(); | ||
await personalFiles.infoDrawer.tagsInput.fill(manualTagName); | ||
await personalFiles.infoDrawer.tagsAccordionCancelButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionPenButton).toBeVisible(); | ||
await expect(personalFiles.infoDrawer.tagsAccordion).toContainText(noTagsText); | ||
}); | ||
|
||
test('[XAT-17241] Add a new category to a node', async ({ personalFiles }) => { | ||
await navigateAndOpenInfoDrawer(personalFiles, Folder17241); | ||
await personalFiles.infoDrawer.categoriesAccordionPenButton.click(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordionPenButton).toBeHidden(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordionCancelButton).toBeEnabled(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordionConfirmButton).toBeDisabled(); | ||
await personalFiles.infoDrawer.categoriesInput.fill('*'); | ||
await personalFiles.infoDrawer.categoriesListItems.first().click(); | ||
await expect(personalFiles.infoDrawer.categoriesItemRemoveButton.first()).toBeVisible(); | ||
await personalFiles.infoDrawer.categoriesAccordionConfirmButton.click(); | ||
await expect(personalFiles.infoDrawer.tagsChipsXButton.first()).toBeHidden(); | ||
await expect(personalFiles.infoDrawer.tagsAccordionPenButton).toBeVisible(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordion).not.toContainText(noCategoriesText); | ||
await expect(personalFiles.infoDrawer.categoriesCreatedList.first()).toBeVisible(); | ||
}); | ||
|
||
test('[XAT-17242] Remove a category from a node', async ({ personalFiles }) => { | ||
await fileActionsApi.waitForNodes(Folder17242, { expect: 1 }); | ||
await categoriesApi.linkNodeToCategory(Folder17242Id, [{ categoryId: responseCategoryId }]); | ||
await personalFiles.navigate(); | ||
await Utils.reloadPageIfRowNotVisible(personalFiles, Folder17242); | ||
await expect(personalFiles.dataTable.getRowByName(Folder17242)).toBeVisible(); | ||
await personalFiles.dataTable.getRowByName(Folder17242).click(); | ||
await personalFiles.acaHeader.viewDetails.click(); | ||
|
||
await personalFiles.infoDrawer.categoriesAccordion.click(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordion).not.toContainText(noCategoriesText); | ||
await personalFiles.infoDrawer.categoriesAccordionPenButton.click(); | ||
await personalFiles.infoDrawer.categoriesItemRemoveButton.first().click(); | ||
await personalFiles.infoDrawer.categoriesAccordionConfirmButton.click(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordion).toContainText(noCategoriesText); | ||
}); | ||
|
||
test('[XAT-17244] Cancel adding a category to a node', async ({ personalFiles }) => { | ||
await navigateAndOpenInfoDrawer(personalFiles, Folder17244); | ||
await personalFiles.infoDrawer.categoriesAccordionPenButton.click(); | ||
await personalFiles.infoDrawer.categoriesInput.fill('*'); | ||
await personalFiles.infoDrawer.categoriesListItems.first().click(); | ||
await personalFiles.infoDrawer.categoriesAccordionCancelButton.click(); | ||
await expect(personalFiles.infoDrawer.categoriesAccordion).toContainText(noCategoriesText); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
responseCategoryId
might be null if error will happenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, please check if properly.