Skip to content

Commit

Permalink
implementing reviews comments
Browse files Browse the repository at this point in the history
  • Loading branch information
azakrzewski-hy committed Nov 29, 2023
1 parent bea2bb9 commit aa865dc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
34 changes: 16 additions & 18 deletions e2e/playwright/actions/src/tests/library/library-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
import { Site } from '@alfresco/js-api';

test.describe('Library actions ', () => {
const apiClientFactory = new ApiClientFactory();
const notMemberString = 'Not a member';
const managerRole = 'Manager';
const contributorRole = 'Contributor';
Expand All @@ -51,8 +50,6 @@ test.describe('Library actions ', () => {
const cancelJoinRequestButton = 'Cancel Join Request';
const cancelJoinRequestMessage = 'Canceled the request to join the library';
const leaveLibraryButton = 'Leave Library';
const leaveDialogTitle = 'Leave this library?';
const leaveDialogContent = 'Leaving will remove your access.';
const leftMessage = 'You have left the library';
const favoriteButton = 'Favorite';
const removeFavoriteButton = 'Remove Favorite';
Expand All @@ -62,7 +59,6 @@ test.describe('Library actions ', () => {
const loadString = 'load';
const domContentLoadedString = 'domcontentloaded';

const username1 = `user-${Utils.random()}`;
const username2 = `user-${Utils.random()}`;
const adminLibrary1 = `playwright-A-library-${Utils.random()}`;
const adminLibrary2 = `playwright-A-library-${Utils.random()}`;
Expand All @@ -85,24 +81,26 @@ test.describe('Library actions ', () => {
const user2Library6Delete = `playwright-T-library-${Utils.random()}`;
const user2Library7Delete = `playwright-T-library-${Utils.random()}`;

const adminLibraryIds: string[] = [adminLibrary1, adminLibrary2, adminLibrary3, adminLibrary4];
const adminModerateLibraryIds: string[] = [adminModerateLibrary1, adminModerateLibrary2, adminModerateLibrary3, adminModerateLibrary4];
const user1LibraryIds: string[] = [user1Library1, user1Library2, user1Library3, user1Library4, user1Library5];
const siteRoles: string[] = [
Site.RoleEnum.SiteManager,
Site.RoleEnum.SiteContributor,
Site.RoleEnum.SiteCollaborator,
Site.RoleEnum.SiteConsumer,
Site.RoleEnum.SiteManager
];
const user2LibraryIds: string[] = [user2Library1, user2Library2, user2Library3, user2Library4];
const user2LibraryIdsDelete: string[] = [user2Library5Delete, user2Library6Delete, user2Library7Delete];
const adminLibraryIds = [adminLibrary1, adminLibrary2, adminLibrary3, adminLibrary4];
const adminModerateLibraryIds = [adminModerateLibrary1, adminModerateLibrary2, adminModerateLibrary3, adminModerateLibrary4];
const user1LibraryIds = [user1Library1, user1Library2, user1Library3, user1Library4, user1Library5];
const user2LibraryIds = [user2Library1, user2Library2, user2Library3, user2Library4];

let adminSitesApi: SitesApi;
let user2SitesApi: SitesApi;

test.beforeAll(async () => {
test.setTimeout(timeouts.extendedTest);
const apiClientFactory = new ApiClientFactory();
const username1 = `user-${Utils.random()}`;
const siteRoles = [
Site.RoleEnum.SiteManager,
Site.RoleEnum.SiteContributor,
Site.RoleEnum.SiteCollaborator,
Site.RoleEnum.SiteConsumer,
Site.RoleEnum.SiteManager
];
const user2LibraryIdsDelete = [user2Library5Delete, user2Library6Delete, user2Library7Delete];
try {
await apiClientFactory.setUpAcaBackend('admin');
await apiClientFactory.createUser({ username: username1 });
Expand Down Expand Up @@ -189,8 +187,8 @@ test.describe('Library actions ', () => {
test('[C290106] Leave a library from My Libraries', async () => {
await expect(libraryTable.getCellByColumnNameAndRowItem(user1Library1, managerRole)).toBeVisible();
await libraryTable.performActionFromExpandableMenu(user1Library1, leaveLibraryButton);
await expect.soft(confirmDialog.getDialogTitle(leaveDialogTitle)).toBeVisible();
await expect.soft(confirmDialog.getDialogContent(leaveDialogContent)).toBeVisible();
await expect.soft(confirmDialog.getDialogTitle('Leave this library?')).toBeVisible();
await expect.soft(confirmDialog.getDialogContent('Leaving will remove your access.')).toBeVisible();
await expect.soft(confirmDialog.okButton).toBeVisible();
await expect.soft(confirmDialog.cancelButton).toBeVisible();
await confirmDialog.okButton.click();
Expand Down
10 changes: 4 additions & 6 deletions projects/aca-playwright-shared/src/api/sites-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

import { ApiClientFactory } from './api-client-factory';
import { Site, SiteBodyCreate, SiteEntry, SiteMemberEntry, SiteMembershipBodyCreate, SiteMembershipBodyUpdate, SiteMembershipRequestEntry } from '@alfresco/js-api';
import { Site, SiteBodyCreate, SiteEntry, SiteMemberEntry, SiteMembershipBodyCreate, SiteMembershipBodyUpdate, SiteMembershipRequestBodyCreate, SiteMembershipRequestEntry } from '@alfresco/js-api';

export class SitesApi {
private apiService: ApiClientFactory;
Expand Down Expand Up @@ -113,7 +113,7 @@ export class SitesApi {
async createSiteMembershipRequestForPerson(personId: string, siteId: string): Promise<SiteMembershipRequestEntry> {
const body = {
id: siteId
};
} as SiteMembershipRequestBodyCreate;

try {
return await this.apiService.sites.createSiteMembershipRequestForPerson(personId, body);
Expand All @@ -123,11 +123,9 @@ export class SitesApi {
}
}

async approveSiteMembershipRequest(siteId: string, inviteeId: string, opts?: {
siteMembershipApprovalBody?: string;
}): Promise<SiteMemberEntry> {
async approveSiteMembershipRequest(siteId: string, inviteeId: string): Promise<SiteMemberEntry> {
try {
return await this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId, opts);
return await this.apiService.sites.approveSiteMembershipRequest(siteId, inviteeId);
} catch (error) {
console.error(`SitesApi approveSiteMembershipRequest : catch : `, error);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ export class AdfConfirmDialogComponent extends BaseComponent {
getDialogContent = (text: string) => this.getChild('[data-automation-id="adf-confirm-dialog-base-message"]', { hasText: text });
okButton = this.getChild('[data-automation-id="adf-confirm-dialog-confirmation"]');
cancelButton = this.getChild('[data-automation-id="adf-confirm-dialog-reject"]');

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndEnabled } from '../../utilities/utils';

export class ConfirmDialog extends GenericDialog {
okButton = this.childElement(by.buttonText('OK'));
cancelButton = this.childElement(by.buttonText('Cancel'));
keepButton = this.childElement(by.buttonText('Keep'));
deleteButton = this.childElement(by.buttonText('Delete'));
Expand All @@ -41,10 +40,6 @@ export class ConfirmDialog extends GenericDialog {
return this.content.getText();
}

async isOkEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.okButton);
}

async isCancelEnabled(): Promise<boolean> {
return isPresentAndEnabled(this.cancelButton);
}
Expand Down
2 changes: 0 additions & 2 deletions projects/aca-testing-shared/src/components/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export class Toolbar extends Component {
downloadButton = element(By.css(`.mat-icon-button[title='Download']`));
viewDetailsButton = element(By.css(`button[title='View Details']`));
printButton = element(By.css(`button[title='Print']`));
joinButton = element(By.css(`button[title='Join']`));
leaveButton = element(By.css(`button[title='Leave Library']`));
permanentlyDeleteButton = element(By.css(`button[title='Permanently Delete']`));
restoreButton = element(By.css(`button[title='Restore']`));
searchIconButton = element(By.css(`button[title='Search']`));
Expand Down

0 comments on commit aa865dc

Please sign in to comment.