mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[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:
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"C589205": "https://alfresco.atlassian.net/browse/ACA-4353",
|
||||
"C261153": "https://alfresco.atlassian.net/browse/AAE-7517",
|
||||
"C306959": "https://alfresco.atlassian.net/browse/ACA-4620",
|
||||
"C213134": "temp, see https://alfresco.atlassian.net/browse/ACS-5189",
|
||||
|
@@ -37,13 +37,6 @@ describe('Empty list views', () => {
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
it('[C217099] empty My Libraries', async () => {
|
||||
await page.goToMyLibraries();
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
|
||||
expect(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
|
||||
});
|
||||
|
||||
it('[C289911] empty Favorite Libraries', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
|
||||
@@ -65,14 +58,6 @@ describe('Empty list views', () => {
|
||||
expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite items that you want to easily find later.');
|
||||
});
|
||||
|
||||
it('[C280134] empty Trash', async () => {
|
||||
await page.clickTrash();
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.getEmptyStateTitle()).toContain('Trash is empty');
|
||||
expect(await dataTable.getEmptyListText()).toContain('Items you delete are moved to the Trash.');
|
||||
expect(await dataTable.getEmptyListText()).toContain('Empty Trash to permanently delete items.');
|
||||
});
|
||||
|
||||
it('[C280111] Favorites - pagination controls not displayed', async () => {
|
||||
await page.clickFavorites();
|
||||
expect(await pagination.isRangePresent()).toBe(false, 'Range is present');
|
||||
@@ -133,21 +118,6 @@ describe('Empty list views', () => {
|
||||
expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present');
|
||||
});
|
||||
|
||||
it('[C290123] Search results - pagination controls not displayed', async () => {
|
||||
await toolbar.clickSearchIconButton();
|
||||
await searchInput.clickSearchButton();
|
||||
/* cspell:disable-next-line */
|
||||
await searchInput.searchFor('qwertyuiop');
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expect(await pagination.isRangePresent()).toBe(false, 'Range is present');
|
||||
expect(await pagination.isMaxItemsPresent()).toBe(false, 'Max items is present');
|
||||
expect(await pagination.isCurrentPagePresent()).toBe(false, 'Current page is present');
|
||||
expect(await pagination.isTotalPagesPresent()).toBe(false, 'Total pages is present');
|
||||
expect(await pagination.isPreviousButtonPresent()).toBe(false, 'Previous button is present');
|
||||
expect(await pagination.isNextButtonPresent()).toBe(false, 'Next button is present');
|
||||
});
|
||||
|
||||
it('[C290020] Empty Search results - Libraries', async () => {
|
||||
await page.goToMyLibraries();
|
||||
await toolbar.clickSearchIconButton();
|
||||
@@ -160,17 +130,4 @@ describe('Empty list views', () => {
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results');
|
||||
});
|
||||
|
||||
it('[C290031] Empty Search results - Files / Folders', async () => {
|
||||
await page.clickPersonalFiles();
|
||||
await toolbar.clickSearchIconButton();
|
||||
await searchInput.clickSearchButton();
|
||||
await searchInput.checkFilesAndFolders();
|
||||
/* cspell:disable-next-line */
|
||||
await searchInput.searchFor('qwertyuiop');
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results');
|
||||
});
|
||||
});
|
||||
|
@@ -1,104 +0,0 @@
|
||||
/*!
|
||||
* 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 { browser } from 'protractor';
|
||||
import { AdminActions, UserActions, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Generic errors', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const username2 = `user2-${Utils.random()}`;
|
||||
|
||||
const parent = `folder-${Utils.random()}`;
|
||||
let parentId: string;
|
||||
const file1 = `file1-${Utils.random()}.txt`;
|
||||
let file1Id: string;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await adminApiActions.createUser({ username });
|
||||
await adminApiActions.createUser({ username: username2 });
|
||||
await userActions.login(username, username);
|
||||
|
||||
parentId = await apis.user.createFolder(parent);
|
||||
file1Id = await apis.user.createFile(file1, parentId);
|
||||
await apis.user.nodes.createFile(file2, parentId);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
} catch (error) {
|
||||
Logger.error(`----- beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await userActions.login(username, username);
|
||||
await userActions.deleteNodes([parentId]);
|
||||
await userActions.emptyTrashcan();
|
||||
});
|
||||
|
||||
it('[C217313] File / folder not found', async () => {
|
||||
await page.clickPersonalFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(parent);
|
||||
await dataTable.doubleClickOnRowByName(file1);
|
||||
const URL = await browser.getCurrentUrl();
|
||||
await userActions.deleteNodes([file1Id], false);
|
||||
await browser.get(URL);
|
||||
|
||||
expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
|
||||
expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
|
||||
});
|
||||
|
||||
it('[C217315] Invalid URL', async () => {
|
||||
await page.load('/invalid page');
|
||||
|
||||
expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
|
||||
expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
|
||||
});
|
||||
|
||||
it('[C217314] Permission denied', async () => {
|
||||
await page.clickPersonalFilesAndWait();
|
||||
await dataTable.doubleClickOnRowByName(parent);
|
||||
await dataTable.doubleClickOnRowByName(file2);
|
||||
const URL = await browser.getCurrentUrl();
|
||||
await loginPage.loginWith(username2);
|
||||
await browser.get(URL);
|
||||
|
||||
expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed');
|
||||
expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
});
|
@@ -1,177 +0,0 @@
|
||||
/*!
|
||||
* 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 { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
|
||||
|
||||
describe('Special permissions', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable, toolbar } = page;
|
||||
const { searchInput } = page.pageLayoutHeader;
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
});
|
||||
|
||||
describe('file not displayed if user no longer has permissions on it', () => {
|
||||
const sitePrivate = `private-${Utils.random()}`;
|
||||
const fileName = `file-${Utils.random()}.txt`;
|
||||
let fileId: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.login();
|
||||
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
|
||||
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
|
||||
fileId = (await adminApiActions.nodes.createFile(fileName, docLibId)).entry.id;
|
||||
await apis.user.favorites.addFavoriteById('file', fileId);
|
||||
|
||||
await adminApiActions.login();
|
||||
await adminApiActions.shareNodes([fileId]);
|
||||
await apis.user.nodes.updateNodeContent(fileId, 'edited by user');
|
||||
|
||||
await apis.user.search.waitForApi(username, { expect: 1 });
|
||||
|
||||
await adminApiActions.login();
|
||||
await adminApiActions.shared.waitForFilesToBeShared([fileId]);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await adminApiActions.sites.deleteSite(sitePrivate);
|
||||
});
|
||||
|
||||
it('[C213173] on Recent Files', async () => {
|
||||
await page.clickRecentFilesAndWait();
|
||||
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
|
||||
await adminApiActions.sites.deleteSiteMember(sitePrivate, username);
|
||||
await page.refresh();
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed');
|
||||
});
|
||||
|
||||
it('[C213227] on Favorites', async () => {
|
||||
await page.clickFavoritesAndWait();
|
||||
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
|
||||
await adminApiActions.sites.deleteSiteMember(sitePrivate, username);
|
||||
await page.refresh();
|
||||
expect(await dataTable.isEmpty()).toBe(true, 'Items are still displayed');
|
||||
});
|
||||
|
||||
it('[C213116] on Shared Files', async () => {
|
||||
await page.clickSharedFilesAndWait();
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not displayed`);
|
||||
await adminApiActions.sites.deleteSiteMember(sitePrivate, username);
|
||||
await page.refresh();
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(false, `${fileName} is displayed`);
|
||||
});
|
||||
|
||||
it('[C290122] on Search Results', async () => {
|
||||
await toolbar.clickSearchIconButton();
|
||||
await searchInput.clickSearchButton();
|
||||
await searchInput.checkFilesAndFolders();
|
||||
await searchInput.searchFor(fileName);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} is not displayed`);
|
||||
|
||||
await adminApiActions.sites.deleteSiteMember(sitePrivate, username);
|
||||
|
||||
await searchInput.clickSearchButton();
|
||||
await searchInput.checkFilesAndFolders();
|
||||
await searchInput.searchFor(fileName);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(false, `${fileName} is displayed`);
|
||||
});
|
||||
});
|
||||
|
||||
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 fileId;
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
|
||||
await adminApiActions.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
const docLibId = await adminApiActions.sites.getDocLibId(sitePrivate);
|
||||
fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
|
||||
await apis.user.favorites.addFavoriteById('file', fileId);
|
||||
|
||||
await userActions.login(username, username);
|
||||
await userActions.shareNodes([fileId]);
|
||||
await apis.user.shared.waitForFilesToBeShared([fileId]);
|
||||
|
||||
await apis.user.search.waitForApi(username, { expect: 1 });
|
||||
await adminApiActions.sites.deleteSiteMember(sitePrivate, username);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await adminApiActions.sites.deleteSite(sitePrivate);
|
||||
});
|
||||
|
||||
it('[C213178] on Recent Files', async () => {
|
||||
await page.clickRecentFilesAndWait();
|
||||
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
|
||||
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
|
||||
});
|
||||
|
||||
it('[C213672] on Favorites', async () => {
|
||||
await page.clickFavoritesAndWait();
|
||||
expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items');
|
||||
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
|
||||
});
|
||||
|
||||
it(`[C213668] on Shared Files`, async () => {
|
||||
await page.clickSharedFilesAndWait();
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} not displayed`);
|
||||
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
|
||||
});
|
||||
|
||||
it('[C306868] on Search results', async () => {
|
||||
await toolbar.clickSearchIconButton();
|
||||
await searchInput.clickSearchButton();
|
||||
await searchInput.checkFilesAndFolders();
|
||||
await searchInput.searchFor(fileName);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expect(await dataTable.isItemPresent(fileName)).toBe(true, `${fileName} is not displayed`);
|
||||
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,348 +0,0 @@
|
||||
/*!
|
||||
* 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 { AdminActions, LoginPage, RepoClient, FILES, BrowsingPage, DataTable, CreateOrEditFolderDialog } from '@alfresco/aca-testing-shared';
|
||||
import { BrowserActions, ContentNodeSelectorDialogPage, DocumentListPage, PaginationPage, ViewerPage } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Remember sorting', () => {
|
||||
interface NodesIds {
|
||||
[index: string]: string;
|
||||
}
|
||||
|
||||
const timestamp = new Date().getTime();
|
||||
const user1 = `user1-${timestamp}`;
|
||||
const user2 = `user2-${timestamp}`;
|
||||
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 filesIdsUser1: NodesIds = {};
|
||||
const filesIdsUser2: NodesIds = {};
|
||||
const folderIds: NodesIds = {};
|
||||
|
||||
const testData = {
|
||||
user1: {
|
||||
files: {
|
||||
jpg: jpgFileNames,
|
||||
pdf: pdfFileNames
|
||||
}
|
||||
},
|
||||
user2: {
|
||||
files: [pdfFileNames[0], jpgFileNames[0]]
|
||||
}
|
||||
};
|
||||
|
||||
let initialSortState: {
|
||||
sortingColumn: string;
|
||||
sortingOrder: string;
|
||||
firstElement: string;
|
||||
};
|
||||
|
||||
const apis = {
|
||||
user1: new RepoClient(user1, user1),
|
||||
user2: new RepoClient(user2, user2)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const browsingPage = new BrowsingPage();
|
||||
const dataTable = new DataTable();
|
||||
const documentListPage = new DocumentListPage();
|
||||
const viewerPage = new ViewerPage();
|
||||
const adminApiActions = new AdminActions();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const contentNodeSelectorDialogPage = new ContentNodeSelectorDialogPage();
|
||||
const paginationPage = new PaginationPage();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username: user1 });
|
||||
await adminApiActions.createUser({ username: user2 });
|
||||
await Promise.all(
|
||||
testData.user1.files.pdf.map(
|
||||
async (i) => (filesIdsUser1[i] = (await apis.user1.upload.uploadFileWithRename(FILES.pdfFile, '-my-', i)).entry.id)
|
||||
)
|
||||
);
|
||||
await Promise.all(
|
||||
testData.user1.files.jpg.map(
|
||||
async (i) => (filesIdsUser1[i] = (await apis.user1.upload.uploadFileWithRename(FILES.jpgFile, '-my-', i)).entry.id)
|
||||
)
|
||||
);
|
||||
await Promise.all(
|
||||
testData.user2.files.map(async (i) => (filesIdsUser2[i] = (await apis.user2.upload.uploadFileWithRename(FILES.pdfFile, '-my-', i)).entry.id))
|
||||
);
|
||||
await apis.user1.favorites.addFavoritesByIds('file', [filesIdsUser1[pdfFileNames[0]], filesIdsUser1[pdfFileNames[1]]]);
|
||||
await loginPage.loginWith(user1);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await browsingPage.clickPersonalFilesAndWait();
|
||||
await dataTable.sortBy('Name', 'asc');
|
||||
await dataTable.waitForBody();
|
||||
initialSortState = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await Promise.all(Object.keys(filesIdsUser1).map((i) => apis.user1.nodes.deleteNodeById(filesIdsUser1[i])));
|
||||
await Promise.all(Object.keys(filesIdsUser2).map((i) => apis.user2.nodes.deleteNodeById(filesIdsUser2[i])));
|
||||
});
|
||||
|
||||
it('[C261136] Sort order is retained when navigating to another part of the app', async () => {
|
||||
await dataTable.sortBy('Name', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(expectedSortData).not.toEqual(initialSortState);
|
||||
|
||||
await browsingPage.clickFavorites();
|
||||
await browsingPage.clickPersonalFilesAndWait();
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).toEqual(expectedSortData);
|
||||
});
|
||||
|
||||
it('[C261137] Size sort order is retained when user logs out and logs back in', async () => {
|
||||
await dataTable.sortBy('Name', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(expectedSortData).not.toEqual(initialSortState);
|
||||
|
||||
await browsingPage.signOut();
|
||||
await loginPage.loginWith(user1);
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).toEqual(expectedSortData);
|
||||
});
|
||||
|
||||
describe('Folder actions', () => {
|
||||
beforeAll(async () => {
|
||||
folderIds[folderToContain] = (await apis.user1.nodes.createFolder(folderToContain)).entry.id;
|
||||
folderIds[folderToMove] = (await apis.user1.nodes.createFolder(folderToMove)).entry.id;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
folderIds[uiCreatedFolder] = await apis.user1.nodes.getNodeIdFromParent(uiCreatedFolder, '-my-');
|
||||
await Promise.all(Object.keys(folderIds).map((i) => apis.user1.nodes.deleteNodeById(folderIds[i])));
|
||||
});
|
||||
|
||||
it('[C261138] Sort order is retained when creating a new folder', async () => {
|
||||
await dataTable.sortBy('Name', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: uiCreatedFolder
|
||||
};
|
||||
|
||||
await browsingPage.sidenav.openCreateFolderDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(uiCreatedFolder);
|
||||
await BrowserActions.click(createDialog.createButton);
|
||||
await createDialog.waitForDialogToClose();
|
||||
await documentListPage.dataTable.checkRowContentIsDisplayed(uiCreatedFolder);
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).toEqual(expectedSortData);
|
||||
});
|
||||
|
||||
it('[C261139] Sort order is retained when moving a file', async () => {
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: folderToContain
|
||||
};
|
||||
|
||||
await browsingPage.dataTable.rightClickOnItem(folderToMove);
|
||||
await dataTable.menu.clickMenuItem('Move');
|
||||
await contentNodeSelectorDialogPage.clickContentNodeSelectorResult(folderToContain);
|
||||
await contentNodeSelectorDialogPage.clickMoveCopyButton();
|
||||
await documentListPage.dataTable.checkRowContentIsNotDisplayed(folderToMove);
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).toEqual(expectedSortData);
|
||||
});
|
||||
});
|
||||
|
||||
it('[C589205] Size sort order is retained after viewing a file and closing the viewer', async () => {
|
||||
await dataTable.sortBy('Size', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
await dataTable.doubleClickOnRowByName(expectedSortData.firstElement);
|
||||
await viewerPage.clickCloseButton();
|
||||
await browsingPage.clickPersonalFilesAndWait();
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).toEqual(expectedSortData);
|
||||
});
|
||||
|
||||
it('[C261153] Sort order should be remembered separately on each list view', async () => {
|
||||
await dataTable.sortBy('Size', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const personalFilesSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
await browsingPage.clickFavoritesAndWait();
|
||||
await dataTable.sortBy('Name', 'asc');
|
||||
await dataTable.waitForFirstElementToChange(personalFilesSortData.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const favouritesSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(favouritesSortData).not.toEqual(personalFilesSortData);
|
||||
|
||||
await browsingPage.clickPersonalFilesAndWait();
|
||||
|
||||
const personalFilesSortDataAfterFavSort = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(personalFilesSortDataAfterFavSort).toEqual(personalFilesSortData);
|
||||
});
|
||||
|
||||
it('[C261147] Sort order is retained when user changes the page from pagination', async () => {
|
||||
const lastFileInArray = testData.user1.files.jpg.slice(-1).pop();
|
||||
const firstFileInArray = testData.user1.files.pdf[0];
|
||||
|
||||
await paginationPage.clickOnNextPage();
|
||||
await dataTable.waitForBody();
|
||||
|
||||
let expectedPersonalFilesSortDataPage2 = {
|
||||
sortingColumn: 'Name',
|
||||
sortingOrder: 'asc',
|
||||
firstElement: lastFileInArray
|
||||
};
|
||||
|
||||
let currentPersonalFilesSortDataPage2 = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(currentPersonalFilesSortDataPage2).toEqual(expectedPersonalFilesSortDataPage2);
|
||||
|
||||
await dataTable.sortBy('Name', 'desc');
|
||||
await dataTable.waitForFirstElementToChange(currentPersonalFilesSortDataPage2.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
expectedPersonalFilesSortDataPage2 = {
|
||||
sortingColumn: 'Name',
|
||||
sortingOrder: 'desc',
|
||||
firstElement: firstFileInArray
|
||||
};
|
||||
|
||||
currentPersonalFilesSortDataPage2 = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(expectedPersonalFilesSortDataPage2).toEqual(currentPersonalFilesSortDataPage2);
|
||||
});
|
||||
|
||||
it('[C261150] Sort order is not retained between different users', async () => {
|
||||
await dataTable.sortBy('Size', 'asc');
|
||||
await dataTable.waitForFirstElementToChange(initialSortState.firstElement);
|
||||
await dataTable.waitForBody();
|
||||
|
||||
const expectedSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
await browsingPage.signOut();
|
||||
await loginPage.loginWith(user2);
|
||||
|
||||
const actualSortData = {
|
||||
sortingColumn: await dataTable.getSortedColumnHeaderText(),
|
||||
sortingOrder: await dataTable.getSortingOrder(),
|
||||
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
|
||||
};
|
||||
|
||||
expect(actualSortData).not.toEqual(expectedSortData);
|
||||
|
||||
await browsingPage.signOut();
|
||||
});
|
||||
});
|
@@ -1,123 +0,0 @@
|
||||
/*!
|
||||
* 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 { AdminActions, UserActions, SITE_VISIBILITY, SITE_ROLES, LoginPage, BrowsingPage, Utils, RepoClient } from '@alfresco/aca-testing-shared';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Trash', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const siteName = `site-${Utils.random()}`;
|
||||
const fileSite = `file-${Utils.random()}.txt`;
|
||||
let fileSiteId: string;
|
||||
|
||||
const folderAdmin = `folder-${Utils.random()}`;
|
||||
let folderAdminId: string;
|
||||
const fileAdmin = `file-${Utils.random()}.txt`;
|
||||
let fileAdminId: string;
|
||||
|
||||
const folderUser = `folder-${Utils.random()}`;
|
||||
let folderUserId: string;
|
||||
const fileUser = `file-${Utils.random()}.txt`;
|
||||
let fileUserId: string;
|
||||
|
||||
const folderDeleted = `folder-${Utils.random()}`;
|
||||
let folderDeletedId: string;
|
||||
const fileDeleted = `file-${Utils.random()}.txt`;
|
||||
let fileDeletedId: string;
|
||||
|
||||
const folderNotDeleted = `folder-${Utils.random()}`;
|
||||
let folderNotDeletedId: string;
|
||||
const fileInFolder = `file-${Utils.random()}.txt`;
|
||||
let fileInFolderId: string;
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await adminApiActions.createUser({ username });
|
||||
|
||||
fileAdminId = (await adminApiActions.nodes.createFiles([fileAdmin])).entry.id;
|
||||
folderAdminId = (await adminApiActions.nodes.createFolders([folderAdmin])).entry.id;
|
||||
await adminApiActions.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
|
||||
await adminApiActions.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
const docLibId = await adminApiActions.sites.getDocLibId(siteName);
|
||||
fileSiteId = (await adminApiActions.nodes.createFile(fileSite, docLibId)).entry.id;
|
||||
|
||||
await adminApiActions.nodes.deleteNodesById([fileAdminId, folderAdminId], false);
|
||||
|
||||
fileUserId = (await apis.user.nodes.createFiles([fileUser])).entry.id;
|
||||
folderUserId = (await apis.user.nodes.createFolders([folderUser])).entry.id;
|
||||
folderDeletedId = (await apis.user.nodes.createFolder(folderDeleted)).entry.id;
|
||||
fileDeletedId = (await apis.user.nodes.createFiles([fileDeleted], folderDeleted)).entry.id;
|
||||
folderNotDeletedId = (await apis.user.nodes.createFolder(folderNotDeleted)).entry.id;
|
||||
fileInFolderId = (await apis.user.nodes.createFiles([fileInFolder], folderNotDeleted)).entry.id;
|
||||
|
||||
await apis.user.nodes.deleteNodesById([fileSiteId, fileUserId, folderUserId, fileInFolderId, fileDeletedId, folderDeletedId], false);
|
||||
} catch (error) {
|
||||
Logger.error(`----- beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await adminApiActions.login();
|
||||
await adminApiActions.deleteSites([siteName]);
|
||||
await adminApiActions.trashcanApi.deleteDeletedNode(fileAdminId);
|
||||
await adminApiActions.trashcanApi.deleteDeletedNode(folderAdminId);
|
||||
|
||||
await userActions.login(username, username);
|
||||
await userActions.deleteNodes([folderNotDeletedId]);
|
||||
await userActions.emptyTrashcan();
|
||||
} catch (error) {
|
||||
Logger.error(`----- afterAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
describe('as admin', () => {
|
||||
beforeAll(async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.clickTrashAndWait();
|
||||
});
|
||||
|
||||
it('[C213217] has the correct columns', async () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Deleted', 'Deleted by'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user