mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-6239] Migrated personal files of pagination suit to playwright (#3528)
* [ACS-6239] Migrated personal files of pagination suit to playwright * [ACS-6239] Remove only * Added path in json file * [ACS-6239] Addressed review comments * [ACS-6239] Addressed review comments * [ACS-6239] Removed material classes and used roles for test cases * Addressed review comments
This commit is contained in:
parent
207410c44c
commit
f705c462be
2
.github/workflows/pull-request.yml
vendored
2
.github/workflows/pull-request.yml
vendored
@ -182,6 +182,8 @@ jobs:
|
|||||||
id: 5
|
id: 5
|
||||||
- name: "special-permissions"
|
- name: "special-permissions"
|
||||||
id: 6
|
id: 6
|
||||||
|
- name: "pagination"
|
||||||
|
id: 7
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
17
e2e/playwright/pagination/.eslintrc.json
Normal file
17
e2e/playwright/pagination/.eslintrc.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../../.eslintrc.json",
|
||||||
|
"ignorePatterns": ["!**/*"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts"],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": ["e2e/playwright/pagination/tsconfig.e2e.json"],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"plugins": ["rxjs", "unicorn"],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-floating-promises": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
e2e/playwright/pagination/exclude.tests.json
Normal file
1
e2e/playwright/pagination/exclude.tests.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
44
e2e/playwright/pagination/playwright.config.ts
Normal file
44
e2e/playwright/pagination/playwright.config.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*!
|
||||||
|
* 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 { PlaywrightTestConfig } from '@playwright/test';
|
||||||
|
import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared';
|
||||||
|
import EXCLUDED_JSON from './exclude.tests.json';
|
||||||
|
|
||||||
|
const config: PlaywrightTestConfig<CustomConfig> = {
|
||||||
|
...getGlobalConfig,
|
||||||
|
|
||||||
|
grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'Pagination'),
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'Pagination',
|
||||||
|
testDir: './src/tests/',
|
||||||
|
use: {
|
||||||
|
users: ['hruser']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
22
e2e/playwright/pagination/project.json
Normal file
22
e2e/playwright/pagination/project.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "pagination-e2e",
|
||||||
|
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"sourceRoot": "e2e/playwright/pagination/src",
|
||||||
|
"projectType": "application",
|
||||||
|
"targets": {
|
||||||
|
"e2e": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"commands": ["npx playwright test --config=e2e/playwright/pagination/playwright.config.ts"]
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "content-ce:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@angular-eslint/builder:lint"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
e2e/playwright/pagination/src/tests/multiple-pages-files.spec.ts
Executable file
57
e2e/playwright/pagination/src/tests/multiple-pages-files.spec.ts
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
/*!
|
||||||
|
* 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 { ApiClientFactory, NodesApi, test, Utils } from '@alfresco/playwright-shared';
|
||||||
|
import { personalFilesTests } from './personal-files';
|
||||||
|
|
||||||
|
test.describe('Pagination on multiple pages : ', () => {
|
||||||
|
const random = Utils.random();
|
||||||
|
const username = `user-${random}`;
|
||||||
|
|
||||||
|
const parent = `parent-${random}`;
|
||||||
|
let parentId: string;
|
||||||
|
|
||||||
|
const apiClientFactory = new ApiClientFactory();
|
||||||
|
|
||||||
|
test.beforeAll(async () => {
|
||||||
|
await apiClientFactory.setUpAcaBackend('admin');
|
||||||
|
await apiClientFactory.createUser({ username });
|
||||||
|
const nodesApi = await NodesApi.initialize(username, username);
|
||||||
|
|
||||||
|
const files = Array(51)
|
||||||
|
.fill('my-file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}-${random}.txt`);
|
||||||
|
|
||||||
|
parentId = (await nodesApi.createFolder(parent)).entry.id;
|
||||||
|
(await nodesApi.createFiles(files, parent)).list.entries.map((entries) => entries.entry.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
await apiClientFactory.nodes.deleteNode(parentId, { permanent: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('on Personal Files', () => {
|
||||||
|
personalFilesTests(username, parent);
|
||||||
|
});
|
||||||
|
});
|
107
e2e/playwright/pagination/src/tests/personal-files.ts
Normal file
107
e2e/playwright/pagination/src/tests/personal-files.ts
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/*!
|
||||||
|
* 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 { test, timeouts } from '@alfresco/playwright-shared';
|
||||||
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
|
export function personalFilesTests(userName: string, parentName: string) {
|
||||||
|
test.describe('Pagination controls : ', () => {
|
||||||
|
test.beforeEach(async ({ loginPage, personalFiles, page }) => {
|
||||||
|
await loginPage.navigate();
|
||||||
|
await loginPage.loginUser({ username: userName, password: userName });
|
||||||
|
await personalFiles.waitForPageLoad();
|
||||||
|
await personalFiles.dataTable.getRowByName(parentName).dblclick();
|
||||||
|
await page.waitForTimeout(timeouts.tiny);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280077] Pagination control default values', async ({ personalFiles }) => {
|
||||||
|
expect(await personalFiles.pagination.getRange()).toContain('Showing 1-25 of 51');
|
||||||
|
expect(await personalFiles.pagination.getMaxItems()).toContain('25');
|
||||||
|
expect(await personalFiles.pagination.getCurrentPage()).toContain('Page 1');
|
||||||
|
expect(await personalFiles.pagination.getTotalPages()).toContain('of 3');
|
||||||
|
expect(await personalFiles.pagination.isPreviousEnabled()).toBe(false);
|
||||||
|
expect(await personalFiles.pagination.isNextEnabled()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280078] Items per page values', async ({ personalFiles }) => {
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
expect(await (await personalFiles.pagination.getNthItem(1)).innerText()).toBe('25');
|
||||||
|
expect(await (await personalFiles.pagination.getNthItem(2)).innerText()).toBe('50');
|
||||||
|
expect(await (await personalFiles.pagination.getNthItem(3)).innerText()).toBe('100');
|
||||||
|
await personalFiles.closeMenu();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280079] current page menu items', async ({ personalFiles }) => {
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
await personalFiles.pagination.clickMenuItem('25');
|
||||||
|
expect(await personalFiles.pagination.getMaxItems()).toContain('25');
|
||||||
|
expect(await personalFiles.pagination.getTotalPages()).toContain('of 3');
|
||||||
|
expect(await personalFiles.pagination.getItemsCount()).toBe(3);
|
||||||
|
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
await personalFiles.pagination.clickMenuItem('50');
|
||||||
|
expect(await personalFiles.pagination.getMaxItems()).toContain('50');
|
||||||
|
expect(await personalFiles.pagination.getTotalPages()).toContain('of 2');
|
||||||
|
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
await personalFiles.pagination.clickMenuItem('100');
|
||||||
|
expect(await personalFiles.pagination.getMaxItems()).toContain('100');
|
||||||
|
expect(await personalFiles.pagination.getTotalPages()).toContain('of 1');
|
||||||
|
|
||||||
|
await personalFiles.pagination.resetToDefaultPageSize();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280080] change the current page from menu', async ({ personalFiles }) => {
|
||||||
|
await personalFiles.pagination.clickOnNextPage();
|
||||||
|
expect(await personalFiles.pagination.getRange()).toContain('Showing 26-50 of 51');
|
||||||
|
expect(await personalFiles.pagination.getCurrentPage()).toContain('Page 2');
|
||||||
|
expect(await personalFiles.pagination.isPreviousEnabled()).toBe(true);
|
||||||
|
expect(await personalFiles.pagination.isNextEnabled()).toBe(true);
|
||||||
|
await personalFiles.pagination.resetToDefaultPageSize();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280083] navigate to next and previous pages', async ({ personalFiles }) => {
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
await personalFiles.pagination.clickMenuItem('25');
|
||||||
|
expect(await personalFiles.pagination.getMaxItems()).toContain('25');
|
||||||
|
await personalFiles.pagination.clickOnNextPage();
|
||||||
|
expect(await personalFiles.pagination.getRange()).toContain('Showing 26-50 of 51');
|
||||||
|
|
||||||
|
await personalFiles.pagination.clickOnPreviousPage();
|
||||||
|
expect(await personalFiles.pagination.getRange()).toContain('Showing 1-25 of 51');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280081] Previous button is disabled on first page', async ({ personalFiles }) => {
|
||||||
|
expect(await personalFiles.pagination.getCurrentPage()).toContain('Page 1');
|
||||||
|
expect(await personalFiles.pagination.isPreviousEnabled()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('[C280082] Next button is disabled on last page', async ({ personalFiles }) => {
|
||||||
|
await personalFiles.pagination.openMaxItemsMenu();
|
||||||
|
await personalFiles.pagination.clickNthItem(3);
|
||||||
|
expect(await personalFiles.pagination.getCurrentPage()).toContain('Page 1');
|
||||||
|
expect(await personalFiles.pagination.isNextEnabled()).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
15
e2e/playwright/pagination/tsconfig.e2e.adf.json
Normal file
15
e2e/playwright/pagination/tsconfig.e2e.adf.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../../tsconfig.adf.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../out-tsc/e2e",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2017",
|
||||||
|
"types": ["jasmine", "jasminewd2", "node"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"paths": {
|
||||||
|
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
15
e2e/playwright/pagination/tsconfig.e2e.json
Executable file
15
e2e/playwright/pagination/tsconfig.e2e.json
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../out-tsc/e2e",
|
||||||
|
"baseUrl": "./",
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2017",
|
||||||
|
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"paths": {
|
||||||
|
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
|
import { Utils, AdminActions, RepoClient } from '@alfresco/aca-testing-shared';
|
||||||
import { personalFilesTests } from './personal-files';
|
|
||||||
import { recentFilesTests } from './recent-files';
|
import { recentFilesTests } from './recent-files';
|
||||||
import { searchResultsTests } from './search-results';
|
import { searchResultsTests } from './search-results';
|
||||||
import { sharedFilesTests } from './shared-files';
|
import { sharedFilesTests } from './shared-files';
|
||||||
@ -64,10 +63,6 @@ describe('Pagination on multiple pages : ', () => {
|
|||||||
await userApi.nodes.deleteNodeById(parentId);
|
await userApi.nodes.deleteNodeById(parentId);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on Personal Files', () => {
|
|
||||||
personalFilesTests(username, parent);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Recent Files', () => {
|
describe('on Recent Files', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 });
|
await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 51 });
|
||||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { BrowsingPage, LoginPage, Utils } from '@alfresco/aca-testing-shared';
|
|
||||||
|
|
||||||
export function personalFilesTests(username: string, parentName: string) {
|
|
||||||
const page = new BrowsingPage();
|
|
||||||
const loginPage = new LoginPage();
|
|
||||||
const { dataTable, pagination } = page;
|
|
||||||
|
|
||||||
describe('Pagination controls : ', () => {
|
|
||||||
beforeAll(async () => {
|
|
||||||
await loginPage.loginWith(username);
|
|
||||||
await page.clickPersonalFilesAndWait();
|
|
||||||
await dataTable.doubleClickOnRowByName(parentName);
|
|
||||||
await dataTable.waitForHeader();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
await Utils.pressEscape();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('[C280077] 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('[C280078] 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('[C280079] 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('[C280080] 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('my-file-9')).toBe(true, 'File not found on page');
|
|
||||||
|
|
||||||
await pagination.resetToDefaultPageNumber();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('[C280083] 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('my-file-34')).toBe(true, 'my-file-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('my-file-15')).toBe(true, 'my-file-15 not found on page');
|
|
||||||
|
|
||||||
await pagination.resetToDefaultPageNumber();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('[C280081] 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('[C280082] 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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ApiClientFactory } from './api-client-factory';
|
import { ApiClientFactory } from './api-client-factory';
|
||||||
import { NodeChildAssociationPaging, NodeEntry } from '@alfresco/js-api';
|
import { NodeChildAssociationPaging, NodeEntry, NodePaging } from '@alfresco/js-api';
|
||||||
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
||||||
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
|
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
|
||||||
|
|
||||||
@ -73,6 +73,15 @@ export class NodesApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createFiles(names: string[], relativePath = '/'): Promise<NodePaging> {
|
||||||
|
try {
|
||||||
|
return await this.createContent({ files: names }, relativePath);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(`${this.constructor.name} ${this.createFiles.name}: ${error}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async createNode(
|
private async createNode(
|
||||||
nodeType: string,
|
nodeType: string,
|
||||||
name: string,
|
name: string,
|
||||||
@ -137,9 +146,9 @@ export class NodesApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all nodes of the currently logged in user
|
* Delete all nodes of the currently logged in user
|
||||||
* @param userNodeId The id of User node, all child nodes of "userNodeId" will be gathered as a list and deleted ( e.g.: "-my-" - User Homes folder)
|
* @param userNodeId The id of User node, all child nodes of "userNodeId" will be gathered as a list and deleted ( e.g.: "-my-" - User Homes folder)
|
||||||
*/
|
*/
|
||||||
async deleteCurrentUserNodes(): Promise<void> {
|
async deleteCurrentUserNodes(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const userNodes = (await this.getNodeChildren('-my-')).list.entries;
|
const userNodes = (await this.getNodeChildren('-my-')).list.entries;
|
||||||
@ -160,11 +169,12 @@ export class NodesApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async createContent(content: NodeContentTree, relativePath: string = '/'): Promise<NodeEntry | any> {
|
async createContent(content: NodeContentTree, relativePath: string = '/'): Promise<NodePaging> {
|
||||||
try {
|
try {
|
||||||
return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any);
|
return await this.apiService.nodes.createNode('-my-', flattenNodeContentTree(content, relativePath) as any);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`${this.constructor.name} ${this.createContent.name}`, error);
|
logger.error(`${this.constructor.name} ${this.createContent.name}`, error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,11 +260,10 @@ export class NodesApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getDataDictionaryId(): Promise<string> {
|
private async getDataDictionaryId(): Promise<string> {
|
||||||
return this.getNodeIdFromParent('Data Dictionary', '-root-')
|
return this.getNodeIdFromParent('Data Dictionary', '-root-').catch((error) => {
|
||||||
.catch((error) => {
|
logger.error('Admin Actions - getDataDictionaryId failed : ', error);
|
||||||
logger.error('Admin Actions - getDataDictionaryId failed : ', error);
|
return '';
|
||||||
return '';
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise<NodeEntry | null> {
|
async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise<NodeEntry | null> {
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BaseComponent } from './base.component';
|
import { BaseComponent } from './base.component';
|
||||||
import { Page } from '@playwright/test';
|
import { Locator, Page } from '@playwright/test';
|
||||||
import { MatMenuComponent } from './dataTable/mat-menu.component';
|
import { MatMenuComponent } from './dataTable/mat-menu.component';
|
||||||
|
import { timeouts } from '../../utils';
|
||||||
|
|
||||||
export enum PaginationActionsType {
|
export enum PaginationActionsType {
|
||||||
PageSizeSelector = 'Page size selector',
|
PageSizeSelector = 'Page size selector',
|
||||||
@ -39,6 +40,14 @@ export class PaginationComponent extends BaseComponent {
|
|||||||
super(page, PaginationComponent.rootElement);
|
super(page, PaginationComponent.rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private range = this.getChild('.adf-pagination__range');
|
||||||
|
private maxItems = this.getChild('.adf-pagination__max-items');
|
||||||
|
private currentPage = this.getChild('.adf-pagination__current-page');
|
||||||
|
private totalPages = this.getChild('.adf-pagination__total-pages');
|
||||||
|
private previousButton = this.getChild('.adf-pagination__previous-button');
|
||||||
|
private nextButton = this.getChild('.adf-pagination__next-button');
|
||||||
|
private maxItemsButton = this.getChild('.adf-pagination__max-items + button[mat-icon-button]');
|
||||||
|
|
||||||
private itemsPerPageMenu = new MatMenuComponent(this.page);
|
private itemsPerPageMenu = new MatMenuComponent(this.page);
|
||||||
|
|
||||||
public currentPageLocator = this.getChild('.adf-pagination__current-page');
|
public currentPageLocator = this.getChild('.adf-pagination__current-page');
|
||||||
@ -65,4 +74,92 @@ export class PaginationComponent extends BaseComponent {
|
|||||||
this.logger.info('Spinner was not present');
|
this.logger.info('Spinner was not present');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getRange(): Promise<string> {
|
||||||
|
return this.range.innerText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMaxItems(): Promise<string> {
|
||||||
|
return this.maxItems.innerText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async getCurrentPage(): Promise<string> {
|
||||||
|
return this.currentPage.innerText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTotalPages(): Promise<string> {
|
||||||
|
return this.totalPages.innerText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isPreviousEnabled(): Promise<boolean> {
|
||||||
|
return this.previousButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isNextEnabled(): Promise<boolean> {
|
||||||
|
await this.page.waitForTimeout(timeouts.tiny);
|
||||||
|
return this.nextButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickOnNextPage(): Promise<void> {
|
||||||
|
try {
|
||||||
|
if (await this.isNextEnabled()) {
|
||||||
|
await this.nextButton.click();
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
throw new Error(`Failed on previous click: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickOnPreviousPage(): Promise<void> {
|
||||||
|
try {
|
||||||
|
if (await this.isPreviousEnabled()) {
|
||||||
|
await this.previousButton.click();
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
throw new Error(`Failed on previous click: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async openMaxItemsMenu(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await this.maxItemsButton.waitFor({ state: 'visible' });
|
||||||
|
await this.maxItemsButton.click();
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`Open max items catch: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async resetToDefaultPageSize(): Promise<void> {
|
||||||
|
try {
|
||||||
|
await this.openMaxItemsMenu();
|
||||||
|
await this.clickNthItem(1);
|
||||||
|
await this.page.waitForTimeout(timeouts.tiny);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`Reset to default page size catch: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickMenuItem(menuItem: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
await this.page.getByRole('menuitem', { name: menuItem }).click();
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(`Click menu item catch : failed to click on: ${e}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNthItem(nth: number): Promise<Locator> {
|
||||||
|
return this.page.getByRole('menuitem').nth(nth - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getItemsCount(): Promise<number> {
|
||||||
|
return await this.page.getByRole('menuitem').count();
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickNthItem(nth: number): Promise<void> {
|
||||||
|
try {
|
||||||
|
await (await this.getNthItem(nth)).click();
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(`Click nth menu item catch: ${e}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ import {
|
|||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
MatMenuComponent,
|
MatMenuComponent,
|
||||||
ViewerComponent,
|
ViewerComponent,
|
||||||
SidenavComponent
|
SidenavComponent,
|
||||||
|
PaginationComponent
|
||||||
} from '../components';
|
} from '../components';
|
||||||
|
|
||||||
export class PersonalFilesPage extends BasePage {
|
export class PersonalFilesPage extends BasePage {
|
||||||
@ -56,9 +57,18 @@ export class PersonalFilesPage extends BasePage {
|
|||||||
public breadcrumb = new Breadcrumb(this.page);
|
public breadcrumb = new Breadcrumb(this.page);
|
||||||
public sidenav = new SidenavComponent(this.page);
|
public sidenav = new SidenavComponent(this.page);
|
||||||
public createFromTemplateDialogComponent = new CreateFromTemplateDialogComponent(this.page);
|
public createFromTemplateDialogComponent = new CreateFromTemplateDialogComponent(this.page);
|
||||||
|
public pagination = new PaginationComponent(this.page);
|
||||||
|
|
||||||
async selectCreateFolder(): Promise<void> {
|
async selectCreateFolder(): Promise<void> {
|
||||||
await this.acaHeader.createButton.click();
|
await this.acaHeader.createButton.click();
|
||||||
await this.matMenu.createFolder.click();
|
await this.matMenu.createFolder.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async closeMenu(): Promise<void> {
|
||||||
|
await this.page.keyboard.press('Escape');
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForPageLoad() {
|
||||||
|
await this.page.waitForURL(`**/${PersonalFilesPage.pageUrl}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user