diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2914650654..134d683e21 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -117,8 +117,6 @@ jobs: id: 3 - name: "shareActions" id: 4 - - name: "pagination" - id: 5 - name: "copyMoveActions" id: 6 - name: "deleteActions" diff --git a/e2e/protractor/suites/pagination/multiple-pages-files.test.ts b/e2e/protractor/suites/pagination/multiple-pages-files.test.ts deleted file mode 100644 index 2aee39be8c..0000000000 --- a/e2e/protractor/suites/pagination/multiple-pages-files.test.ts +++ /dev/null @@ -1,83 +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 . - */ - -import { Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared'; -import { recentFilesTests } from './recent-files'; -import { searchResultsTests } from './search-results'; -import { sharedFilesTests } from './shared-files'; - -describe('Pagination on multiple pages : ', () => { - const random = Utils.random(); - const username = `user-${random}`; - - const parent = `parent-${random}`; - let parentId: string; - - const files = Array(51) - .fill('my-file') - .map((name, index): string => `${name}-${index + 1}-${random}.txt`); - let filesIds: string[]; - - const userApi = new RepoClient(username, username); - const adminApiActions = new AdminActions(); - - let initialSearchTotalItems: number; - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - initialSearchTotalItems = await userApi.search.getTotalItems(username); - - parentId = (await userApi.nodes.createFolder(parent)).entry.id; - filesIds = (await userApi.nodes.createFiles(files, parent)).list.entries.map((entries: any) => entries.entry.id); - - await userApi.shared.shareFilesByIds(filesIds); - await userApi.favorites.addFavoritesByIds('file', filesIds); - }); - - afterAll(async () => { - await userApi.nodes.deleteNodeById(parentId); - }); - - describe('on Recent Files', () => { - beforeAll(async () => { - await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 }); - }); - recentFilesTests(username); - }); - - describe('on Search Results', () => { - beforeAll(async () => { - await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 }); - }); - searchResultsTests(username, `*${random}`); - }); - - describe('on Shared Files', () => { - beforeAll(async () => { - await userApi.shared.waitForFilesToBeShared(filesIds); - }); - sharedFilesTests(username); - }); -}); diff --git a/e2e/protractor/suites/pagination/multiple-pages-libraries.test.ts b/e2e/protractor/suites/pagination/multiple-pages-libraries.test.ts deleted file mode 100755 index cc8f97d172..0000000000 --- a/e2e/protractor/suites/pagination/multiple-pages-libraries.test.ts +++ /dev/null @@ -1,252 +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 . - */ - -import { LoginPage, BrowsingPage, Utils, AdminActions, RepoClient, SITE_VISIBILITY } from '@alfresco/aca-testing-shared'; -import { Logger } from '@alfresco/adf-testing'; - -describe('Pagination on multiple pages', () => { - const random = Utils.random(); - - const username = `user-${random}`; - - const userApi = new RepoClient(username, username); - const adminApiActions = new AdminActions(); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - const sites = Array(51) - .fill('site') - .map((name, index): string => `${name}-${index + 1}-${random}`); - - beforeAll(async () => { - try { - await adminApiActions.createUser({ username }); - - await userApi.sites.createSites(sites, SITE_VISIBILITY.PRIVATE); - await userApi.sites.waitForSitesToBeCreated(sites); - - await loginPage.loginWith(username); - } catch (error) { - Logger.error(`----- beforeAll failed : ${error}`); - } - }, 400000); - - afterAll(async () => { - await userApi.sites.deleteSites(sites); - }); - - describe('on My Libraries', () => { - beforeAll(async () => { - await page.goToMyLibrariesAndWait(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - it('[C280086] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C280087] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C280088] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C280089] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 51'); - expect(await pagination.getCurrentPage()).toContain('Page 2'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - expect(await dataTable.isItemPresent('site-34')).toBe(true, 'Site-34 not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280092] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 51'); - expect(await dataTable.isItemPresent('site-34')).toBe(true, 'Site-34 not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await dataTable.isItemPresent('site-12')).toBe(true, 'Site-12 not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280090] Previous button is disabled on first page', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C280091] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); - }); - - describe('on Favorite Libraries', () => { - beforeAll(async () => { - await page.goToFavoriteLibrariesAndWait(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - it('[C291875] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C291876] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C291877] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C291878] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-51 of 51'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); - expect(await dataTable.isItemPresent('site-1')).toBe(true, 'Site-1 not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C291881] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 51'); - expect(await dataTable.isItemPresent('site-21')).toBe(true, 'Site-21 not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await dataTable.isItemPresent('site-32')).toBe(true, 'Site-32 not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C291879] Previous button is disabled on first page', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C291880] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); - }); -}); diff --git a/e2e/protractor/suites/pagination/multiple-pages-trash.test.ts b/e2e/protractor/suites/pagination/multiple-pages-trash.test.ts deleted file mode 100755 index f4c82e41a6..0000000000 --- a/e2e/protractor/suites/pagination/multiple-pages-trash.test.ts +++ /dev/null @@ -1,151 +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 . - */ - -import { LoginPage, BrowsingPage, Utils, AdminActions, UserActions, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Pagination on multiple pages on Trash', () => { - const random = Utils.random(); - - const username = `user-${random}`; - const filesForDelete = Array(51) - .fill('file') - .map((name, index): string => `${name}-${index + 1}-${random}.txt`); - let filesDeletedIds: string[]; - - const userApi = new RepoClient(username, username); - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { dataTable, pagination } = page; - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - filesDeletedIds = (await userApi.nodes.createFiles(filesForDelete)).list.entries.map((entries: any) => entries.entry.id); - - await userActions.login(username, username); - await userActions.deleteNodes(filesDeletedIds, false); - await userActions.waitForTrashcanSize(51); - - await loginPage.loginWith(username); - await page.clickTrashAndWait(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.emptyTrashcan(); - }); - - it('[C280122] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C280123] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C280124] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C280125] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-51 of 51'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); - expect(await dataTable.isItemPresent('file-1')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280128] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of 51'); - expect(await dataTable.isItemPresent('file-26')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await dataTable.isItemPresent('file-50')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280126] Previous button is disabled on first page', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C280127] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); -}); diff --git a/e2e/protractor/suites/pagination/recent-files.ts b/e2e/protractor/suites/pagination/recent-files.ts deleted file mode 100755 index 8858b7fc3b..0000000000 --- a/e2e/protractor/suites/pagination/recent-files.ts +++ /dev/null @@ -1,128 +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 . - */ - -import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; - -export function recentFilesTests(username: string) { - const page = new BrowsingPage(); - const loginPage = new LoginPage(); - const { dataTable, pagination } = page; - - describe('Pagination controls : ', () => { - beforeAll(async () => { - await loginPage.loginWith(username); - await page.clickRecentFilesAndWait(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - it('[C280104] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of 51'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C280105] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C280106] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C280107] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('51-'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); - expect(await dataTable.isItemPresent('my-file-1')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280110] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50 of'); - expect(await dataTable.isItemPresent('my-file-21')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25 of'); - expect(await dataTable.isItemPresent('my-file-50')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280108] Previous button is disabled on first page', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C280109] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); - }); -} diff --git a/e2e/protractor/suites/pagination/search-results.ts b/e2e/protractor/suites/pagination/search-results.ts deleted file mode 100755 index 8853d7859a..0000000000 --- a/e2e/protractor/suites/pagination/search-results.ts +++ /dev/null @@ -1,130 +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 . - */ - -import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; - -export function searchResultsTests(username: string, random: string) { - const page = new BrowsingPage(); - const loginPage = new LoginPage(); - const { dataTable, pagination, toolbar } = page; - const { searchInput } = page.pageLayoutHeader; - - describe('Pagination controls : ', () => { - beforeAll(async () => { - await loginPage.loginWith(username); - await toolbar.clickSearchIconButton(); - await searchInput.clickSearchButton(); - await searchInput.checkOnlyFiles(); - await searchInput.searchFor(random); - await dataTable.waitForBody(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - it('[C290125] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25 of'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C290126] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C290127] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C290128] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('51-'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C290131] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('26-50 of'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForBody(); - await pagination.clickPrevious(); - await dataTable.waitForBody(); - expect(await pagination.getRange()).toContain('1-25 of'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C290129] Previous button is disabled on first page - ', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C290130] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await dataTable.getRowsCount()).toBe(1, 'Incorrect number of items on the last page'); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); - }); -} diff --git a/e2e/protractor/suites/pagination/shared-files.ts b/e2e/protractor/suites/pagination/shared-files.ts deleted file mode 100755 index b89cf918ad..0000000000 --- a/e2e/protractor/suites/pagination/shared-files.ts +++ /dev/null @@ -1,127 +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 . - */ - -import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared'; - -export function sharedFilesTests(username: string) { - const page = new BrowsingPage(); - const loginPage = new LoginPage(); - const { dataTable, pagination } = page; - - describe('Pagination controls : ', () => { - beforeAll(async () => { - await loginPage.loginWith(username); - await page.clickSharedFilesAndWait(); - }); - - afterEach(async () => { - await Utils.pressEscape(); - }); - - it('[C280095] Pagination control default values', async () => { - expect(await pagination.getRange()).toContain('1-25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.getTotalPages()).toContain('of 3'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled'); - expect(await pagination.isNextEnabled()).toBe(true, 'Next button is not enabled'); - }); - - it('[C280096] Items per page values', async () => { - await pagination.openMaxItemsMenu(); - expect(await pagination.menu.getNthItem(1).getText()).toBe('25'); - expect(await pagination.menu.getNthItem(2).getText()).toBe('50'); - expect(await pagination.menu.getNthItem(3).getText()).toBe('100'); - await pagination.menu.closeMenu(); - }); - - it('[C280097] current page menu items', async () => { - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('25'); - expect(await pagination.getMaxItems()).toContain('25'); - expect(await pagination.getTotalPages()).toContain('of 3'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(3); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('50'); - expect(await pagination.getMaxItems()).toContain('50'); - expect(await pagination.getTotalPages()).toContain('of 2'); - await pagination.openCurrentPageMenu(); - expect(await pagination.menu.getItemsCount()).toBe(2); - await pagination.menu.closeMenu(); - - await pagination.openMaxItemsMenu(); - await pagination.menu.clickMenuItem('100'); - expect(await pagination.getMaxItems()).toContain('100'); - expect(await pagination.getTotalPages()).toContain('of 1'); - - await pagination.resetToDefaultPageSize(); - }); - - it('[C280098] change the current page from menu', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain(`51-`); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isPreviousEnabled()).toBe(true, 'Previous button is not enabled'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled'); - expect(await dataTable.isItemPresent('my-file-1')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280101] navigate to next and previous pages', async () => { - await pagination.clickNext(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('26-50'); - expect(await dataTable.isItemPresent('my-file-21')).toBe(true, 'File not found on page'); - await pagination.resetToDefaultPageNumber(); - - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(2); - await dataTable.waitForHeader(); - await pagination.clickPrevious(); - await dataTable.waitForHeader(); - expect(await pagination.getRange()).toContain('1-25'); - expect(await dataTable.isItemPresent('my-file-50')).toBe(true, 'File not found on page'); - - await pagination.resetToDefaultPageNumber(); - }); - - it('[C280099] Previous button is disabled on first page', async () => { - expect(await pagination.getCurrentPage()).toContain('Page 1'); - expect(await pagination.isPreviousEnabled()).toBe(false, 'Previous button is enabled on first page'); - }); - - it('[C280100] Next button is disabled on last page', async () => { - await pagination.openCurrentPageMenu(); - await pagination.menu.clickNthItem(3); - expect(await pagination.getCurrentPage()).toContain('Page 3'); - expect(await pagination.isNextEnabled()).toBe(false, 'Next button is enabled on last page'); - }); - }); -} diff --git a/e2e/protractor/suites/pagination/single-page.test.ts b/e2e/protractor/suites/pagination/single-page.test.ts deleted file mode 100755 index 2385d95896..0000000000 --- a/e2e/protractor/suites/pagination/single-page.test.ts +++ /dev/null @@ -1,124 +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 . - */ - -import { LoginPage, BrowsingPage, SearchResultsPage, Utils, AdminActions, UserActions, RepoClient } from '@alfresco/aca-testing-shared'; - -describe('Pagination on single page', () => { - const random = Utils.random(); - - const username = `user-${random}`; - - const siteName = `site-${random}`; - let siteId: string; - - const file = `file-${random}.txt`; - let fileId: string; - const fileInTrash = `fileInTrash-${random}.txt`; - let fileInTrashId: string; - - const userApi = new RepoClient(username, username); - const adminApiActions = new AdminActions(); - const userActions = new UserActions(); - - const loginPage = new LoginPage(); - const page = new BrowsingPage(); - const { pagination, toolbar } = page; - const { searchInput } = page.pageLayoutHeader; - const searchResultsPage = new SearchResultsPage(); - - beforeAll(async () => { - await adminApiActions.createUser({ username }); - - const initialFavoriteTotalItems = await userApi.favorites.getFavoritesTotalItems(); - const initialRecentFilesTotalItems = await userApi.search.getTotalItems(username); - - await userActions.login(username, username); - const initialTrashTotalItems = await userActions.getTrashcanSize(); - - fileId = (await userApi.nodes.createFile(file)).entry.id; - fileInTrashId = (await userApi.nodes.createFile(fileInTrash)).entry.id; - siteId = (await userApi.sites.createSite(siteName)).entry.id; - - await userApi.nodes.deleteNodeById(fileInTrashId, false); - await userApi.favorites.addFavoriteById('file', fileId); - await userActions.shareNodes([fileId]); - - await userApi.favorites.waitForApi({ expect: initialFavoriteTotalItems + 2 }); - await userApi.search.waitForApi(username, { expect: initialRecentFilesTotalItems + 1 }); - await userApi.shared.waitForFilesToBeShared([fileId]); - await userActions.waitForTrashcanSize(initialTrashTotalItems + 1); - - await loginPage.loginWith(username); - }); - - afterAll(async () => { - await userActions.login(username, username); - await userActions.deleteNodes([fileId]); - await userActions.deleteSites([siteId]); - await userActions.emptyTrashcan(); - }); - - it('[C280112] page selector not displayed on Favorites', async () => { - await page.clickFavoritesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C280085] page selector not displayed on My Libraries', async () => { - await page.goToMyLibrariesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C291874] page selector not displayed on Favorite Libraries', async () => { - await page.goToFavoriteLibrariesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C280076] page selector not displayed on Personal Files', async () => { - await page.clickPersonalFilesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C280103] page selector not displayed on Recent Files', async () => { - await page.clickRecentFilesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C280094] page selector not displayed on Shared Files', async () => { - await page.clickSharedFilesAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C280121] page selector not displayed on Trash', async () => { - await page.clickTrashAndWait(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); - - it('[C290124] page selector not displayed on Search results', async () => { - await toolbar.clickSearchIconButton(); - await searchInput.clickSearchButton(); - await searchInput.searchFor(file); - await searchResultsPage.waitForResults(); - expect(await pagination.isPagesButtonPresent()).toBe(false, 'page selector displayed'); - }); -}); diff --git a/projects/aca-testing-shared/src/utilities/user-actions.ts b/projects/aca-testing-shared/src/utilities/user-actions.ts index 2f60a10c55..fcd98b359c 100644 --- a/projects/aca-testing-shared/src/utilities/user-actions.ts +++ b/projects/aca-testing-shared/src/utilities/user-actions.ts @@ -25,7 +25,6 @@ import { Logger } from '@alfresco/adf-testing'; import { AlfrescoApi, Comment, CommentsApi, NodesApi, TrashcanApi, SitesApi, SharedlinksApi } from '@alfresco/js-api'; import { browser } from 'protractor'; -import { Utils } from './utils'; export class UserActions { protected readonly alfrescoApi: AlfrescoApi; @@ -109,43 +108,6 @@ export class UserActions { } } - /** - * Returns the amount of deleted nodes in the trashcan. - * TODO: limited to 1000 items only, needs improvements. - */ - async getTrashcanSize(): Promise { - try { - const response = await this.trashcanApi.listDeletedNodes({ - maxItems: 1000 - }); - - return response?.list?.pagination?.totalItems || 0; - } catch (error) { - this.handleError('User Actions - getTrashcanSize failed : ', error); - return -1; - } - } - - /** - * Performs multiple calls to retrieve the size of the trashcan until the expectedSize is reached. - * Used with eventual consistency calls. - * @param expectedSize Size of the trashcan to wait for. - */ - async waitForTrashcanSize(expectedSize: number): Promise { - return Utils.retryCall(async () => { - const totalItems = await this.getTrashcanSize(); - - if (totalItems !== expectedSize) { - return Promise.reject(totalItems); - } else { - return Promise.resolve(totalItems); - } - }).catch((error) => { - this.handleError('User Actions - waitForTrashcanSize failed : ', error); - return -1; - }); - } - async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') { try { for (const nodeId of nodeIds) {