Skip to content

Commit

Permalink
code cleanup (#3210)
Browse files Browse the repository at this point in the history
* code cleanup

* rollback changes

* remove dead code

* remove debug app config

* cleanup unused locales

* no-unused-vars rule

* test fixes and cleanup

* remove unnecessary translate modules
  • Loading branch information
DenysVuika authored May 22, 2023
1 parent 19e31ad commit fd495f6
Show file tree
Hide file tree
Showing 87 changed files with 197 additions and 841 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/no-unused-vars": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/member-ordering": "off",
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/custom-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class YourExtensionViewerComponent implements ViewerExtensionInterface {
node: Node;


....YOUR CUSTOM LOGIC
// ....YOUR CUSTOM LOGIC
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { Locator, Page } from '@playwright/test';
import { PlaywrightBase } from '../playwright-base';

export abstract class BaseComponent extends PlaywrightBase {
private rootElement: string;
private readonly rootElement: string;
private overlayElement = this.page.locator('.cdk-overlay-backdrop-showing');

constructor(page: Page, rootElement: string) {
protected constructor(page: Page, rootElement: string) {
super(page);
this.rootElement = rootElement;
}
Expand Down
6 changes: 3 additions & 3 deletions e2e/playwright/shared/page-objects/pages/base.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export interface NavigateOptions {
remoteUrl?: string;
}
export abstract class BasePage extends PlaywrightBase {
private pageUrl: string;
private urlRequest: RegExp;
private readonly pageUrl: string;
private readonly urlRequest: RegExp;
public snackBar: SnackBarComponent;
public spinner: SpinnerComponent;

constructor(page: Page, pageUrl: string, urlRequest?: RegExp) {
protected constructor(page: Page, pageUrl: string, urlRequest?: RegExp) {
super(page);
this.pageUrl = pageUrl;
this.urlRequest = urlRequest;
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/shared/page-objects/playwright-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export abstract class PlaywrightBase {
public page: Page;
public logger: LoggerLike;

constructor(page: Page) {
protected constructor(page: Page) {
this.page = page;
this.logger = new GenericLogger(process.env.PLAYWRIGHT_CUSTOM_LOG_LEVEL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Locked Files - available actions : ', () => {

beforeAll(async () => {
await adminApiActions.createUser({ username });
userActions.login(username, username);
await userActions.login(username, username);

parentId = await userApi.createFolder(parentName);

Expand Down
4 changes: 2 additions & 2 deletions e2e/suites/actions/edit/edit-offline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Edit offline', () => {

beforeAll(async () => {
await adminApiActions.createUser({ username });
userActions.login(username, username);
await userActions.login(username, username);
});

describe('on Personal Files', () => {
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('Edit offline', () => {
});

afterAll(async () => {
userActions.login(username, username);
await userActions.login(username, username);
await userActions.deleteNodes([parentPFId]);
});

Expand Down
12 changes: 6 additions & 6 deletions e2e/suites/actions/upload-download/upload-file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,28 @@ describe('Upload files', () => {
it('[T14752064] Close the upload dialog ', async () => {
await page.uploadFilesDialog.closeUploadButton.click();
await page.uploadFilesDialog.uploadDialog.isPresent();
await expect(await page.uploadFilesDialog.uploadDialog.isVisible()).toBe(false);
expect(await page.uploadFilesDialog.uploadDialog.isVisible()).toBe(false);
});

it('[T14752051] Minimize / maximize the upload dialog ', async () => {
await page.uploadFilesDialog.minimizeButton.click();
await expect(await page.uploadFilesDialog.uploadedFiles.waitNotVisible()).toBe(true);
expect(await page.uploadFilesDialog.uploadedFiles.waitNotVisible()).toBe(true);

await page.uploadFilesDialog.maximizeButton.click();
await expect(await page.uploadFilesDialog.uploadedFiles.waitVisible()).toBe(true);
expect(await page.uploadFilesDialog.uploadedFiles.waitVisible()).toBe(true);
});

it('[T14752053] Upload history is expunged on browser login/logout ', async () => {
await page.signOut();
await loginPage.loginWith(username);
const isUploadDialogVisible = await page.uploadFilesDialog.uploadDialog.isVisible();

await expect(isUploadDialogVisible).toBe(false);
expect(isUploadDialogVisible).toBe(false);
});

it('[T14752052] Upload dialog remains fixed in the browser when user performs other actions in parallel ', async () => {
await expect(page.uploadFilesDialog.uploadDialog.isVisible()).toBe(true);
expect(page.uploadFilesDialog.uploadDialog.isVisible()).toBe(true);
await page.clickPersonalFiles();
await expect(page.uploadFilesDialog.uploadDialog.isVisible()).toBe(true);
expect(page.uploadFilesDialog.uploadDialog.isVisible()).toBe(true);
});
});
6 changes: 3 additions & 3 deletions e2e/suites/actions/upload-download/upload-new-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('Upload new version', () => {

beforeAll(async () => {
await adminActions.createUser({ username });
userActions.login(username, username);
await userActions.login(username, username);

parentPFId = await apis.user.createFolder(parentPF);
parentSFId = await apis.user.createFolder(parentSF);
Expand All @@ -111,7 +111,7 @@ describe('Upload new version', () => {
});

afterAll(async () => {
userActions.login(username, username);
await userActions.login(username, username);
await userActions.deleteNodes([parentPFId, parentSFId, parentRFId, parentFavId, parentSearchId]);
});

Expand All @@ -126,7 +126,7 @@ describe('Upload new version', () => {
fileLockedSearch1Id = await apis.user.createFile(fileLockedSearch1, parentSearchId);
fileLockedSearch2Id = await apis.user.createFile(fileLockedSearch2, parentSearchId);

userActions.lockNodes([fileLockedSearch1Id, fileLockedSearch2Id]);
await userActions.lockNodes([fileLockedSearch1Id, fileLockedSearch2Id]);

await apis.user.search.waitForNodes(searchRandom, { expect: 6 });

Expand Down
2 changes: 1 addition & 1 deletion e2e/suites/application/general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('General', () => {

describe('on session expire', () => {
beforeAll(async () => {
adminActions.login();
await adminActions.login();
folderId = (await adminActions.nodes.createFolder(folder)).entry.id;
});

Expand Down
4 changes: 2 additions & 2 deletions e2e/suites/info-drawer/file-folder-properties.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ describe('File / Folder properties', () => {
await BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.expandDetailsButton.click();
await expect(await infoDrawer.expandedDetailsPermissionsTab.isPresent()).toBe(true, 'Permissions tab is not displayed');
expect(await infoDrawer.expandedDetailsPermissionsTab.isPresent()).toBe(true, 'Permissions tab is not displayed');

await page.clickPersonalFilesAndWait();
await dataTable.selectItem(parent);
Expand All @@ -262,7 +262,7 @@ describe('File / Folder properties', () => {
const expectedSelectedTabTitle = 'permissions';
const actualSelectedTabTitle = await infoDrawer.selectedTab.getText();

await expect(actualSelectedTabTitle.toLowerCase()).toEqual(expectedSelectedTabTitle);
expect(actualSelectedTabTitle.toLowerCase()).toEqual(expectedSelectedTabTitle);
});
});
});
12 changes: 6 additions & 6 deletions e2e/suites/list-views/favorites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ describe('Favorites', () => {
});

it('[C213226] displays the favorite files and folders', async () => {
await expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed');
await expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`);
await expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`);
await expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`);
expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed');
expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`);
expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`);
expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`);
});

it(`[C213228] deleted favorite file does not appear`, async () => {
Expand All @@ -124,12 +124,12 @@ describe('Favorites', () => {

it('[C213650] Location column redirect - item in user Home', async () => {
await dataTable.clickItemLocation(favFolderName);
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
});

it('[C280484] Location column redirect - file in folder', async () => {
await dataTable.clickItemLocation(fileName2);
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]);
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]);
});

it('[C280485] Location column redirect - file in site', async () => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/suites/list-views/file-libraries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('File Libraries', () => {
const sitesList = await dataTable.getSitesNameAndVisibility();

for (const site of Object.keys(expectedSitesVisibility)) {
await expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
}
});

Expand All @@ -139,14 +139,14 @@ describe('File Libraries', () => {
const sitesList = await dataTable.getSitesNameAndRole();

for (const site of Object.keys(expectedSitesRoles)) {
await expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
}
});

it('[C217098] Site ID is displayed when two sites have the same name', async () => {
const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`];
const actualSites = await dataTable.getCellsContainingName(siteName);
await expect(actualSites.sort()).toEqual(expectedSites.sort());
expect(actualSites.sort()).toEqual(expectedSites.sort());
});

it('[C217096] Tooltip for sites without description', async () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/suites/list-views/personal-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ describe('Personal Files', () => {
});

it('[C217143] has default sorted column', async () => {
await expect(await dataTable.getSortedColumnHeaderText()).toBe('Name');
expect(await dataTable.getSortedColumnHeaderText()).toBe('Name');
});

it('[C213242] has user created content', async () => {
await expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed');
expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed');
});

it('[C213244] navigates to folder', async () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/suites/list-views/recent-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Recent Files', () => {

it('[C213176] Location column redirect - file in user Home', async () => {
await dataTable.clickItemLocation(fileName2);
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
});

it('[C280486] Location column redirect - file in folder', async () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/suites/list-views/shared-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('Shared Files', () => {

it('[C213666] Location column redirect - file in user Home', async () => {
await dataTable.clickItemLocation(file4User);
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
});

it('[C280490] Location column redirect - file in folder', async () => {
Expand Down
24 changes: 12 additions & 12 deletions e2e/suites/list-views/sort-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(expectedSortData).not.toEqual(initialSortState, 'Initial sort did not work');
expect(expectedSortData).not.toEqual(initialSortState);

await browsingPage.clickFavorites();
await browsingPage.clickPersonalFilesAndWait();
Expand All @@ -133,7 +133,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).toEqual(expectedSortData, 'Order is different - sorting was not retained');
expect(actualSortData).toEqual(expectedSortData);
});

it('[C261137] Size sort order is retained when user logs out and logs back in', async () => {
Expand All @@ -147,7 +147,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(expectedSortData).not.toEqual(initialSortState, 'Initial sort did not work');
expect(expectedSortData).not.toEqual(initialSortState);

await browsingPage.signOut();
await loginPage.loginWith(user1);
Expand All @@ -158,7 +158,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).toEqual(expectedSortData, 'Order is different - sorting was not retained');
expect(actualSortData).toEqual(expectedSortData);
});

describe('Folder actions', () => {
Expand Down Expand Up @@ -196,7 +196,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).toEqual(expectedSortData, 'Order is different - sorting was not retained');
expect(actualSortData).toEqual(expectedSortData);
});

it('[C261139] Sort order is retained when moving a file', async () => {
Expand All @@ -218,7 +218,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).toEqual(expectedSortData, 'Order is different - sorting was not retained');
expect(actualSortData).toEqual(expectedSortData);
});
});

Expand All @@ -243,7 +243,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).toEqual(expectedSortData, 'Order is different - sorting was not retained');
expect(actualSortData).toEqual(expectedSortData);
});

it('[C261153] Sort order should be remembered separately on each list view', async () => {
Expand All @@ -268,7 +268,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(favouritesSortData).not.toEqual(personalFilesSortData, 'Order is the same - sorting was retained');
expect(favouritesSortData).not.toEqual(personalFilesSortData);

await browsingPage.clickPersonalFilesAndWait();

Expand All @@ -278,7 +278,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(personalFilesSortDataAfterFavSort).toEqual(personalFilesSortData, 'Order is different - sorting was not retained');
expect(personalFilesSortDataAfterFavSort).toEqual(personalFilesSortData);
});

it('[C261147] Sort order is retained when user changes the page from pagination', async () => {
Expand All @@ -300,7 +300,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(currentPersonalFilesSortDataPage2).toEqual(expectedPersonalFilesSortDataPage2, 'Order is different- sorting was not retained');
expect(currentPersonalFilesSortDataPage2).toEqual(expectedPersonalFilesSortDataPage2);

await dataTable.sortBy('Name', 'desc');
await dataTable.waitForFirstElementToChange(currentPersonalFilesSortDataPage2.firstElement);
Expand All @@ -318,7 +318,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(expectedPersonalFilesSortDataPage2).toEqual(currentPersonalFilesSortDataPage2, 'Order is different - sorting was not retained');
expect(expectedPersonalFilesSortDataPage2).toEqual(currentPersonalFilesSortDataPage2);
});

it('[C261150] Sort order is not retained between different users', async () => {
Expand All @@ -341,7 +341,7 @@ describe('Remember sorting', () => {
firstElement: await documentListPage.dataTable.getFirstElementDetail('Name')
};

await expect(actualSortData).not.toEqual(expectedSortData, 'Order is the same - sorting was retained');
expect(actualSortData).not.toEqual(expectedSortData);

await browsingPage.signOut();
});
Expand Down
Loading

0 comments on commit fd495f6

Please sign in to comment.