mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +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:
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"]
|
||||
}
|
Reference in New Issue
Block a user