-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACS-6239] Migrated personal files of pagination suit to playwright
- Loading branch information
1 parent
23957d7
commit 664e5e7
Showing
15 changed files
with
419 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 57 additions & 0 deletions
57
e2e/playwright/pagination/src/tests/multiple-pages-files.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 files = Array(51) | ||
.fill('my-file') | ||
.map((name, index): string => `${name}-${index + 1}-${random}.txt`); | ||
|
||
const apiClientFactory = new ApiClientFactory(); | ||
|
||
test.beforeAll(async () => { | ||
await apiClientFactory.setUpAcaBackend('admin'); | ||
await apiClientFactory.createUser({ username }); | ||
const nodesApi = await NodesApi.initialize(username, username); | ||
parentId = (await nodesApi.createFolder(parent)).entry.id; | ||
|
||
(await nodesApi.createFiles(files, parent)).list.entries.map((entries: any) => entries.entry.id); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await apiClientFactory.nodes.deleteNode(parentId, { permanent: true }); | ||
}); | ||
|
||
test.describe('on Personal Files', () => { | ||
personalFilesTests(username, parent); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.only('Pagination controls : ', () => { | ||
test.beforeEach(async ({ loginPage, personalFiles, page }) => { | ||
await loginPage.navigate(); | ||
await loginPage.loginUser({ username: userName, password: userName }); | ||
await personalFiles.navigate(); | ||
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.menu.getNthItem(1)).innerText()).toBe('25'); | ||
expect(await (await personalFiles.pagination.menu.getNthItem(2)).innerText()).toBe('50'); | ||
expect(await (await personalFiles.pagination.menu.getNthItem(3)).innerText()).toBe('100'); | ||
await personalFiles.closeMenu(); | ||
}); | ||
|
||
test('[C280079] current page menu items', async ({ personalFiles }) => { | ||
await personalFiles.pagination.openMaxItemsMenu(); | ||
await personalFiles.pagination.menu.clickMenuItem('25'); | ||
expect(await personalFiles.pagination.getMaxItems()).toContain('25'); | ||
expect(await personalFiles.pagination.getTotalPages()).toContain('of 3'); | ||
expect(await personalFiles.pagination.menu.getItemsCount()).toBe(3); | ||
|
||
await personalFiles.pagination.openMaxItemsMenu(); | ||
await personalFiles.pagination.menu.clickMenuItem('50'); | ||
expect(await personalFiles.pagination.getMaxItems()).toContain('50'); | ||
expect(await personalFiles.pagination.getTotalPages()).toContain('of 2'); | ||
|
||
await personalFiles.pagination.openMaxItemsMenu(); | ||
await personalFiles.pagination.menu.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.menu.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.menu.clickNthItem(3); | ||
expect(await personalFiles.pagination.getCurrentPage()).toContain('Page 1'); | ||
expect(await personalFiles.pagination.isNextEnabled()).toBe(false); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../out-tsc/e2e", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"], | ||
"skipLibCheck": true | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.