[ci:force] - fixing lint

This commit is contained in:
VitoAlbano
2024-10-12 23:20:30 +01:00
parent 25ae62ad72
commit ed6737a380
138 changed files with 159 additions and 766 deletions

View File

@@ -99,11 +99,11 @@ export class GroupIdentityService {
/**
* Add client roles.
*
* @param groupId ID of the target group
* @param clientId ID of the client
* @param roleId ID of the clientRole
* @param roleName of the clientRole
* @returns Promise
*/
async addClientRole(groupId: string, clientId: string, roleId: string, roleName: string): Promise<any> {
const path = `/groups/${groupId}/role-mappings/clients/${clientId}`;
@@ -123,7 +123,6 @@ export class GroupIdentityService {
/**
* Gets the client ID using the app name.
*
* @param applicationName Name of the app
* @returns client ID string
*/

View File

@@ -19,11 +19,9 @@ import { StringUtil } from '../../../shared/utils/string.util';
/**
* Create tenant JSON Object
*
* @param details - JSON object used to overwrite the default values
*/
export class Tenant {
active = true;
configuration = 'DefaultConfig';
domain = 'DefaultDomain';
@@ -33,5 +31,4 @@ export class Tenant {
constructor(details?: any) {
Object.assign(this, details);
}
}

View File

@@ -142,7 +142,6 @@ export class DataTableComponentPage {
/**
* Check the list is sorted.
*
* @param sortOrder 'ASC' if the list is await expected to be sorted ascending and 'DESC' for descending
* @param columnTitle titleColumn column
* @param listType 'string' for string typed lists and 'number' for number typed (int, float) lists
@@ -278,7 +277,6 @@ export class DataTableComponentPage {
/**
* Sort the list by name column.
*
* @param sortOrder 'ASC' to sort the list ascendant and 'DESC' for descendant
* @param titleColumn column title
*/

View File

@@ -21,16 +21,13 @@ import { BrowserActions } from '../utils/browser-actions';
/** @deprecated Use Playwright API instead */
export class SnackbarPage {
notificationSnackBar = $$(`[data-automation-id='adf-snackbar-message-content']`).first();
snackBarAction = $(`[data-automation-id='adf-snackbar-message-content-action-button']`);
snackBarContainerCss = $$('adf-snackbar-content');
decorativeIconSnackBar = $(`[data-automation-id='adf-snackbar-decorative-icon']`);
async waitForSnackBarToAppear(timeout = 5000) {
return BrowserVisibility.waitUntilElementIsVisible(this.snackBarContainerCss.first(), timeout,
'snackbar did not appear'
);
return BrowserVisibility.waitUntilElementIsVisible(this.snackBarContainerCss.first(), timeout, 'snackbar did not appear');
}
async waitForSnackBarToClose(timeout = 15000) {
@@ -42,7 +39,6 @@ export class SnackbarPage {
return this.notificationSnackBar.getText();
}
/** @deprecated Use Playwright API instead */
async getSnackBarActionMessage(): Promise<string> {
await this.waitForSnackBarToAppear();
return this.snackBarAction.getText();
@@ -53,7 +49,6 @@ export class SnackbarPage {
return this.decorativeIconSnackBar.getText();
}
/** @deprecated Use Playwright API instead */
async clickSnackBarAction(): Promise<void> {
await this.waitForSnackBarToAppear();
await BrowserActions.click(this.snackBarAction);

View File

@@ -23,12 +23,10 @@ import { BrowserVisibility } from './utils/browser-visibility';
* Provides a wrapper for the most common operations with the page elements.
*/
export class TestElement {
constructor(public elementFinder: ElementFinder) {
}
constructor(public elementFinder: ElementFinder) {}
/**
* Create a new instance with the element located by the id
*
* @param id The id of the element
* @returns test element wrapper
*/
@@ -38,7 +36,6 @@ export class TestElement {
/**
* Create a new instance with the element located by the CSS class name
*
* @param selector The CSS class name to lookup
* @returns test element wrapper
*/
@@ -48,7 +45,6 @@ export class TestElement {
/**
* Create a new instance with the element that contains specific text
*
* @param selector the CSS selector
* @param text the text within the target element
* @returns test element wrapper
@@ -59,7 +55,6 @@ export class TestElement {
/**
* Create a new instance with the element with specific HTML tag name
*
* @param selector the HTML tag name
* @returns test element wrapper
*/
@@ -69,6 +64,7 @@ export class TestElement {
/**
* Performs a click on this element
* @returns a promise that will be resolved when the click command has completed
*/
async click() {
return BrowserActions.click(this.elementFinder);
@@ -76,8 +72,8 @@ export class TestElement {
/**
* Checks that an element is present on the DOM of a page and visible
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is present on the DOM of a page and visible
*/
async isVisible(waitTimeout?: number): Promise<boolean> {
try {
@@ -90,8 +86,8 @@ export class TestElement {
/**
* Waits until the element is present on the DOM of a page and visible
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is present on the DOM of a page and visible
*/
async waitVisible(waitTimeout?: number): Promise<any> {
return BrowserVisibility.waitUntilElementIsVisible(this.elementFinder, waitTimeout);
@@ -99,8 +95,8 @@ export class TestElement {
/**
* Waits until the element is either invisible or not present on the DOM
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is either invisible or not present on the DOM
*/
async waitNotVisible(waitTimeout?: number): Promise<any> {
return BrowserVisibility.waitUntilElementIsNotVisible(this.elementFinder, waitTimeout);
@@ -108,8 +104,8 @@ export class TestElement {
/**
* Checks that an element is present on the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is present on the DOM of a page
*/
async isPresent(waitTimeout?: number): Promise<boolean> {
try {
@@ -122,8 +118,8 @@ export class TestElement {
/**
* Waits until the element is present on the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is present on the DOM of a page
*/
async waitPresent(waitTimeout?: number): Promise<any> {
return BrowserVisibility.waitUntilElementIsPresent(this.elementFinder, waitTimeout);
@@ -131,8 +127,8 @@ export class TestElement {
/**
* Waits until the element is not attached to the DOM of a page
*
* @param waitTimeout How long to wait for the condition to be true
* @returns a promise that will be resolved when the element is not attached to the DOM of a page
*/
async waitNotPresent(waitTimeout?: number): Promise<any> {
return BrowserVisibility.waitUntilElementIsNotPresent(this.elementFinder, waitTimeout);
@@ -140,8 +136,8 @@ export class TestElement {
/**
* Waits until the given text is present in the elements value
*
* @param value the text to check
* @returns a promise that will be resolved when the element has the given value
*/
async waitHasValue(value: string): Promise<any> {
return BrowserVisibility.waitUntilElementHasValue(this.elementFinder, value);
@@ -149,12 +145,14 @@ export class TestElement {
/**
* Query whether the DOM element represented by this instance is enabled.
* @returns a promise that will be resolved with the enabled state of the element
*/
async isEnabled(): Promise<boolean> {
return this.elementFinder.isEnabled();
}
/**
* Query whether the DOM element represented by this instance is disabled.
* @returns a promise that will be resolved with the disabled state of the element
*/
async isDisabled(): Promise<boolean> {
return !(await this.elementFinder.isEnabled());
@@ -162,6 +160,7 @@ export class TestElement {
/**
* Test whether this element is currently displayed.
* @returns a promise that will be resolved with the displayed state of the element
*/
async isDisplayed(): Promise<boolean> {
try {
@@ -174,8 +173,8 @@ export class TestElement {
/**
* Query for the value of the given attribute of the element.
*
* @param attributeName The name of the attribute to query.
* @returns a promise that will be resolved with the value of the attribute
*/
async getAttribute(attributeName: string): Promise<string> {
return BrowserActions.getAttribute(this.elementFinder, attributeName);
@@ -183,6 +182,7 @@ export class TestElement {
/**
* Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace.
* @returns a promise that will be resolved with the visible innerText of the element
*/
async getText(): Promise<string> {
return BrowserActions.getText(this.elementFinder);
@@ -190,7 +190,6 @@ export class TestElement {
/**
* Gets the `value` attribute for the given input element
*
* @returns input value
*/
getInputValue(): Promise<string> {
@@ -199,11 +198,10 @@ export class TestElement {
/**
* Enter the text
*
* @param text the text to enter
*/
async typeText(text: string): Promise<void> {
await BrowserActions.clearSendKeys(this.elementFinder, text);
await BrowserActions.clearSendKeys(this.elementFinder, text);
}
/**

View File

@@ -16,10 +16,8 @@
*/
export class ArrayUtil {
/**
* Returns TRUE if the first array contains all elements from the second one.
*
* @param superset source array
* @param subset target array
* @returns `true` if array is included, otherwise `false`
@@ -28,6 +26,6 @@ export class ArrayUtil {
if (0 === subset.length) {
return false;
}
return subset.every((value) => (superset.indexOf(value) >= 0));
return subset.every((value) => superset.indexOf(value) >= 0);
}
}

View File

@@ -19,7 +19,6 @@ import { ElementFinder, browser } from 'protractor';
/**
* Tagged template to convert a sting to an `ElementFinder`.
*
* @example ```const item = byCss`.adf-breadcrumb-item-current`;```
* @example ```const item = byCss`${variable}`;```
* @param literals literals

View File

@@ -27,7 +27,8 @@ export class GroupCloudComponentPage {
groupField = $('group-cloud-widget .adf-readonly');
formFields = new FormFields();
getGroupRowLocatorByName = async (name: string): Promise<ElementFinder> => $$(`${materialLocators.Option.root}[data-automation-id="adf-cloud-group-chip-${name}"]`).first();
getGroupRowLocatorByName = async (name: string): Promise<ElementFinder> =>
$$(`${materialLocators.Option.root}[data-automation-id="adf-cloud-group-chip-${name}"]`).first();
async searchGroups(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.groupCloudSearch, name, 100);
@@ -64,15 +65,19 @@ export class GroupCloudComponentPage {
return true;
} catch (e) {
return false;
};
}
}
async checkGroupNotSelected(group: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-"]`, group)));
await BrowserVisibility.waitUntilElementIsNotVisible(
element(by.cssContainingText(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-"]`, group))
);
}
async removeSelectedGroup(group: string): Promise<void> {
const locator = $(`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-${group}"] ${materialLocators.Icon.root}`);
const locator = $(
`${materialLocators.Chip.grid.row.root}[data-automation-id*="adf-cloud-group-chip-${group}"] ${materialLocators.Icon.root}`
);
await BrowserActions.click(locator);
}
@@ -85,7 +90,7 @@ export class GroupCloudComponentPage {
}
}
async checkGroupWidgetIsReadOnly(): Promise <boolean> {
async checkGroupWidgetIsReadOnly(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.groupField);
return true;
@@ -94,7 +99,7 @@ export class GroupCloudComponentPage {
}
}
async checkGroupActiveField(name: string): Promise <boolean> {
async checkGroupActiveField(name: string): Promise<boolean> {
try {
await BrowserActions.clearSendKeys(this.groupField, name);
return true;

View File

@@ -28,7 +28,6 @@ export interface ApiServiceConfig {
};
}
export class ApiService {
apiService: AlfrescoApi;
constructor(private config: ApiServiceConfig, private logger: LoggerLike) {
@@ -47,13 +46,14 @@ export class ApiService {
/**
* Login using one of the account profiles from the `browser.params.testConfig`.
* Example: loginWithProfile('admin')
*
* @param profileName profile name
*/
async loginWithProfile(profileName: string): Promise<void> {
const profile = this.config.users[profileName];
if (profile) {
this.logger.log(`try to login with ${profile.username} on HOST: ${this.apiService.config.hostEcm} AUTHTYPE: ${this.apiService.config.authType} PROVIDER: ${this.apiService.config.provider}`);
this.logger.log(
`try to login with ${profile.username} on HOST: ${this.apiService.config.hostEcm} AUTHTYPE: ${this.apiService.config.authType} PROVIDER: ${this.apiService.config.provider}`
);
try {
await this.apiService.login(profile.username, profile.password);
this.logger.log(`Successfuly logged in as ${profile.username}`);
@@ -80,8 +80,8 @@ export class ApiService {
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
this.apiService.processClient
.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts, Object)
.then((data) => resolve(data))
.catch((err) => reject(err));
});
@@ -101,8 +101,8 @@ export class ApiService {
Authorization: 'bearer ' + this.apiService.oauth2Auth.token
};
return this.apiService.processClient.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, Object)
return this.apiService.processClient
.callCustomApi(uri, method, pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts, Object)
.then((data) => resolve(data))
.catch((err) => reject(err));
});

View File

@@ -16,7 +16,6 @@
*/
export class StringUtil {
static generatePasswordString(length: number = 8): string {
let text = '';
const lowerCaseLimit = Math.floor(length / 2);
@@ -28,7 +27,6 @@ export class StringUtil {
/**
* Generates a random string.
*
* @param length If this parameter is not provided the length is set to 8 by default.
* @returns random string
*/
@@ -38,7 +36,6 @@ export class StringUtil {
/**
* Generates a random lowercase string.
*
* @param length If this parameter is not provided the length is set to 8 by default.
* @returns random string
*/
@@ -48,7 +45,6 @@ export class StringUtil {
/**
* Generates a random email address following the format: abcdef@activiti.test.com
*
* @param domain email domain
* @param length email length
* @returns email address
@@ -61,7 +57,6 @@ export class StringUtil {
/**
* Generates a random string - digits only.
*
* @param length If this parameter is not provided the length is set to 8 by default.
* @returns random string
*/
@@ -71,7 +66,6 @@ export class StringUtil {
/**
* Generates a random string - non-latin characters only.
*
* @param length If this parameter is not provided the length is set to 3 by default.
* @returns random string
*/
@@ -81,7 +75,6 @@ export class StringUtil {
/**
* Generates a random string.
*
* @param length If this parameter is not provided the length is set to 8 by default.
* @param charSet to use
* @returns random string
@@ -98,14 +91,13 @@ export class StringUtil {
/**
* Generates a sequence of files with name: baseName + index + extension (e.g.) baseName1.txt, baseName2.txt, ...
*
* @param startIndex start index
* @param endIndex end index
* @param baseName the base name of all files
* @param extension the extension of the file
* @returns list of file names
*/
static generateFilesNames(startIndex: number, endIndex: number, baseName: string, extension: string): string [] {
static generateFilesNames(startIndex: number, endIndex: number, baseName: string, extension: string): string[] {
const fileNames: string[] = [];
for (let i = startIndex; i <= endIndex; i++) {
fileNames.push(baseName + i + extension);
@@ -115,7 +107,6 @@ export class StringUtil {
/**
* Generates a random name for a process
*
* @param length {int} If this parameter is not provided the length is set to 5 by default.
* @returns process name
*/
@@ -125,12 +116,10 @@ export class StringUtil {
/**
* Generates a random name for a user task
*
* @param length If this parameter is not provided the length is set to 5 by default.
* @returns task name
*/
static generateUserTaskName(length: number = 5): string {
static generateUserTaskName(length: number = 5): string {
return 'userTask_' + StringUtil.generateRandomString(length);
}
}

View File

@@ -9,5 +9,6 @@
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
}
}
},
"include": ["src/**/*.ts", "index.ts"]
}