[ACS-6435] playwright e2e for list views personal files (#3551)

* [ACS-6435] playwright e2e for list views personal files

* e2e test for trash page

* e2e test for trash page

* e2e test for file-libraries page

* e2e test for file-libraries page fix

* e2e test for file-libraries page fix

* e2e test shared recent  page

* e2e test shared recent  page fix

* e2e test review comment fix

* e2e test review fix flaky test fix

* e2e test fail test fix

* e2e test fail  fix

* test code fix

* protractor list-view test enable
This commit is contained in:
Akash Rathod
2023-12-11 17:07:13 +01:00
committed by GitHub
parent 68ee86010a
commit 8b412b28f9
29 changed files with 1009 additions and 1154 deletions

View File

@@ -0,0 +1,26 @@
{
"extends": "../../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"e2e/playwright/list-views/tsconfig.e2e.json"
],
"createDefaultProgram": true
},
"plugins": [
"rxjs",
"unicorn"
],
"rules": {
"@typescript-eslint/no-floating-promises": "off"
}
}
]
}

View File

@@ -0,0 +1 @@
{}

View 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, 'List Views'),
projects: [
{
name: 'List Views',
testDir: './src/tests',
use: {
users: ['hruser', 'admin']
}
}
]
};
export default config;

View File

@@ -0,0 +1,22 @@
{
"name": "list-views-e2e",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/playwright/list-views",
"projectType": "application",
"targets": {
"e2e": {
"executor": "nx:run-commands",
"options": {
"commands": ["npx playwright test --config=e2e/playwright/list-views/playwright.config.ts"]
},
"configurations": {
"production": {
"devServerTarget": "content-ce:serve:production"
}
}
},
"lint": {
"executor": "@angular-eslint/builder:lint"
}
}
}

View File

@@ -0,0 +1,146 @@
/*!
* 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 { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, NodesApi, Utils, test, SitesApi, FavoritesPageApi, timeouts } from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('Favorites Files', () => {
let nodesApi: NodesApi;
let siteActionsAdmin: SitesApi;
const username = `user-${Utils.random()}`;
const siteName = `site-${Utils.random()}`;
const favFolderName = `favFolder-${Utils.random()}`;
const parentFolder = `parent-${Utils.random()}`;
const fileName1 = `file1-${Utils.random()}.txt`;
const fileName2 = `file2-${Utils.random()}.txt`;
const fileName3 = `file3-${Utils.random()}.txt`;
const fileName4 = `file4-${Utils.random()}.txt`;
test.beforeAll(async () => {
try {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
const nodesApiAdmin = await NodesApi.initialize('admin');
siteActionsAdmin = await SitesApi.initialize('admin');
const favoritesActions = await FavoritesPageApi.initialize(username, username);
const consumerFavoritesTotalItems = await favoritesActions.getFavoritesTotalItems(username);
const folderFavId = (await nodesApi.createFolder(favFolderName)).entry.id;
const parentId = (await nodesApi.createFolder(parentFolder)).entry.id;
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC);
const docLibId = await siteActionsAdmin.getDocLibId(siteName);
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager);
await favoritesActions.addFavoritesByIds('folder', [folderFavId]);
const file1Id = (await nodesApiAdmin.createFile(fileName1, docLibId)).entry.id;
const file2Id = (await nodesApi.createFile(fileName2, parentId)).entry.id;
const file3Id = (await nodesApi.createFile(fileName3, parentId)).entry.id;
const file4Id = (await nodesApi.createFile(fileName4, parentId)).entry.id;
await favoritesActions.addFavoritesByIds('file', [file1Id]);
await favoritesActions.addFavoriteById('file', file2Id);
await favoritesActions.addFavoriteById('file', file3Id);
await favoritesActions.addFavoriteById('file', file4Id);
await nodesApi.deleteNodes([file3Id, file4Id], false);
await apiClientFactory.trashCan.restoreDeletedNode(file4Id);
await Promise.all([
favoritesActions.isFavoriteWithRetry(username, folderFavId, { expect: true }),
favoritesActions.waitForApi(username, { expect: consumerFavoritesTotalItems + 4 })
]);
} catch (error) {
console.error(`beforeAll failed : ${error}`);
}
});
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test.afterAll(async () => {
await nodesApi.deleteCurrentUserNodes();
await siteActionsAdmin.deleteSites([siteName]);
});
test.describe(`Regular user's Favorites files`, () => {
test.beforeEach(async ({ favoritePage }) => {
await favoritePage.navigate();
});
test('[C280482] has the correct columns', async ({ favoritePage }) => {
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Tags'];
const actualColumns = await favoritePage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test(`[C213228] deleted favorite file does not appear`, async ({ favoritePage }) => {
expect(await favoritePage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true);
});
test(`[C213229] file is displayed after it is restored from Trashcan`, async ({ favoritePage }) => {
expect(await favoritePage.dataTable.isItemPresent(fileName4), `${fileName4} not displayed`).toBe(true);
});
test('[C213231] Location column displays the parent folder of the files', async ({ favoritePage }) => {
expect(await favoritePage.dataTable.getItemLocationText(fileName2)).toEqual(parentFolder);
expect(await favoritePage.dataTable.getItemLocationText(favFolderName)).toEqual('Personal Files');
expect(await favoritePage.dataTable.getItemLocationTooltip(fileName2)).toEqual(`Personal Files/${parentFolder}`);
expect(await favoritePage.dataTable.getItemLocationTooltip(favFolderName)).toEqual('Personal Files');
expect(await favoritePage.dataTable.getItemLocationText(fileName1)).toEqual(siteName);
expect(await favoritePage.dataTable.getItemLocationTooltip(fileName1)).toContain(`${siteName}`);
});
test('[C213650] Location column redirect - item in user Home', async ({ favoritePage }) => {
await favoritePage.dataTable.clickItemLocation(favFolderName);
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files']);
});
test('[C280484] Location column redirect - file in folder', async ({ favoritePage }) => {
await favoritePage.dataTable.clickItemLocation(fileName2);
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]);
});
test('[C280485] Location column redirect - file in site', async ({ favoritePage }) => {
await favoritePage.dataTable.clickItemLocation(fileName1);
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]);
});
test('[C213230] Navigate into folder from Favorites', async ({ favoritePage }) => {
await favoritePage.dataTable.performClickFolderOrFileToOpen(favFolderName);
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.breadcrumb.currentItem.innerText()).toBe(favFolderName);
});
});
});

View File

@@ -0,0 +1,168 @@
/*!
* 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 { expect } from '@playwright/test';
import { ApiClientFactory, FavoritesPageApi, LoginPage, SitesApi, Utils, test, timeouts } from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('File Libraries', () => {
let siteActionsAdmin: SitesApi;
let siteActionsUser: SitesApi;
const username = `user-${Utils.random()}`;
const userSitePrivate = `user-priv-${Utils.random()}`;
const userSiteModerated = `user-mode-${Utils.random()}`;
const userSitePublic = `user-pub-${Utils.random()}`;
const siteName = `siteName-${Utils.random()}`;
const siteId1 = Utils.random();
const siteId2 = Utils.random();
const adminSite1 = `admin1-${Utils.random()}`;
const adminSite2 = `admin2-${Utils.random()}`;
const adminSite3 = `admin3-${Utils.random()}`;
const adminSite4 = `admin4-${Utils.random()}`;
const adminSite5 = `admin5-${Utils.random()}`;
test.beforeAll(async () => {
try {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
siteActionsAdmin = await SitesApi.initialize('admin');
siteActionsUser = await SitesApi.initialize(username, username);
const favoritesActions = await FavoritesPageApi.initialize(username, username);
const siteDescription = 'my site description';
await siteActionsUser.createSite(userSitePublic, Site.VisibilityEnum.PUBLIC);
await siteActionsUser.createSite(userSiteModerated, Site.VisibilityEnum.MODERATED, siteDescription);
await siteActionsUser.createSite(userSitePrivate, Site.VisibilityEnum.PRIVATE, null);
await siteActionsAdmin.createSite(adminSite1, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.createSite(adminSite2, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.createSite(adminSite3, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.createSite(adminSite4, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.createSite(adminSite5, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.addSiteMember(adminSite1, username, Site.RoleEnum.SiteConsumer);
await siteActionsAdmin.addSiteMember(adminSite2, username, Site.RoleEnum.SiteContributor);
await siteActionsAdmin.addSiteMember(adminSite3, username, Site.RoleEnum.SiteCollaborator);
await siteActionsAdmin.addSiteMember(adminSite4, username, Site.RoleEnum.SiteManager);
await siteActionsAdmin.addSiteMember(adminSite5, username, Site.RoleEnum.SiteConsumer);
await favoritesActions.addFavoriteById('site', adminSite1);
await favoritesActions.addFavoriteById('site', adminSite2);
await favoritesActions.addFavoriteById('site', adminSite3);
await favoritesActions.addFavoriteById('site', adminSite4);
await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC, null, siteId1);
await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC, null, siteId2);
} catch (error) {
console.error(`----- beforeAll failed : ${error}`);
}
});
test.afterAll(async () => {
await siteActionsUser.deleteSites([userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2]);
await siteActionsAdmin.deleteSites([adminSite1, adminSite2, adminSite3, adminSite4, adminSite5]);
});
test.describe('My Libraries', () => {
test.beforeEach(async ({ page, myLibrariesPage }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
await myLibrariesPage.navigate();
});
test('[C217095] has the correct columns', async ({ myLibrariesPage }) => {
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
const actualColumns = await myLibrariesPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C289905] Library visibility is correctly displayed', async ({ myLibrariesPage }) => {
const expectedSitesVisibility = {
[userSitePrivate]: Site.VisibilityEnum.PRIVATE,
[userSiteModerated]: Site.VisibilityEnum.MODERATED,
[userSitePublic]: Site.VisibilityEnum.PUBLIC
};
for (const [site, visibility] of Object.entries(expectedSitesVisibility)) {
const sitesVisibility = await myLibrariesPage.dataTable.getRowAllInnerTexts(site);
expect(sitesVisibility.toLowerCase()).toContain(visibility.toLowerCase());
}
});
test('[C289903] User role is correctly displayed', async ({ myLibrariesPage }) => {
const expectedSitesRoles = {
[adminSite1]: Site.RoleEnum.SiteConsumer,
[adminSite2]: Site.RoleEnum.SiteContributor,
[adminSite3]: Site.RoleEnum.SiteCollaborator,
[adminSite4]: Site.RoleEnum.SiteManager
};
for (const [site, role] of Object.entries(expectedSitesRoles)) {
const sitesRowNames = await myLibrariesPage.dataTable.getRowAllInnerTexts(site);
expect(sitesRowNames).toContain(role.split('Site')[1]);
}
});
test('[C217098] Site ID is displayed when two sites have the same name', async ({ myLibrariesPage }) => {
const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`];
const actualSite1 = await myLibrariesPage.dataTable.getRowAllInnerTexts(siteId1);
expect(actualSite1).toContain(expectedSites[0]);
const actualSite2 = await myLibrariesPage.dataTable.getRowAllInnerTexts(siteId2);
expect(actualSite2).toContain(expectedSites[1]);
});
});
test.describe('Favorite Libraries', () => {
test.beforeEach(async ({ page, favoritesLibrariesPage }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
await favoritesLibrariesPage.navigate();
});
test('[C289893] has the correct columns', async ({ favoritesLibrariesPage }) => {
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
const actualColumns = await favoritesLibrariesPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C289897] User can see only his favorite sites', async ({ favoritesLibrariesPage }) => {
expect(await favoritesLibrariesPage.dataTable.isItemPresent(adminSite5), `${adminSite5} should not appear`).toBe(false);
});
});
});

View File

@@ -0,0 +1,84 @@
/*!
* 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 { expect } from '@playwright/test';
import { APP_ROUTES, ApiClientFactory, LoginPage, NodesApi, SIDEBAR_LABELS, Utils, test } from '@alfresco/playwright-shared';
test.describe('Personal Files', () => {
let nodesApi: NodesApi;
const username = `user-${Utils.random()}`;
const userFolder = `user-folder-${Utils.random()}`;
test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
await nodesApi.createFolder(userFolder);
} catch (error) {
console.error(`beforeAll failed : ${error}`);
}
});
test.afterAll(async () => {
await nodesApi.deleteCurrentUserNodes();
});
test.describe(`Regular user's personal files`, () => {
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test('[C217142] has the correct columns', async ({ personalFiles }) => {
const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by', 'Tags'];
const actualColumns = await personalFiles.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C217143] has default sorted column', async ({ personalFiles }) => {
expect(await personalFiles.dataTable.getSortedColumnHeaderText()).toBe('Name');
});
test('[C213245] redirects to Personal Files on clicking the link from sidebar', async ({ personalFiles }) => {
await personalFiles.dataTable.performClickFolderOrFileToOpen(userFolder);
await personalFiles.sidenav.openPanel(SIDEBAR_LABELS.PERSONAL_FILES);
await personalFiles.dataTable.spinnerWaitForReload();
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES);
expect(await personalFiles.sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES), 'My Libraries link not active').toBe(true);
});
test('[C213246] page loads correctly after browser refresh', async ({ personalFiles }) => {
await personalFiles.reload();
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES);
});
});
});

View File

@@ -0,0 +1,121 @@
/*!
* 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 { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, NodesApi, SearchPageApi, SitesApi, TrashcanApi, Utils, test, timeouts } from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('Recent Files', () => {
let nodeActionsUser: NodesApi;
let siteActionsUser: SitesApi;
const username = `user-${Utils.random()}`;
const folderName = `folder-${Utils.random()}`;
let folderId: string;
const fileName1 = `file-${Utils.random()}.txt`;
const fileName2 = `file-${Utils.random()}.txt`;
let file2Id: string;
const fileName3 = `file-${Utils.random()}.txt`;
const siteName = `site-${Utils.random()}`;
const folderSite = `folder2-${Utils.random()}`;
const fileSite = `file-${Utils.random()}.txt`;
test.beforeAll(async () => {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodeActionsUser = await NodesApi.initialize(username, username);
siteActionsUser = await SitesApi.initialize(username, username);
folderId = (await nodeActionsUser.createFolder(folderName)).entry.id;
await nodeActionsUser.createFiles([fileName1], folderName);
file2Id = (await nodeActionsUser.createFile(fileName2)).entry.id;
const id = (await nodeActionsUser.createFile(fileName3)).entry.id;
await nodeActionsUser.deleteNodes([id], false);
await siteActionsUser.createSite(siteName, Site.VisibilityEnum.PUBLIC);
const docLibId = await siteActionsUser.getDocLibId(siteName);
const folderSiteId = (await nodeActionsUser.createFolder(folderSite, docLibId)).entry.id;
await nodeActionsUser.createFile(fileSite, folderSiteId);
const searchApi = await SearchPageApi.initialize(username, username);
await searchApi.waitForApi(username, { expect: 3 });
});
test.beforeEach(async ({ page, recentFilesPage }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
await recentFilesPage.navigate();
});
test.afterAll(async () => {
await nodeActionsUser.deleteNodes([folderId, file2Id]);
await siteActionsUser.deleteSites([siteName]);
const trashcanApi = await TrashcanApi.initialize(username, username);
await trashcanApi.emptyTrashcan();
});
test('[C213168] has the correct columns', async ({ recentFilesPage }) => {
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Tags'];
const actualColumns = await recentFilesPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C213171] default sorting column', async ({ recentFilesPage }) => {
expect(await recentFilesPage.dataTable.getSortedColumnHeaderText()).toBe('Modified');
expect(await recentFilesPage.dataTable.getSortingOrder()).toBe('desc');
});
test(`[C213174] file not displayed if it's been deleted`, async ({ recentFilesPage }) => {
expect(await recentFilesPage.dataTable.isItemPresent(fileName3), `${fileName3} is displayed`).not.toBe(true);
});
test('[C213176] Location column redirect - file in user Home', async ({ recentFilesPage }) => {
await recentFilesPage.dataTable.clickItemLocation(fileName2);
await recentFilesPage.dataTable.spinnerWaitForReload();
expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['Personal Files']);
});
test('[C280486] Location column redirect - file in folder', async ({ recentFilesPage }) => {
await recentFilesPage.dataTable.clickItemLocation(fileName1);
await recentFilesPage.dataTable.spinnerWaitForReload();
expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderName]);
});
test('[C280487] Location column redirect - file in site', async ({ recentFilesPage }) => {
await recentFilesPage.dataTable.clickItemLocation(fileSite);
await recentFilesPage.dataTable.spinnerWaitForReload();
expect(await recentFilesPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName, folderSite]);
});
});

View File

@@ -0,0 +1,129 @@
/*!
* 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 { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, NodesApi, Utils, test, SitesApi, timeouts, SharedLinksApi } from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('Shared Files', () => {
let nodesApi: NodesApi;
let siteActionsAdmin: SitesApi;
const username = `user-${Utils.random()}`;
const siteName = `site-${Utils.random()}`;
const fileAdmin = `fileSite-${Utils.random()}.txt`;
const folderUser = `folder-${Utils.random()}`;
const file1User = `file1-${Utils.random()}.txt`;
const file2User = `file2-${Utils.random()}.txt`;
const file3User = `file3-${Utils.random()}.txt`;
const file4User = `file4-${Utils.random()}.txt`;
test.beforeAll(async () => {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
siteActionsAdmin = await SitesApi.initialize('admin');
const nodesApiAdmin = await NodesApi.initialize('admin');
const shareActionsAdmin = await SharedLinksApi.initialize('admin');
nodesApi = await NodesApi.initialize(username, username);
const shareActions = await SharedLinksApi.initialize(username, username);
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC);
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteConsumer);
const docLibId = await siteActionsAdmin.getDocLibId(siteName);
const nodeId = (await nodesApiAdmin.createFile(fileAdmin, docLibId)).entry.id;
await shareActionsAdmin.shareFileById(nodeId);
await shareActionsAdmin.waitForFilesToBeShared([nodeId]);
const folderId = (await nodesApi.createFolder(folderUser)).entry.id;
const file1Id = (await nodesApi.createFile(file1User, folderId)).entry.id;
const file2Id = (await nodesApi.createFile(file2User)).entry.id;
const file3Id = (await nodesApi.createFile(file3User)).entry.id;
const file4Id = (await nodesApi.createFile(file4User)).entry.id;
await shareActions.shareFilesByIds([file1Id, file2Id, file3Id, file4Id]);
await shareActions.waitForFilesToBeShared([file1Id, file2Id, file3Id, file4Id]);
await nodesApi.deleteNodeById(file2Id);
await shareActions.unshareFileById(file3Id);
await shareActions.waitForFilesToNotBeShared([file2Id, file3Id]);
});
test.beforeEach(async ({ page, sharedPage }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
await sharedPage.navigate();
});
test.afterAll(async () => {
await siteActionsAdmin.deleteSites([siteName]);
await nodesApi.deleteCurrentUserNodes();
});
test('[C213113] has the correct columns', async ({ sharedPage }) => {
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by', 'Tags'];
const actualColumns = await sharedPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C213115] default sorting column', async ({ sharedPage }) => {
expect(await sharedPage.dataTable.getSortedColumnHeaderText()).toBe('Modified');
expect(await sharedPage.dataTable.getSortingOrder()).toBe('desc');
});
test(`[C213117] file not displayed if it's been deleted`, async ({ sharedPage }) => {
expect(await sharedPage.dataTable.isItemPresent(file2User), `${file2User} is displayed`).toBe(false);
});
test('[C213118] unshared file is not displayed', async ({ sharedPage }) => {
expect(await sharedPage.dataTable.isItemPresent(file3User), `${file3User} is displayed`).toBe(false);
});
test('[C213666] Location column redirect - file in user Home', async ({ sharedPage }) => {
await sharedPage.dataTable.clickItemLocation(file4User);
await sharedPage.dataTable.spinnerWaitForReload();
expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['Personal Files']);
});
test('[C280490] Location column redirect - file in folder', async ({ sharedPage }) => {
await sharedPage.dataTable.clickItemLocation(file1User);
await sharedPage.dataTable.spinnerWaitForReload();
expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderUser]);
});
test('[C280491] Location column redirect - file in site', async ({ sharedPage }) => {
await sharedPage.dataTable.clickItemLocation(fileAdmin);
await sharedPage.dataTable.spinnerWaitForReload();
expect(await sharedPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]);
});
});

View File

@@ -0,0 +1,123 @@
/*!
* 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 { expect } from '@playwright/test';
import { ApiClientFactory, LoginPage, NodesApi, SitesApi, Utils, test } from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';
test.describe('Trash', () => {
let nodesApi: NodesApi;
let siteActionsAdmin: SitesApi;
const username = `user-${Utils.random()}`;
const siteName = `site-${Utils.random()}`;
const fileSite = `file1-${Utils.random()}.txt`;
const fileUser = `file-${Utils.random()}.txt`;
const fileDeleted = `file-${Utils.random()}.txt`;
const folderNotDeleted = `folder-${Utils.random()}`;
const fileInFolder = `file-${Utils.random()}.txt`;
test.beforeAll(async () => {
try {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
siteActionsAdmin = await SitesApi.initialize('admin');
nodesApi = await NodesApi.initialize(username, username);
const nodesApiAdmin = await NodesApi.initialize('admin');
const folderDeleted = `folder-${Utils.random()}`;
await siteActionsAdmin.createSite(siteName, Site.VisibilityEnum.PUBLIC);
const docLibId = await siteActionsAdmin.getDocLibId(siteName);
await siteActionsAdmin.addSiteMember(siteName, username, Site.RoleEnum.SiteManager);
const fileSiteId = (await nodesApiAdmin.createFile(fileSite, docLibId)).entry.id;
const fileUserId = (await nodesApi.createFile(fileUser)).entry.id;
const folderDeletedId = (await nodesApi.createFolder(folderDeleted)).entry.id;
const folderNotDeletedId = (await nodesApi.createFolder(folderNotDeleted)).entry.id;
const fileDeletedId = (await nodesApi.createFile(fileDeleted, folderDeletedId)).entry.id;
const fileInFolderId = (await nodesApi.createFile(fileInFolder, folderNotDeletedId)).entry.id;
await nodesApi.deleteNodes([fileSiteId, fileUserId, fileInFolderId, fileDeletedId, folderDeletedId], false);
} catch (error) {
console.error(`----- beforeAll failed : ${error}`);
}
});
test.afterAll(async () => {
await nodesApi.deleteCurrentUserNodes();
await siteActionsAdmin.deleteSites([siteName]);
});
test.describe(`Regular user's personal files`, () => {
test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});
test.beforeEach(async ({ trashPage }) => {
await trashPage.navigate();
});
test('[C280494] has the correct columns', async ({ trashPage }) => {
const expectedColumns = ['Name', 'Location', 'Size', 'Deleted'];
const actualColumns = await trashPage.dataTable.getColumnHeaders();
expect(actualColumns).toEqual(expectedColumns);
});
test('[C213219] default sorting column', async ({ trashPage }) => {
expect(await trashPage.dataTable.getSortedColumnHeaderText()).toBe('Deleted');
expect(await trashPage.dataTable.getSortingOrder()).toBe('desc');
});
test('[C280500] Location column is empty if parent folder no longer exists', async ({ trashPage }) => {
expect(await trashPage.dataTable.getItemLocationText(fileDeleted)).toEqual('');
});
test('[C217144] Location column redirect - file in user Home', async ({ trashPage }) => {
await trashPage.dataTable.clickItemLocation(fileUser);
await trashPage.dataTable.spinnerWaitForReload();
expect(await trashPage.breadcrumb.getAllItems()).toEqual(['Personal Files']);
});
test('[C280496] Location column redirect - file in folder', async ({ trashPage }) => {
await trashPage.dataTable.clickItemLocation(fileInFolder);
await trashPage.dataTable.spinnerWaitForReload();
expect(await trashPage.breadcrumb.getAllItems()).toEqual(['Personal Files', folderNotDeleted]);
});
test('[C280497] Location column redirect - file in site', async ({ trashPage }) => {
await trashPage.dataTable.clickItemLocation(fileSite);
await trashPage.dataTable.spinnerWaitForReload();
expect(await trashPage.breadcrumb.getAllItems()).toEqual(['My Libraries', siteName]);
});
});
});

View 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"]
}

View 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"]
}

View File

@@ -44,21 +44,13 @@ export function favoritesTests(username: string) {
expect(await favoritePage.pagination.isNextEnabled()).toBe(true);
});
test('[C280114] Items per page values', async ({ favoritePage }) => {
await favoritePage.pagination.openMaxItemsMenu();
expect(await (await favoritePage.pagination.getNthItem(1)).innerText()).toBe('25');
expect(await (await favoritePage.pagination.getNthItem(2)).innerText()).toBe('50');
expect(await (await favoritePage.pagination.getNthItem(3)).innerText()).toBe('100');
await favoritePage.pagination.closeMenu();
});
test('[C280115] current page menu items', async ({ favoritePage }) => {
await favoritePage.pagination.openMaxItemsMenu();
expect(await favoritePage.pagination.getItemsCount()).toBe(3);
await favoritePage.pagination.clickMenuItem('25');
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.pagination.getMaxItems()).toContain('25');
expect(await favoritePage.pagination.getTotalPages()).toContain('of 3');
expect(await favoritePage.pagination.getItemsCount()).toBe(3);
await favoritePage.pagination.closeMenu();
await favoritePage.pagination.openMaxItemsMenu();
await favoritePage.pagination.clickMenuItem('50');
@@ -89,9 +81,10 @@ export function favoritesTests(username: string) {
await favoritePage.pagination.clickMenuItem('25');
expect(await favoritePage.pagination.getMaxItems()).toContain('25');
await favoritePage.pagination.clickOnNextPage();
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.pagination.getRange()).toContain('Showing 26-50 of 51');
await favoritePage.pagination.clickOnPreviousPage();
await favoritePage.dataTable.spinnerWaitForReload();
expect(await favoritePage.pagination.getRange()).toContain('Showing 1-25 of 51');
});

View File

@@ -44,20 +44,13 @@ export function personalFilesTests(userName: string, parentName: string) {
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();
expect(await personalFiles.pagination.getItemsCount()).toBe(3);
await personalFiles.pagination.clickMenuItem('25');
await personalFiles.dataTable.spinnerWaitForReload();
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');
@@ -86,9 +79,10 @@ export function personalFilesTests(userName: string, parentName: string) {
await personalFiles.pagination.clickMenuItem('25');
expect(await personalFiles.pagination.getMaxItems()).toContain('25');
await personalFiles.pagination.clickOnNextPage();
await personalFiles.dataTable.spinnerWaitForReload();
expect(await personalFiles.pagination.getRange()).toContain('Showing 26-50 of 51');
await personalFiles.pagination.clickOnPreviousPage();
await personalFiles.dataTable.spinnerWaitForReload();
expect(await personalFiles.pagination.getRange()).toContain('Showing 1-25 of 51');
});