Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-6510] playwright List View e2e test #3566

Merged
merged 25 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c225891
[ACS-6435] playwright e2e for list views personal files
akashrathod28 Dec 1, 2023
d155157
e2e test for trash page
akashrathod28 Dec 5, 2023
be2ef58
e2e test for trash page
akashrathod28 Dec 5, 2023
bae1877
e2e test for file-libraries page
akashrathod28 Dec 6, 2023
13b54fe
e2e test for file-libraries page fix
akashrathod28 Dec 6, 2023
6ef8b9d
e2e test for file-libraries page fix
akashrathod28 Dec 6, 2023
3f3d03d
e2e test shared recent page
akashrathod28 Dec 7, 2023
53cdf51
e2e test shared recent page fix
akashrathod28 Dec 7, 2023
0431ee4
e2e test review comment fix
akashrathod28 Dec 8, 2023
7ecc25a
e2e test review fix flaky test fix
akashrathod28 Dec 8, 2023
709f996
e2e test fail test fix
akashrathod28 Dec 8, 2023
7e56bd5
Merge branch 'develop' into dev-akashrathod28-playwright-migration-li…
akashrathod28 Dec 9, 2023
8a3a9a1
e2e test fail fix
akashrathod28 Dec 9, 2023
aec6110
test code fix
akashrathod28 Dec 11, 2023
8a6498a
protractor list-view test enable
akashrathod28 Dec 11, 2023
89ac123
[ACS-6510] listview playwright e2e test
akashrathod28 Dec 18, 2023
67f9c43
Merge branch 'develop' into dev-akashrathod28-playwright-listview
akashrathod28 Dec 18, 2023
54689aa
code fix
akashrathod28 Dec 18, 2023
f7409c7
code fix
akashrathod28 Dec 19, 2023
bf9a759
code fix
akashrathod28 Dec 19, 2023
6e03faf
code fix
akashrathod28 Dec 19, 2023
e25e96b
code fix
akashrathod28 Dec 20, 2023
3d607a8
code fix
akashrathod28 Dec 20, 2023
f523d03
code fix for review
akashrathod28 Dec 20, 2023
ca9258f
code fix for review
akashrathod28 Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions e2e/playwright/list-views/src/tests/empty-list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*!
* 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, Utils, test } from '@alfresco/playwright-shared';

test.describe('Empty list views', () => {
const username = `user-${Utils.random()}`;

test.beforeAll(async () => {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
});

test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});

test('[C217099] empty My Libraries', async ({ myLibrariesPage }) => {
await myLibrariesPage.navigate();
expect(await myLibrariesPage.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await myLibrariesPage.dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
expect(await myLibrariesPage.dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
});

test('[C280134] [C280120] Empty Trash - pagination controls not displayed', async ({ trashPage }) => {
await trashPage.navigate();
expect(await trashPage.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await trashPage.dataTable.getEmptyStateTitle()).toContain('Trash is empty');
expect(await trashPage.dataTable.getEmptyListText()).toContain('Items you delete are moved to the Trash.');
expect(await trashPage.dataTable.getEmptyListText()).toContain('Empty Trash to permanently delete items.');
expect(await trashPage.pagination.isRangePresent(), 'Range is present').toBe(false);
expect(await trashPage.pagination.isMaxItemsPresent(), 'Max items is present').toBe(false);
});

test('[C290123] [C290031] Empty Search results - pagination controls not displayed', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor('InvalidText');
await searchPage.reload({ waitUntil: 'domcontentloaded' });
await searchPage.dataTable.spinnerWaitForReload();

expect(await personalFiles.pagination.isRangePresent(), 'Range is present').toBe(false);
expect(await personalFiles.pagination.isMaxItemsPresent(), 'Max items is present').toBe(false);
expect(await personalFiles.dataTable.isEmpty(), 'list is not empty').toBe(true);
expect(await personalFiles.dataTable.emptySearchText.innerText()).toContain('Your search returned 0 results');
});
});
99 changes: 99 additions & 0 deletions e2e/playwright/list-views/src/tests/generic-errors.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*!
* 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, TrashcanApi, Utils, test } from '@alfresco/playwright-shared';

test.describe('Generic errors', () => {
const username = `user-${Utils.random()}`;
const username2 = `user2-${Utils.random()}`;
let parentId: string;
let file1Id: string;
let file2Id: string;
let actionUser: NodesApi;

test.beforeAll(async () => {
try {
const parent = `folder-${Utils.random()}`;
const file1 = `file1-${Utils.random()}.txt`;
const file2 = `file2-${Utils.random()}.txt`;
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
await apiClientFactory.createUser({ username: username2 });

actionUser = await NodesApi.initialize(username, username);
parentId = (await actionUser.createFolder(parent)).entry.id;
file1Id = (await actionUser.createFile(file1, parentId)).entry.id;
file2Id = (await actionUser.createFile(file2, parentId)).entry.id;
} 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 () => {
actionUser = await NodesApi.initialize(username, username);
const trashcanApi = await TrashcanApi.initialize(username, username);
await actionUser.deleteNodeById(parentId);
await trashcanApi.emptyTrashcan();
});

test('[C217313] File / folder not found', async ({ personalFiles }) => {
await actionUser.deleteNodeById(file1Id, false);
await personalFiles.navigate({ remoteUrl: `#/personal-files/${file1Id}` });

expect(await personalFiles.errorDialog.genericError.isVisible(), 'Generic error page not displayed').toBe(true);
expect(await personalFiles.errorDialog.genericErrorTitle.innerText()).toContain(
`This item no longer exists or you don't have permission to view it.`
);
});

test('[C217314] Permission denied', async ({ personalFiles, loginPage }) => {
await loginPage.logoutUser();
await loginPage.loginUser(
{ username: username2, password: username2 },
{
withNavigation: true,
waitForLoading: true
}
);
await personalFiles.navigate({ remoteUrl: `#/personal-files/${file2Id}` });

expect(await personalFiles.errorDialog.genericError.isVisible(), 'Generic error page not displayed').toBe(true);
expect(await personalFiles.errorDialog.genericErrorTitle.innerText()).toContain(
`This item no longer exists or you don't have permission to view it.`
);
});
});
205 changes: 205 additions & 0 deletions e2e/playwright/list-views/src/tests/permissions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
/*!
* 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,
FileActionsApi,
LoginPage,
NodesApi,
SharedLinksApi,
SitesApi,
Utils,
test,
timeouts
} from '@alfresco/playwright-shared';
import { Site } from '@alfresco/js-api';

test.describe('Special permissions', () => {
const username = `userPermissions-${Utils.random()}`;
let siteApiAdmin: SitesApi;
test.beforeAll(async () => {
const apiClientFactory = new ApiClientFactory();
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
});

test.describe('file not displayed if user no longer has permissions on it', () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;

test.beforeAll(async () => {
test.setTimeout(timeouts.webServer);
const userFavoritesApi = await FavoritesPageApi.initialize(username, username);
const userFileActionApi = await FileActionsApi.initialize(username, username);
siteApiAdmin = await SitesApi.initialize('admin');
const nodeApiAdmin = await NodesApi.initialize('admin');
const shareApiAdmin = await SharedLinksApi.initialize('admin');
const shareApiUser = await SharedLinksApi.initialize(username, username);

await siteApiAdmin.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE);
await siteApiAdmin.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
const docLibId = await siteApiAdmin.getDocLibId(sitePrivate);
const fileId = (await nodeApiAdmin.createFile(fileName, docLibId)).entry.id;
await shareApiAdmin.shareFileById(fileId);
await userFavoritesApi.addFavoriteById('file', fileId);

await userFileActionApi.updateNodeContent(fileId, 'edited by user');

await userFileActionApi.waitForNodes(username, { expect: 1 });

await shareApiAdmin.waitForFilesToBeShared([fileId]);
await shareApiUser.waitForFilesToBeShared([fileId]);
});

test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});

test.afterEach(async () => {
await siteApiAdmin.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
});

test.afterAll(async () => {
await siteApiAdmin.deleteSites([sitePrivate]);
});

test('[C213173] on Recent Files', async ({ recentFilesPage }) => {
await recentFilesPage.navigate();
expect(await recentFilesPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await recentFilesPage.reload();
expect(await recentFilesPage.dataTable.isEmpty(), 'Items are still displayed').toBe(true);

Check failure on line 101 in e2e/playwright/list-views/src/tests/permissions.spec.ts

View workflow job for this annotation

GitHub Actions / E2e test suites: Playwright (list-views, 8)

[List Views] › src/tests/permissions.spec.ts:96:9 › Special permissions › file not displayed if user no longer has permissions on it › [C213173] on Recent Files

1) [List Views] › src/tests/permissions.spec.ts:96:9 › Special permissions › file not displayed if user no longer has permissions on it › [C213173] on Recent Files Error: Items are still displayed Expected: true Received: false 99 | await siteApiAdmin.deleteSiteMember(sitePrivate, username); 100 | await recentFilesPage.reload(); > 101 | expect(await recentFilesPage.dataTable.isEmpty(), 'Items are still displayed').toBe(true); | ^ 102 | }); 103 | 104 | test('[C213227] on Favorites', async ({ favoritePage }) => { at /home/runner/work/alfresco-content-app/alfresco-content-app/e2e/playwright/list-views/src/tests/permissions.spec.ts:101:86
});

test('[C213227] on Favorites', async ({ favoritePage }) => {
await favoritePage.navigate();
expect(await favoritePage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await favoritePage.reload();
expect(await favoritePage.dataTable.isEmpty(), 'Items are still displayed').toBe(true);
});

test('[C213116] on Shared Files', async ({ sharedPage }) => {
await sharedPage.navigate();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
await siteApiAdmin.deleteSiteMember(sitePrivate, username);
await sharedPage.reload();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(0);
});

test('[C290122] on Search Results', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor(fileName);
await searchPage.dataTable.spinnerWaitForReload();

expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);

await siteApiAdmin.deleteSiteMember(sitePrivate, username);

await searchPage.reload();
await searchPage.dataTable.spinnerWaitForReload();

expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(0);
});
});

test.describe(`Location column is empty if user doesn't have permissions on the file's parent folder`, () => {
const sitePrivate = `private-${Utils.random()}`;
const fileName = `file-${Utils.random()}.txt`;
let adminSiteApiActions: SitesApi;

test.beforeAll(async () => {
test.setTimeout(timeouts.webServer);
const userFavoritesApi = await FavoritesPageApi.initialize(username, username);
const userShareActionApi = await SharedLinksApi.initialize(username, username);
const userNodeActionApi = await NodesApi.initialize(username, username);
adminSiteApiActions = await SitesApi.initialize('admin');

await adminSiteApiActions.createSite(sitePrivate, Site.VisibilityEnum.PRIVATE);
await adminSiteApiActions.addSiteMember(sitePrivate, username, Site.RoleEnum.SiteCollaborator);
const docLibId = await adminSiteApiActions.getDocLibId(sitePrivate);
const fileId = (await userNodeActionApi.createFile(fileName, docLibId)).entry.id;
await userFavoritesApi.addFavoriteById('file', fileId);

await userShareActionApi.shareFileById(fileId);
await userShareActionApi.waitForFilesToBeShared([fileId]);
await adminSiteApiActions.deleteSiteMember(sitePrivate, username);
});

test.beforeEach(async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.loginUser(
{ username, password: username },
{
withNavigation: true,
waitForLoading: true
}
);
});

test.afterAll(async () => {
await adminSiteApiActions.deleteSites([sitePrivate]);
});

test('[C213178] on Recent Files', async ({ recentFilesPage }) => {
await recentFilesPage.navigate();
expect(await recentFilesPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await recentFilesPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});

test('[C213672] on Favorites', async ({ favoritePage }) => {
await favoritePage.navigate();
expect(await favoritePage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await favoritePage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});

test(`[C213668] on Shared Files`, async ({ sharedPage }) => {
await sharedPage.navigate();
expect(await sharedPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await sharedPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});

test('[C306868] on Search results', async ({ personalFiles, searchPage }) => {
await personalFiles.acaHeader.searchButton.click();
await searchPage.searchInput.searchButton.click();
await searchPage.searchOverlay.checkFilesAndFolders();
await searchPage.searchOverlay.searchFor(fileName);
await searchPage.dataTable.spinnerWaitForReload();

expect(await searchPage.dataTable.getRowsCount(), 'Incorrect number of items').toBe(2);
expect(await searchPage.dataTable.getItemLocationText(fileName)).toEqual('Unknown');
});
});
});
Loading
Loading