mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-7301] beforeEach and afterAll refactored for pagination tests (#3737)
This commit is contained in:
@@ -22,16 +22,18 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ApiClientFactory, FavoritesPageApi, NodesApi, test, timeouts, Utils } from '@alfresco/playwright-shared';
|
import { ApiClientFactory, FavoritesPageApi, NodesApi, test, timeouts, Utils, TrashcanApi } from '@alfresco/playwright-shared';
|
||||||
import { personalFilesTests } from './personal-files';
|
import { personalFilesTests } from './personal-files';
|
||||||
import { favoritesTests } from './favorites';
|
import { favoritesTests } from './favorites';
|
||||||
|
|
||||||
test.describe('Pagination on multiple pages : ', () => {
|
test.describe('Pagination on multiple pages : ', () => {
|
||||||
const random = Utils.random();
|
const random = Utils.random();
|
||||||
const username = `user-${random}`;
|
const username = `user-${random}`;
|
||||||
|
let nodesApi: NodesApi;
|
||||||
|
let trashcanApi: TrashcanApi;
|
||||||
|
let favoritesApi: FavoritesPageApi;
|
||||||
|
|
||||||
const parent = `parent-${random}`;
|
const parent = `parent-${random}`;
|
||||||
let parentId: string;
|
|
||||||
let initialFavoritesTotalItems: number;
|
let initialFavoritesTotalItems: number;
|
||||||
|
|
||||||
const apiClientFactory = new ApiClientFactory();
|
const apiClientFactory = new ApiClientFactory();
|
||||||
@@ -40,14 +42,14 @@ test.describe('Pagination on multiple pages : ', () => {
|
|||||||
test.setTimeout(timeouts.extendedTest);
|
test.setTimeout(timeouts.extendedTest);
|
||||||
await apiClientFactory.setUpAcaBackend('admin');
|
await apiClientFactory.setUpAcaBackend('admin');
|
||||||
await apiClientFactory.createUser({ username });
|
await apiClientFactory.createUser({ username });
|
||||||
const nodesApi = await NodesApi.initialize(username, username);
|
nodesApi = await NodesApi.initialize(username, username);
|
||||||
const favoritesApi = await FavoritesPageApi.initialize(username, username);
|
favoritesApi = await FavoritesPageApi.initialize(username, username);
|
||||||
|
|
||||||
const files = Array(51)
|
const files = Array(51)
|
||||||
.fill('my-file')
|
.fill('my-file')
|
||||||
.map((name, index): string => `${name}-${index + 1}-${random}.txt`);
|
.map((name, index): string => `${name}-${index + 1}-${random}.txt`);
|
||||||
|
|
||||||
parentId = (await nodesApi.createFolder(parent)).entry.id;
|
await nodesApi.createFolder(parent);
|
||||||
const filesIds = (await nodesApi.createFiles(files, parent)).list.entries.map((entries) => entries.entry.id);
|
const filesIds = (await nodesApi.createFiles(files, parent)).list.entries.map((entries) => entries.entry.id);
|
||||||
initialFavoritesTotalItems = await favoritesApi.getFavoritesTotalItems(username);
|
initialFavoritesTotalItems = await favoritesApi.getFavoritesTotalItems(username);
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ test.describe('Pagination on multiple pages : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.afterAll(async () => {
|
test.afterAll(async () => {
|
||||||
await apiClientFactory.nodes.deleteNode(parentId, { permanent: true });
|
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('on Personal Files', () => {
|
test.describe('on Personal Files', () => {
|
||||||
@@ -64,7 +66,6 @@ test.describe('Pagination on multiple pages : ', () => {
|
|||||||
|
|
||||||
test.describe('on Favorites', () => {
|
test.describe('on Favorites', () => {
|
||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
const favoritesApi = await FavoritesPageApi.initialize(username, username);
|
|
||||||
await favoritesApi.waitForApi(username, { expect: initialFavoritesTotalItems + 51 });
|
await favoritesApi.waitForApi(username, { expect: initialFavoritesTotalItems + 51 });
|
||||||
});
|
});
|
||||||
favoritesTests(username);
|
favoritesTests(username);
|
||||||
|
Reference in New Issue
Block a user