code cleanup (#3210)

* 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
This commit is contained in:
Denys Vuika
2023-05-22 08:23:35 +01:00
committed by GitHub
parent 19e31adbb9
commit fd495f6e95
87 changed files with 197 additions and 841 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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', () => {
@@ -76,7 +76,7 @@ describe('Edit offline', () => {
});
afterAll(async () => {
userActions.login(username, username);
await userActions.login(username, username);
await userActions.deleteNodes([parentPFId]);
});

View File

@@ -71,15 +71,15 @@ 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 () => {
@@ -87,12 +87,12 @@ describe('Upload files', () => {
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);
});
});

View File

@@ -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);
@@ -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]);
});
@@ -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 });

View File

@@ -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;
});

View File

@@ -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);
@@ -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);
});
});
});

View File

@@ -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 () => {
@@ -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 () => {

View File

@@ -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]);
}
});
@@ -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 () => {

View File

@@ -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 () => {

View File

@@ -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 () => {

View File

@@ -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 () => {

View File

@@ -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();
@@ -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 () => {
@@ -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);
@@ -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', () => {
@@ -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 () => {
@@ -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);
});
});
@@ -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 () => {
@@ -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();
@@ -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 () => {
@@ -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);
@@ -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 () => {
@@ -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();
});