UNPKG

@alfresco/adf-core

Version:
135 lines (134 loc) 7.71 kB
/*! * @license * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { HarnessLoader, TestElement, TestKey } from '@angular/cdk/testing'; import { DebugElement, Type } from '@angular/core'; import { MatOptionHarness } from '@angular/material/core/testing'; import { MatChipHarness, MatChipListboxHarness } from '@angular/material/chips/testing'; import { MatButtonHarness } from '@angular/material/button/testing'; import { MatIconHarness } from '@angular/material/icon/testing'; import { MatCheckboxHarness } from '@angular/material/checkbox/testing'; import { MatErrorHarness, MatFormFieldHarness } from '@angular/material/form-field/testing'; import { MatInputHarness } from '@angular/material/input/testing'; import { ComponentFixture } from '@angular/core/testing'; import { MatTabHarness } from '@angular/material/tabs/testing'; export declare class UnitTestingUtils { private debugElement?; private loader?; constructor(debugElement?: DebugElement, loader?: HarnessLoader); setDebugElement(debugElement: DebugElement): void; setLoader(loader: HarnessLoader): void; getByCSS(selector: string): DebugElement; getAllByCSS(selector: string): DebugElement[]; getInnerTextByCSS(selector: string): string; getByDataAutomationId(dataAutomationId: string): DebugElement; getByDataAutomationClass(dataAutomationClass: string): DebugElement; getInnerTextByDataAutomationId(dataAutomationId: string): string; getByDirective(directive: Type<any>): DebugElement; /** Perform actions */ clickByCSS(selector: string): void; clickByDataAutomationId(dataAutomationId: string): void; doubleClickByDataAutomationId(dataAutomationId: string): void; blurByCSS(selector: string): void; hoverOverByCSS(selector: string): void; hoverOverByDataAutomationId(dataAutomationId: string): void; mouseLeaveByCSS(selector: string): void; mouseLeaveByDataAutomationId(dataAutomationId: string): void; keyBoardEventByCSS(selector: string, event: 'keyup' | 'keydown', code: string, key: string): void; dispatchCustomEventByCSS(selector: string, eventName: string): void; /** Input related methods */ getInputByCSS(selector: string): HTMLInputElement; getInputByDataAutomationId(dataAutomationId: string): HTMLInputElement; fillInputByCSS(selector: string, value: string): void; fillInputByDataAutomationId(dataAutomationId: string, value: any): void; /** MatButton related methods */ getMatButton(): Promise<MatButtonHarness>; getMatButtonByCSS(selector: string): Promise<MatButtonHarness>; getMatButtonByDataAutomationId(dataAutomationId: string): Promise<MatButtonHarness>; checkIfMatButtonExists(): Promise<boolean>; checkIfMatButtonExistsWithDataAutomationId(dataAutomationId: string): Promise<boolean>; clickMatButton(): Promise<void>; clickMatButtonByCSS(selector: string): Promise<void>; clickMatButtonByDataAutomationId(dataAutomationId: string): Promise<void>; sendKeysToMatButton(keys: (string | TestKey)[]): Promise<void>; /** MatCheckbox related methods */ getMatCheckbox(): Promise<MatCheckboxHarness>; getMatCheckboxByDataAutomationId(dataAutomationId: string): Promise<MatCheckboxHarness>; getMatCheckboxHost(): Promise<TestElement>; getAllMatCheckboxes(): Promise<MatCheckboxHarness[]>; checkIfMatCheckboxIsChecked(): Promise<boolean>; checkIfMatCheckboxesHaveClass(className: string): Promise<boolean>; hoverOverMatCheckbox(): Promise<void>; /** MatIcon related methods */ getMatIconOrNull(): Promise<MatIconHarness>; getMatIconWithAncestorByDataAutomationId(dataAutomationId: string): Promise<MatIconHarness>; getMatIconWithAncestorByCSS(selector: string): Promise<MatIconHarness>; getMatIconWithAncestorByCSSAndName(selector: string, name: string): Promise<MatIconHarness>; checkIfMatIconExistsWithAncestorByDataAutomationId(dataAutomationId: string): Promise<boolean>; checkIfMatIconExistsWithAncestorByCSSAndName(selector: string, name: string): Promise<boolean>; clickMatIconWithAncestorByDataAutomationId(dataAutomationId: string): Promise<void>; /** MatSelect related methods */ getMatSelectOptions(isOpened?: boolean): Promise<MatOptionHarness[]>; getMatSelectHost(): Promise<TestElement>; checkIfMatSelectExists(): Promise<boolean>; openMatSelect(): Promise<void>; /** MatChips related methods */ getMatChipByDataAutomationId(dataAutomationId: string): Promise<MatChipHarness>; checkIfMatChipExistsWithDataAutomationId(dataAutomationId: string): Promise<boolean>; clickMatChip(dataAutomationId: string): Promise<void>; getMatChips(): Promise<MatChipHarness[]>; /** MatChipListbox related methods */ getMatChipListboxByDataAutomationId(dataAutomationId: string): Promise<MatChipListboxHarness>; clickMatChipListbox(dataAutomationId: string): Promise<void>; /** MatChipGrid related methods */ checkIfMatChipGridExists(): Promise<boolean>; /** MatFromField related methods */ getMatFormField(): Promise<MatFormFieldHarness>; getMatFormFieldByCSS(selector: string): Promise<MatFormFieldHarness>; /** MatInput related methods */ getMatInput(): Promise<MatInputHarness>; getMatInputByCSS(selector: string): Promise<MatInputHarness>; getMatInputByDataAutomationId(dataAutomationId: string): Promise<MatInputHarness>; getMatInputByPlaceholder(placeholder: string): Promise<MatInputHarness>; getMatInputHost(): Promise<TestElement>; checkIfMatInputExists(): Promise<boolean>; checkIfMatInputExistsWithCSS(selector: string): Promise<boolean>; checkIfMatInputExistsWithDataAutomationId(dataAutomationId: string): Promise<boolean>; checkIfMatInputExistsWithPlaceholder(placeholder: string): Promise<boolean>; clickMatInput(): Promise<void>; fillMatInput(value: string): Promise<void>; fillMatInputByCSS(selector: string, value: string): Promise<void>; fillMatInputByDataAutomationId(dataAutomationId: string, value: string): Promise<void>; focusMatInput(): Promise<void>; blurMatInput(): Promise<void>; getMatInputValue(): Promise<string>; getMatInputValueByDataAutomationId(dataAutomationId: string): Promise<string>; sendKeysToMatInput(keys: (string | TestKey)[]): Promise<void>; /** MatAutoComplete related methods */ typeAndGetOptionsForMatAutoComplete(fixture: ComponentFixture<any>, value: string): Promise<MatOptionHarness[]>; /** MatError related methods */ getMatErrorByCSS(selector: string): Promise<MatErrorHarness>; getMatErrorByDataAutomationId(dataAutomationId: string): Promise<MatErrorHarness>; /** MatTabGroup related methods */ getSelectedTabFromMatTabGroup(): Promise<MatTabHarness>; getSelectedTabLabelFromMatTabGroup(): Promise<string>; /** MatToolbar related methods */ getMatToolbarHost(): Promise<TestElement>; /** MatSnackbar related methods */ checkIfMatSnackbarExists(): Promise<boolean>; /** MatProgressBar related methods */ getMatProgressBarHost(): Promise<TestElement>; }