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-6572] break dependency on adf-testing #3594

Merged
merged 8 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 3 additions & 10 deletions e2e/playwright/copy-move-actions/src/tests/copy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import { ApiClientFactory, test, Utils, PersonalFilesPage, NodesApi, LoginPage } from '@alfresco/playwright-shared';
import { expect } from '@playwright/test';
import { Logger } from '@alfresco/adf-testing';

test.describe('Copy actions', () => {
let nodesApi: NodesApi;
Expand All @@ -45,17 +44,13 @@ test.describe('Copy actions', () => {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
} catch (error) {
Logger.error(`beforeAll failed : ${error}`);
}
} catch {}
});

test.afterAll(async ({ nodesApiAction }) => {
try {
await nodesApiAction.deleteCurrentUserNodes();
} catch (error) {
Logger.error(`afterAll failed : ${error}`);
}
} catch {}
});

test.beforeEach(async ({ personalFiles, page }) => {
Expand All @@ -79,9 +74,7 @@ test.describe('Copy actions', () => {
sourceFileId = (await nodesApi.createFile(sourceFile)).entry.id;

await personalFiles.navigate();
} catch (error) {
Logger.error(`beforeEach failed : ${error}`);
}
} catch {}
});

const copyContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import { ApiClientFactory, MyLibrariesPage, NodesApi, SitesApi, test, Utils } from '@alfresco/playwright-shared';
import { expect } from '@playwright/test';
import { Site } from '@alfresco/js-api';
import { Logger } from '@alfresco/adf-testing';

test.describe('Copy Move actions', () => {
let nodesApi: NodesApi;
Expand Down Expand Up @@ -63,18 +62,14 @@ test.describe('Copy Move actions', () => {

await nodesApi.createFile(sourceFile, docLibId);
await nodesApi.createFolder(destinationFolder, docLibId);
} catch (error) {
Logger.error(`beforeAll failed : ${error}`);
}
} catch {}
});

test.afterAll(async () => {
try {
await nodesApi.deleteCurrentUserNodes();
await sitesApi.deleteSites([siteId]);
} catch (error) {
Logger.error(`afterAll failed : ${error}`);
}
} catch {}
});

const copyContentInMyLibraries = async (myLibrariesPage: MyLibrariesPage) => {
Expand Down
13 changes: 3 additions & 10 deletions e2e/playwright/copy-move-actions/src/tests/move.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import { ApiClientFactory, test, Utils, PersonalFilesPage, NodesApi, LoginPage } from '@alfresco/playwright-shared';
import { expect } from '@playwright/test';
import { Logger } from '@alfresco/adf-testing';

test.describe('Move actions', () => {
let nodesApi: NodesApi;
Expand All @@ -45,17 +44,13 @@ test.describe('Move actions', () => {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username });
nodesApi = await NodesApi.initialize(username, username);
} catch (error) {
Logger.error(`beforeAll failed : ${error}`);
}
} catch {}
});

test.afterAll(async ({ nodesApiAction }) => {
try {
await nodesApiAction.deleteCurrentUserNodes();
} catch (error) {
Logger.error(`afterAll failed : ${error}`);
}
} catch {}
});

test.beforeEach(async ({ personalFiles, page }) => {
Expand All @@ -79,9 +74,7 @@ test.describe('Move actions', () => {
sourceFileId = (await nodesApi.createFile(sourceFile)).entry.id;

await personalFiles.navigate();
} catch (error) {
Logger.error(`beforeEach failed : ${error}`);
}
} catch {}
});

const moveContentInPersonalFiles = async (personalFilesPage: PersonalFilesPage, sourceFileList: string[], destinationName: string) => {
Expand Down
9 changes: 2 additions & 7 deletions e2e/playwright/viewer/src/tests/viewer-useraction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import { expect } from '@playwright/test';
import { ApiClientFactory, FileActionsApi, LoginPage, NodesApi, SitesApi, test, TEST_FILES, Utils } from '@alfresco/playwright-shared';
import { SiteBodyCreate } from '@alfresco/js-api';
import { Logger } from '@alfresco/adf-testing';

test.describe('from File Libraries', () => {
const apiClientFactory = new ApiClientFactory();
Expand All @@ -50,9 +49,7 @@ test.describe('from File Libraries', () => {
const node = await nodesApi.createFolder(destination);
destinationId = node.entry.id;
await fileApi.uploadFile(TEST_FILES.XLSX.path, xlsxLibraries, docLibId);
} catch (error) {
Logger.error(`beforeAll failed : ${error}`);
}
} catch {}
});

test.beforeEach(async ({ page }) => {
Expand All @@ -70,9 +67,7 @@ test.describe('from File Libraries', () => {
try {
await sitesApi.deleteSites([siteName]);
await nodesApi.deleteNodes([destinationId]);
} catch (error) {
Logger.error(`afterAll failed : ${error}`);
}
} catch {}
});

test('[C286371] Move action from File Libraries', async ({ myLibrariesPage, personalFiles }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { Logger } from '@alfresco/adf-testing';

describe('Delete and undo delete', () => {
const username = `user-${Utils.random()}`;
Expand Down Expand Up @@ -120,9 +119,7 @@ describe('Delete and undo delete', () => {
await userActions.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]);
await userActions.deleteNodes([parentId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
} catch {}
});

it('[C217125] delete a file and check notification', async () => {
Expand Down
29 changes: 14 additions & 15 deletions e2e/protractor/suites/actions/delete/permanently-delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { AdminActions, UserActions, LoginPage, BrowsingPage, ConfirmDialog, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { BrowserActions } from '@alfresco/adf-testing';
import { AdminActions, UserActions, LoginPage, BrowsingPage, ConfirmDialog, RepoClient, Utils, click } from '@alfresco/aca-testing-shared';

describe('Permanently delete from Trash', () => {
const username = `user-${Utils.random()}`;
Expand Down Expand Up @@ -54,8 +53,8 @@ describe('Permanently delete from Trash', () => {
beforeAll(async () => {
await adminApiActions.createUser({ username });

filesIds = (await apis.user.nodes.createFiles([file1, file2, file3])).list.entries.map((entries: any) => entries.entry.id);
foldersIds = (await apis.user.nodes.createFolders([folder1, folder2])).list.entries.map((entries: any) => entries.entry.id);
filesIds = (await apis.user.nodes.createFiles([file1, file2, file3])).list.entries.map((entries) => entries.entry.id);
foldersIds = (await apis.user.nodes.createFolders([folder1, folder2])).list.entries.map((entries) => entries.entry.id);
await apis.user.sites.createSite(site);

await userActions.login(username, username);
Expand All @@ -76,39 +75,39 @@ describe('Permanently delete from Trash', () => {

it('[C217091] delete a file', async () => {
await dataTable.selectItem(file1);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();
await BrowserActions.click(confirmDialog.deleteButton);
await click(confirmDialog.deleteButton);

expect(await page.getSnackBarMessage()).toEqual(`${file1} deleted`);
expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not deleted');
});

it('[C280416] delete a folder', async () => {
await dataTable.selectItem(folder1);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();
await BrowserActions.click(confirmDialog.deleteButton);
await click(confirmDialog.deleteButton);

expect(await page.getSnackBarMessage()).toEqual(`${folder1} deleted`);
expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not deleted');
});

it('[C290103] delete a library', async () => {
await dataTable.selectItem(site);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();
await BrowserActions.click(confirmDialog.deleteButton);
await click(confirmDialog.deleteButton);

expect(await page.getSnackBarMessage()).toEqual(`${site} deleted`);
expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not deleted`);
});

it('[C280417] delete multiple items', async () => {
await dataTable.selectMultipleItems([file2, folder2]);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();
await BrowserActions.click(confirmDialog.deleteButton);
await click(confirmDialog.deleteButton);

expect(await page.getSnackBarMessage()).toEqual(`2 items deleted`);
expect(await dataTable.isItemPresent(file2)).toBe(false, 'Item was not deleted');
Expand All @@ -117,7 +116,7 @@ describe('Permanently delete from Trash', () => {

it('[C269113] Confirmation dialog UI', async () => {
await dataTable.selectItem(file3);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();

expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open');
Expand All @@ -132,11 +131,11 @@ describe('Permanently delete from Trash', () => {

it('[C269115] Keep action cancels the deletion', async () => {
await dataTable.selectItem(file3);
await BrowserActions.click(toolbar.permanentlyDeleteButton);
await click(toolbar.permanentlyDeleteButton);
await page.waitForDialog();

expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled');
await BrowserActions.click(confirmDialog.keepButton);
await click(confirmDialog.keepButton);
expect(await dataTable.isItemPresent(file3)).toBe(true, 'Item was deleted');
});
});
25 changes: 11 additions & 14 deletions e2e/protractor/suites/actions/delete/restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
*/

import { browser } from 'protractor';
import { AdminActions, UserActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils } from '@alfresco/aca-testing-shared';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
import { AdminActions, UserActions, LoginPage, BrowsingPage, APP_ROUTES, RepoClient, Utils, click } from '@alfresco/aca-testing-shared';

describe('Restore from Trash', () => {
const username = `user-${Utils.random()}`;
Expand Down Expand Up @@ -77,7 +76,7 @@ describe('Restore from Trash', () => {

it('[C217177] restore file', async () => {
await dataTable.selectItem(file);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
expect(text).toContain(`${file} restored`);
const action = await page.getSnackBarAction();
Expand All @@ -91,7 +90,7 @@ describe('Restore from Trash', () => {

it('[C280438] restore folder', async () => {
await dataTable.selectItem(folder);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
expect(text).toContain(`${folder} restored`);
const action = await page.getSnackBarAction();
Expand All @@ -105,7 +104,7 @@ describe('Restore from Trash', () => {

it('[C290104] restore library', async () => {
await dataTable.selectItem(site);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
expect(text).toContain(`${site} restored`);
const action = await page.getSnackBarAction();
Expand All @@ -117,7 +116,7 @@ describe('Restore from Trash', () => {

it('[C217182] restore multiple items', async () => {
await dataTable.selectMultipleItems([file, folder]);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
const text = await page.getSnackBarMessage();
expect(text).toContain(`Restore successful`);
const action = await page.getSnackBarAction();
Expand All @@ -133,7 +132,7 @@ describe('Restore from Trash', () => {

it('[C217181] View from notification', async () => {
await dataTable.selectItem(file);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
await page.clickSnackBarAction();
await page.dataTable.waitForHeader();
expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
Expand Down Expand Up @@ -181,13 +180,13 @@ describe('Restore from Trash', () => {

it('[C217178] Restore a file when another file with same name exists on the restore location', async () => {
await dataTable.selectItem(file1);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`);
});

it('[C217179] Restore a file when original location no longer exists', async () => {
await dataTable.selectItem(file2);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`);
});
});
Expand Down Expand Up @@ -231,9 +230,7 @@ describe('Restore from Trash', () => {

await userActions.deleteNodes([file3Id, file4Id, folder3Id, file5Id], false);
await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
} catch {}
});

beforeEach(async () => {
Expand All @@ -247,13 +244,13 @@ describe('Restore from Trash', () => {

it('[C217183] one failure', async () => {
await dataTable.selectMultipleItems([file1, file2]);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file1}, the original location no longer exists`);
});

it('[C217184] multiple failures', async () => {
await dataTable.selectMultipleItems([file3, file4, file5]);
await BrowserActions.click(toolbar.restoreButton);
await click(toolbar.restoreButton);
expect(await page.getSnackBarMessage()).toEqual('2 items not restored because of issues with the restore location');
});
});
Expand Down
Loading
Loading