[ACS-6510] playwright List View e2e test (#3566)

* [ACS-6435] playwright e2e for list views personal files

* e2e test for trash page

* e2e test for trash page

* e2e test for file-libraries page

* e2e test for file-libraries page fix

* e2e test for file-libraries page fix

* e2e test shared recent  page

* e2e test shared recent  page fix

* e2e test review comment fix

* e2e test review fix flaky test fix

* e2e test fail test fix

* e2e test fail  fix

* test code fix

* protractor list-view test enable

* [ACS-6510] listview playwright e2e test

* code fix

* code fix

* code fix

* code fix

* code fix

* code fix

* code fix for review

* code fix for review
This commit is contained in:
Akash Rathod
2023-12-22 09:36:32 +01:00
committed by GitHub
parent 1d0752ce8f
commit 7465bbbf6d
20 changed files with 859 additions and 817 deletions

View File

@@ -0,0 +1,78 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, Utils, test } from '@alfresco/playwright-shared';
test.describe('Empty list views', () => {
const username = `user-${Utils.random()}`;
test.beforeAll(async () => {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
});
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test('[C217099] empty My Libraries', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
expect(await myLibrariesPage.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await myLibrariesPage.dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
expect(await myLibrariesPage.dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
});
test('[C280134] [C280120] Empty Trash - pagination controls not displayed', async ({ trashPage }) => {
await trashPage.navigate();
expect(await trashPage.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await trashPage.dataTable.getEmptyStateTitle()).toContain('Trash is empty');
expect(await trashPage.dataTable.getEmptyListText()).toContain('Items you delete are moved to the Trash.');
expect(await trashPage.dataTable.getEmptyListText()).toContain('Empty Trash to permanently delete items.');
expect(await trashPage.pagination.isRangePresent(), 'Range is present').toBe(false);
expect(await trashPage.pagination.isMaxItemsPresent(), 'Max items is present').toBe(false);
});
test('[C290123] [C290031] Empty Search results - pagination controls not displayed', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor('InvalidText');
await searchPage.reload({ waitUntil: 'domcontentloaded' });
await searchPage.dataTable.spinnerWaitForReload();
expect(await personalFiles.pagination.isRangePresent(), 'Range is present').toBe(false);
expect(await personalFiles.pagination.isMaxItemsPresent(), 'Max items is present').toBe(false);
expect(await personalFiles.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await personalFiles.dataTable.emptySearchText.innerText()).toContain('Your search returned 0 results');
});
});

View File

@@ -0,0 +1,99 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, NodesApi, TrashcanApi, Utils, test } from '@alfresco/playwright-shared';
test.describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
const username2 = `user2-${Utils.random()}`;
let parentId: string;
let file1Id: string;
let file2Id: string;
let actionUser: NodesApi;
test.beforeAll(async () => {
try {
const parent = `folder-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`;
const file2 = `file2-${Utils.random()}.txt`;
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
await apiClientFactory.createUser({ username: username2 });
actionUser = await NodesApi.initialize(username, username);
parentId = (await actionUser.createFolder(parent)).entry.id;
file1Id = (await actionUser.createFile(file1, parentId)).entry.id;
file2Id = (await actionUser.createFile(file2, parentId)).entry.id;
} catch (error) {
console.error(`----- beforeAll failed : ${error}`);
}
});
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test.afterAll(async () => {
actionUser = await NodesApi.initialize(username, username);
const trashcanApi = await TrashcanApi.initialize(username, username);
await actionUser.deleteNodeById(parentId);
await trashcanApi.emptyTrashcan();
});
test('[C217313] File / folder not found', async ({ personalFiles }) => {
await actionUser.deleteNodeById(file1Id, false);
await personalFiles.navigate({ remoteUrl: `#/personal-files/${file1Id}` });
expect(await personalFiles.errorDialog.genericError.isVisible(), 'Generic error page not displayed').toBe(true);
expect(await personalFiles.errorDialog.genericErrorTitle.innerText()).toContain(
`This item no longer exists or you don't have permission to view it.`
);
});
test('[C217314] Permission denied', async ({ personalFiles, loginPage }) => {
await loginPage.logoutUser();
await loginPage.loginUser(
{ username: username2, password: username2 },
{
withNavigation: true,
waitForLoading: true
}
);
await personalFiles.navigate({ remoteUrl: `#/personal-files/${file2Id}` });
expect(await personalFiles.errorDialog.genericError.isVisible(), 'Generic error page not displayed').toBe(true);
expect(await personalFiles.errorDialog.genericErrorTitle.innerText()).toContain(
`This item no longer exists or you don't have permission to view it.`
);
});
});

View File

@@ -0,0 +1,205 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import {
ApiClientFactory,
FavoritesPageApi,
FileActionsApi,
LoginPage,
NodesApi,
SharedLinksApi,
SitesApi,
Utils,
test,
timeouts
} from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('Special permissions', () => {
const username = `userPermissions-${Utils.random()}`;
let siteApiAdmin: SitesApi;
test.beforeAll(async () => {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
});
test.describe('file not displayed if user no longer has permissions on it', () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
test.beforeAll(async () => {
test.setTimeout(timeouts.webServer);
const userFavoritesApi = await FavoritesPageApi.initialize(username, username);
const userFileActionApi = await FileActionsApi.initialize(username, username);
siteApiAdmin = await SitesApi.initialize('admin');
const nodeApiAdmin = await NodesApi.initialize('admin');
const shareApiAdmin = await SharedLinksApi.initialize('admin');
const shareApiUser = await SharedLinksApi.initialize(username, username);
await siteApiAdmin.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE);
await siteApiAdmin.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
const docLibId = await siteApiAdmin.getDocLibId(sitePrivate);
const fileId = (await nodeApiAdmin.createFile(fileName, docLibId)).entry.id;
await shareApiAdmin.shareFileById(fileId);
await userFavoritesApi.addFavoriteById('file', fileId);
await userFileActionApi.updateNodeContent(fileId, 'edited by user');
await userFileActionApi.waitForNodes(username, { expect: 1 });
await shareApiAdmin.waitForFilesToBeShared([fileId]);
await shareApiUser.waitForFilesToBeShared([fileId]);
});
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test.afterEach(async () => {
await siteApiAdmin.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
});
test.afterAll(async () => {
await siteApiAdmin.deleteSites([sitePrivate]);
});
test('[C213173] on Recent Files', async ({ recentFilesPage }) => {
await recentFilesPage.navigate();
expect(await recentFilesPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await recentFilesPage.reload();
expect(await recentFilesPage.dataTable.isEmpty(), 'Items are still displayed').toBe(true);
});
test('[C213227] on Favorites', async ({ favoritePage }) => {
await favoritePage.navigate();
expect(await favoritePage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await favoritePage.reload();
expect(await favoritePage.dataTable.isEmpty(), 'Items are still displayed').toBe(true);
});
test('[C213116] on Shared Files', async ({ sharedPage }) => {
await sharedPage.navigate();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await sharedPage.reload();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(0);
});
test('[C290122] on Search Results', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor(fileName);
await searchPage.dataTable.spinnerWaitForReload();
expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await searchPage.reload();
await searchPage.dataTable.spinnerWaitForReload();
expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(0);
});
});
test.describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let adminSiteApiActions: SitesApi;
test.beforeAll(async () => {
test.setTimeout(timeouts.webServer);
const userFavoritesApi = await FavoritesPageApi.initialize(username, username);
const userShareActionApi = await SharedLinksApi.initialize(username, username);
const userNodeActionApi = await NodesApi.initialize(username, username);
adminSiteApiActions = await SitesApi.initialize('admin');
await adminSiteApiActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE);
await adminSiteApiActions.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
const docLibId = await adminSiteApiActions.getDocLibId(sitePrivate);
const fileId = (await userNodeActionApi.createFile(fileName, docLibId)).entry.id;
await userFavoritesApi.addFavoriteById('file', fileId);
await userShareActionApi.shareFileById(fileId);
await userShareActionApi.waitForFilesToBeShared([fileId]);
await adminSiteApiActions.deleteSiteMember(sitePrivate, username);
});
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test.afterAll(async () => {
await adminSiteApiActions.deleteSites([sitePrivate]);
});
test('[C213178] on Recent Files', async ({ recentFilesPage }) => {
await recentFilesPage.navigate();
expect(await recentFilesPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await recentFilesPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});
test('[C213672] on Favorites', async ({ favoritePage }) => {
await favoritePage.navigate();
expect(await favoritePage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await favoritePage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});
test(`[C213668] on Shared Files`, async ({ sharedPage }) => {
await sharedPage.navigate();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await sharedPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});
test('[C306868] on Search results', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor(fileName);
await searchPage.dataTable.spinnerWaitForReload();
expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await searchPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});
});
});

View File

@@ -0,0 +1,265 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import {
ApiClientFactory,
FavoritesPageApi,
FileActionsApi,
NodesApi,
PersonalFilesPage,
TEST_FILES,
Utils,
test,
timeouts
} from '@alfresco/playwright-shared';
async function getSortState(myPersonalFiles: PersonalFilesPage): Promise<{ [key: string]: string }> {
return {
sortingColumn: await myPersonalFiles.dataTable.getSortedColumnHeaderText(),
sortingOrder: await myPersonalFiles.dataTable.getSortingOrder(),
firstElement: await myPersonalFiles.dataTable.getFirstElementDetail('Name')
};
}
test.describe('Remember sorting', () => {
const user1 = `userSort1-${Utils.random()}`;
const user2 = `userSort2-${Utils.random()}`;
const pdfFileNames = [...new Array(14).fill(100)].map((v, i) => `file-${v + i}.pdf`);
const jpgFileNames = [...new Array(12).fill(114)].map((v, i) => `file-${v + i}.jpg`);
const folderToMove = `folder1`;
const folderToContain = `folder2`;
const uiCreatedFolder = `folder3`;
const testData = {
user1: {
files: {
jpg: jpgFileNames,
pdf: pdfFileNames
}
},
user2: {
files: [pdfFileNames[0], jpgFileNames[0]]
}
};
let initialSortState: { [key: string]: string };
let nodeActionUser1: NodesApi;
test.beforeAll(async () => {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username: user1 });
await apiClientFactory.createUser({ username: user2 });
const fileActionUser1 = await FileActionsApi.initialize(user1, user1);
const fileActionUser2 = await FileActionsApi.initialize(user2, user2);
const favoritesActions = await FavoritesPageApi.initialize(user1, user1);
nodeActionUser1 = await NodesApi.initialize(user1, user1);
const filesIdsUser1: { [key: string]: string } = {};
const filesIdsUser2: { [key: string]: string } = {};
await Promise.all(
testData.user1.files.pdf.map(
async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id)
)
);
await Promise.all(
testData.user1.files.jpg.map(
async (i) => (filesIdsUser1[i] = (await fileActionUser1.uploadFileWithRename(TEST_FILES.JPG_FILE.path, i, '-my-')).entry.id)
)
);
await Promise.all(
testData.user2.files.map(
async (i) => (filesIdsUser2[i] = (await fileActionUser2.uploadFileWithRename(TEST_FILES.PDF.path, i, '-my-')).entry.id)
)
);
await favoritesActions.addFavoritesByIds('file', [filesIdsUser1[pdfFileNames[0]], filesIdsUser1[pdfFileNames[1]]]);
});
test.beforeEach(async ({ loginPage, personalFiles }) => {
await NodesApi.initialize(user1, user1);
await loginPage.loginUser(
{ username: user1, password: user1 },
{
withNavigation: true,
waitForLoading: true
}
);
await personalFiles.dataTable.sortBy('Name', 'asc');
await personalFiles.dataTable.spinnerWaitForReload();
initialSortState = await getSortState(personalFiles);
});
test.afterAll(async () => {
nodeActionUser1 = await NodesApi.initialize(user1, user1);
const nodeActionUser2 = await NodesApi.initialize(user2, user2);
await nodeActionUser1.deleteCurrentUserNodes();
await nodeActionUser2.deleteCurrentUserNodes();
});
test('[C261136] Sort order is retained when navigating to another part of the app', async ({ personalFiles, favoritePage }) => {
await personalFiles.dataTable.sortBy('Name', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
const expectedSortData = await getSortState(personalFiles);
expect(expectedSortData).not.toEqual(initialSortState);
await favoritePage.navigate();
await personalFiles.navigate();
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).toEqual(expectedSortData);
});
test('[C589205] Size sort order is retained after viewing a file and closing the viewer', async ({ personalFiles }) => {
await personalFiles.dataTable.sortBy('Size', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
const expectedSortData = await getSortState(personalFiles);
await personalFiles.dataTable.performClickFolderOrFileToOpen(expectedSortData.firstElement);
await personalFiles.viewer.closeButtonLocator.click();
await personalFiles.waitForPageLoad();
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).toEqual(expectedSortData);
});
test('[C261153] Sort order should be remembered separately on each list view', async ({ personalFiles, favoritePage }) => {
await personalFiles.dataTable.sortBy('Size', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
const personalFilesSortData = await getSortState(personalFiles);
await favoritePage.navigate();
await favoritePage.dataTable.sortBy('Name', 'asc');
await favoritePage.dataTable.spinnerWaitForReload();
const favouritesSortData = await getSortState(personalFiles);
expect(favouritesSortData).not.toEqual(personalFilesSortData);
await personalFiles.navigate();
const personalFilesSortDataAfterFavSort = await getSortState(personalFiles);
expect(personalFilesSortDataAfterFavSort).toEqual(personalFilesSortData);
});
test('[C261147] Sort order is retained when user changes the page from pagination', async ({ personalFiles }) => {
const lastFileInArray = testData.user1.files.jpg.slice(-1).pop();
const firstFileInArray = testData.user1.files.pdf[0];
await personalFiles.pagination.clickOnNextPage();
await personalFiles.dataTable.spinnerWaitForReload();
let expectedPersonalFilesSortDataPage2 = {
sortingColumn: 'Name',
sortingOrder: 'asc',
firstElement: lastFileInArray
};
let currentPersonalFilesSortDataPage2 = await getSortState(personalFiles);
expect(currentPersonalFilesSortDataPage2).toEqual(expectedPersonalFilesSortDataPage2);
await personalFiles.dataTable.sortBy('Name', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
expectedPersonalFilesSortDataPage2 = {
sortingColumn: 'Name',
sortingOrder: 'desc',
firstElement: firstFileInArray
};
currentPersonalFilesSortDataPage2 = await getSortState(personalFiles);
expect(expectedPersonalFilesSortDataPage2).toEqual(currentPersonalFilesSortDataPage2);
});
test.describe('Folder actions', () => {
test.beforeAll(async () => {
const folderIds: { [key: string]: string } = {};
folderIds[folderToContain] = (await nodeActionUser1.createFolder(folderToContain)).entry.id;
folderIds[folderToMove] = (await nodeActionUser1.createFolder(folderToMove)).entry.id;
});
test('[C261138] Sort order is retained when creating a new folder', async ({ personalFiles }) => {
await personalFiles.dataTable.sortBy('Name', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
const expectedSortData = {
sortingColumn: await personalFiles.dataTable.getSortedColumnHeaderText(),
sortingOrder: await personalFiles.dataTable.getSortingOrder(),
firstElement: uiCreatedFolder
};
await personalFiles.selectCreateFolder();
await personalFiles.folderDialog.createNewFolderDialog(uiCreatedFolder);
await personalFiles.dataTable.isItemPresent(uiCreatedFolder);
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).toEqual(expectedSortData);
});
test('[C261139] Sort order is retained when moving a file', async ({ personalFiles }) => {
const expectedSortData = {
sortingColumn: await personalFiles.dataTable.getSortedColumnHeaderText(),
sortingOrder: await personalFiles.dataTable.getSortingOrder(),
firstElement: folderToContain
};
await personalFiles.copyOrMoveContentInDatatable([folderToMove], folderToContain, 'Move');
await personalFiles.dataTable.spinnerWaitForReload();
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).toEqual(expectedSortData);
});
});
test.describe('User Tests', () => {
test('[C261137] Size sort order is retained when user logs out and logs back in', async ({ personalFiles, loginPage }) => {
await personalFiles.dataTable.sortBy('Name', 'desc');
await personalFiles.dataTable.spinnerWaitForReload();
const expectedSortData = await getSortState(personalFiles);
expect(expectedSortData).not.toEqual(initialSortState);
await loginPage.logoutUser();
await FileActionsApi.initialize(user1, user1);
await loginPage.loginUser({ username: user1, password: user1 }, { withNavigation: true, waitForLoading: true });
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).toEqual(expectedSortData);
});
test('[C261150] Sort order is not retained between different users', async ({ personalFiles, loginPage }) => {
await personalFiles.dataTable.sortBy('Size', 'asc');
await personalFiles.dataTable.spinnerWaitForReload();
const expectedSortData = await getSortState(personalFiles);
await loginPage.logoutUser();
await FileActionsApi.initialize(user2, user2);
await loginPage.loginUser(
{ username: user2, password: user2 },
{
withNavigation: true,
waitForLoading: true
}
);
const actualSortData = await getSortState(personalFiles);
expect(actualSortData).not.toEqual(expectedSortData);
});
});
});

View File

@@ -0,0 +1,63 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { expect } from '@playwright/test';
import { ApiClientFactory, NodesApi, Utils, getUserState, test } from '@alfresco/playwright-shared';
test.use({ storageState: getUserState('admin') });
test.describe('Trash admin', () => {
const folderAdmin = `deleteFolder-${Utils.random()}`;
let folderAdminId: string;
let adminApiActions: NodesApi;
test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
adminApiActions = await NodesApi.initialize('admin');
folderAdminId = (await adminApiActions.createFolder(folderAdmin)).entry.id;
await adminApiActions.deleteNodeById(folderAdminId, false);
} catch (error) {
console.error(`----- beforeAll failed : ${error}`);
}
});
test.afterAll(async () => {
try {
await adminApiActions.deleteDeletedNode(folderAdminId);
} catch (error) {
console.error(`----- afterAll failed : ${error}`);
}
});
test.describe('as admin', () => {
test('[C213217] has the correct columns', async ({ trashPage }) => {
await trashPage.navigate();
const expectedColumns = ['Name', 'Location', 'Size', 'Deleted', 'Deleted by'];
const actualColumns = await trashPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
});
});