[ACS-5991] ESLint fixes and code quality improvements (#8893)

* prefer-optional-chain: core

* prefer-optional-chain: content, fix typings

* prefer-optional-chain: process, fix typings

* prefer-optional-chain: process-cloud, fix typings, fix ts configs and eslint

* [ci: force] sonar errors fixes, insights lib

* [ci:force] fix security issues

* [ci:force] fix metadata e2e bug, js assignment bugs

* [ci:force] fix lint issue

* [ci:force] fix tests
This commit is contained in:
Denys Vuika
2023-09-18 09:42:16 +01:00
committed by GitHub
parent 99f591ed67
commit a1dd270c5d
203 changed files with 4155 additions and 4960 deletions

View File

@@ -19,7 +19,6 @@ import { $, by, element, Key, protractor, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility, DropdownPage, TestElement, Logger } from '@alfresco/adf-testing';
export class MetadataViewPage {
title = $(`div[info-drawer-title]`);
expandedAspect = $(`mat-expansion-panel-header[aria-expanded='true']`);
aspectTitle = `mat-panel-title`;
@@ -48,8 +47,10 @@ export class MetadataViewPage {
saveMetadataButton = $(`[data-automation-id='save-metadata']`);
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"]`);
private getExpandedMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> => $(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`);
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"]`);
private getExpandedMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`mat-expansion-panel[data-automation-id="adf-metadata-group-${groupName}"] > mat-expansion-panel-header`);
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
@@ -132,7 +133,9 @@ export class MetadataViewPage {
}
async clickOnPropertiesTab(): Promise<void> {
const propertiesTab = element(by.cssContainingText(`.adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content`, `Properties`));
const propertiesTab = element(
by.cssContainingText(`.adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content`, `Properties`)
);
await BrowserActions.click(propertiesTab);
}
@@ -208,7 +211,9 @@ export class MetadataViewPage {
}
async getMetadataGroupTitle(groupName: string): Promise<string> {
const group = $('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title');
const group = $(
'mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title'
);
return BrowserActions.getText(group);
}
@@ -225,7 +230,7 @@ export class MetadataViewPage {
return false;
}
await type.waitVisible();
const isPresent = type.isPresent();
const isPresent = await type.isPresent();
if (isPresent) {
return true;
}
@@ -269,7 +274,7 @@ export class MetadataViewPage {
} catch (error) {
Logger.log(`re trying content type options attempt :: ${attempt}`);
await BrowserActions.closeMenuAndDialogs();
return this.changeContentType(option, attempt + 1, maxAttempt);
return this.changeContentType(option, attempt + 1, maxAttempt);
}
}

View File

@@ -16,43 +16,41 @@
*/
var FormDefinitionFieldModel = function (details) {
this.fieldType;
this.id;
this.name;
this.value;
this.type;
this.required;
this.readOnly;
this.overrideId;
this.colspan;
this.placeholder;
this.minLength;
this.maxLength;
this.minValue;
this.maxValue;
this.regexPattern;
this.optionType;
this.hasEmptyValue;
this.options;
this.restUrl;
this.restResponsePath;
this.restIdProperty;
this.setRestLabelProperty;
this.tab;
this.className;
this.dateDisplayFormat;
this.fieldType = undefined;
this.id = undefined;
this.name = undefined;
this.value = undefined;
this.type = undefined;
this.required = undefined;
this.readOnly = undefined;
this.overrideId = undefined;
this.colspan = undefined;
this.placeholder = undefined;
this.minLength = undefined;
this.maxLength = undefined;
this.minValue = undefined;
this.maxValue = undefined;
this.regexPattern = undefined;
this.optionType = undefined;
this.hasEmptyValue = undefined;
this.options = undefined;
this.restUrl = undefined;
this.restResponsePath = undefined;
this.restIdProperty = undefined;
this.setRestLabelProperty = undefined;
this.tab = undefined;
this.className = undefined;
this.dateDisplayFormat = undefined;
this.layout = {};
this.sizeX;
this.sizeY;
this.row;
this.col;
this.columnDefinitions;
this.visibilityCondition;
this.numberOfColumns;
this.sizeX = undefined;
this.sizeY = undefined;
this.row = undefined;
this.col = undefined;
this.columnDefinitions = undefined;
this.visibilityCondition = undefined;
this.numberOfColumns = undefined;
this.fields = {};
Object.assign(this, details);
};
module.exports = FormDefinitionFieldModel;

View File

@@ -16,14 +16,13 @@
*/
var FormModel = function (details) {
this.id;
this.name;
this.description;
this.modelId;
this.appDefinitionId;
this.appDeploymentId;
this.tenantId;
this.id = undefined;
this.name = undefined;
this.description = undefined;
this.modelId = undefined;
this.appDefinitionId = undefined;
this.appDeploymentId = undefined;
this.tenantId = undefined;
this.getName = function () {
return this.name;

View File

@@ -23,9 +23,8 @@
*/
var Task = function (details) {
this.processInstanceId;
this.sort;
this.processInstanceId = undefined;
this.sort = undefined;
Object.assign(this, details);
};

View File

@@ -16,11 +16,10 @@
*/
var TaskAssigneeModel = function (details) {
this.id;
this.firstName;
this.lastName;
this.email;
this.id = undefined;
this.firstName = undefined;
this.lastName = undefined;
this.email = undefined;
this.getFirstName = function () {
return this.firstName;
@@ -38,12 +37,11 @@ var TaskAssigneeModel = function (details) {
return this.email;
};
this.getEntireName = function() {
return this.firstName + " " + this.getLastName();
this.getEntireName = function () {
return this.firstName + ' ' + this.getLastName();
};
Object.assign(this, details);
};
module.exports = TaskAssigneeModel;

View File

@@ -18,19 +18,18 @@
var TaskAssigneeModel = require('./TaskAssigneeModel');
var TaskModel = function (details) {
this.id;
this.name;
this.description;
this.category;
this.created;
this.dueDate;
this.priority;
this.parentTaskName;
this.parentTaskId;
this.formKey;
this.duration;
this.endDate;
this.id = undefined;
this.name = undefined;
this.description = undefined;
this.category = undefined;
this.created = undefined;
this.dueDate = undefined;
this.priority = undefined;
this.parentTaskName = undefined;
this.parentTaskId = undefined;
this.formKey = undefined;
this.duration = undefined;
this.endDate = undefined;
this.assignee = {};
this.getName = function () {