@ebertjendustries/cstestwrapper 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +581 -0
- package/dist/index.d.ts +581 -0
- package/dist/index.js +1969 -0
- package/dist/index.mjs +1888 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import * as RealRestClient from '@ebertjendustries/cswrapper';
|
|
2
|
+
import { LocalisationNamespace, Localiser, FieldSpec, EnumFactory, ViewSpec, IViewElementSpec, LocalisationVariableType, CSVNoItemsViewElements, CSVPriceInputViewElements, IPrice, CSVSearchFilterViewElements, CSVTextPromptModalViewElements, PropertyChangeFunction } from '@ebertjendustries/cswrapper';
|
|
3
|
+
import { MultiselectWrapper, SelectWrapper, InputWrapper, DatePickerWrapper, TableWrapper, WizardWrapper, ButtonWrapper, ButtonDropdownWrapper, ModalWrapper, CheckboxWrapper, HeaderWrapper, BoxWrapper, CollectionPreferencesWrapper, LinkWrapper, ToggleWrapper, FlashbarWrapper, SegmentedControlWrapper, AlertWrapper, StatusIndicatorWrapper, CardsWrapper, TextareaWrapper, TabsWrapper, TextFilterWrapper, TextContentWrapper, PaginationWrapper, FormWrapper, ProgressBarWrapper, IconWrapper, ElementWrapper as ElementWrapper$1, FormFieldWrapper, CopyToClipboardWrapper } from '@cloudscape-design/components/test-utils/dom';
|
|
4
|
+
import { ElementWrapper, ComponentWrapper } from '@cloudscape-design/test-utils-core/dom';
|
|
5
|
+
import DropdownHostComponentWrapper from '@cloudscape-design/components/test-utils/dom/internal/dropdown-host';
|
|
6
|
+
import * as vitest from 'vitest';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Implemented by the application importing the library to provide their own Localiser implementation used for testing.
|
|
12
|
+
*/
|
|
13
|
+
declare abstract class TestLocalisation {
|
|
14
|
+
abstract getLocaliser(namespace: LocalisationNamespace): Localiser;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class AbstractSelectTesting<SelectWrapperType extends DropdownHostComponentWrapper> extends AbstractComponentTesting<SelectWrapperType, FieldSpec> {
|
|
18
|
+
private expandToViewport?;
|
|
19
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>, findFunction: (selector: string) => (SelectWrapperType | null), expandToViewport?: boolean | undefined);
|
|
20
|
+
expectSelectedEnumEntries<E extends Object>(enumFactory: EnumFactory<E>, selectedEntries: E[]): Promise<void>;
|
|
21
|
+
expectSelectedEntries(selectedEntries: string[], totalEntryCount: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Expects entries in the array.
|
|
24
|
+
*
|
|
25
|
+
* @param entries The expected entry labels
|
|
26
|
+
* @param selectedIndices The selected entry indices
|
|
27
|
+
*
|
|
28
|
+
* The selected indices are zero-based and DO NOT consider the "Select all" entry. I.e. the first entry after
|
|
29
|
+
* "Select all" has index = 0.
|
|
30
|
+
*/
|
|
31
|
+
expectEntries(entries: string[], selectedIndices: number[]): Promise<void>;
|
|
32
|
+
expectEnumEntries<E extends Object>(enumFactory: EnumFactory<E>, selectedEnums: E[], except?: E[]): Promise<void>;
|
|
33
|
+
selectOrDeselect(clickedIndices: number[]): Promise<void>;
|
|
34
|
+
select(entries: string[]): Promise<void>;
|
|
35
|
+
openDropdown(): Promise<SelectWrapperType>;
|
|
36
|
+
closeDropdown(selectWrapper: DropdownHostComponentWrapper): Promise<void>;
|
|
37
|
+
awaitHasSelectedEntryCount(selectedEntryCount: number, totalEntryCount: number): Promise<void>;
|
|
38
|
+
private getOptions;
|
|
39
|
+
private getDropdown;
|
|
40
|
+
private optionsToEntrySet;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class MultiselectTesting extends AbstractSelectTesting<MultiselectWrapper> {
|
|
44
|
+
protected view: AbstractViewTesting<any>;
|
|
45
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>, expandToViewport?: boolean);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare class SelectTesting extends AbstractSelectTesting<SelectWrapper> {
|
|
49
|
+
protected view: AbstractViewTesting<any>;
|
|
50
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>, expandToViewport?: boolean);
|
|
51
|
+
expectEnabled(): void;
|
|
52
|
+
expectDisabled(): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare abstract class AbstractInputTesting<InputWrapperType extends ElementWrapper | ComponentWrapper, ElementType extends HTMLElement> extends AbstractComponentTesting<InputWrapperType, FieldSpec> {
|
|
56
|
+
/**
|
|
57
|
+
* NOTE: The CloudScape wrapper writes a value no matter what, even if the input is disable, a new value is set and the change handlers triggered!
|
|
58
|
+
* @param value the value to set
|
|
59
|
+
*/
|
|
60
|
+
abstract setStringValue(value: string): void;
|
|
61
|
+
abstract expectValue(value: number | string | undefined): void;
|
|
62
|
+
clear(): void;
|
|
63
|
+
forceTooLongValidationMessage(repeatedString?: string): Promise<void>;
|
|
64
|
+
awaitMandatoryMissing(): Promise<void>;
|
|
65
|
+
expectReadOnly(): void;
|
|
66
|
+
expectNotReadOnly(): void;
|
|
67
|
+
expectEmpty(): void;
|
|
68
|
+
overwriteAndVerify(value: number | string | undefined): void;
|
|
69
|
+
expectEnabled(): void;
|
|
70
|
+
expectDisabled(): void;
|
|
71
|
+
protected abstract getNativeHTMLInput(): ElementType;
|
|
72
|
+
protected expectErrorMessage(message: string): Promise<void>;
|
|
73
|
+
type(value: string): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class StringInputTesting extends AbstractInputTesting<InputWrapper, HTMLInputElement> {
|
|
77
|
+
protected view: AbstractViewTesting<any>;
|
|
78
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
79
|
+
setStringValue(value: string | undefined): void;
|
|
80
|
+
expectValue(value: number | string | undefined): void;
|
|
81
|
+
protected getNativeHTMLInput(): HTMLInputElement;
|
|
82
|
+
}
|
|
83
|
+
declare class NumberInputTesting extends AbstractInputTesting<InputWrapper, HTMLInputElement> {
|
|
84
|
+
protected view: AbstractViewTesting<any>;
|
|
85
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
86
|
+
setStringValue(value: string | number | undefined): void;
|
|
87
|
+
forceSmallerThanLowerBoundMessage(): Promise<void>;
|
|
88
|
+
expectValue(value: number | string | undefined): void;
|
|
89
|
+
protected getNativeHTMLInput(): HTMLInputElement;
|
|
90
|
+
}
|
|
91
|
+
declare class DatePickerTesting extends AbstractInputTesting<DatePickerWrapper, HTMLInputElement> {
|
|
92
|
+
protected view: AbstractViewTesting<any>;
|
|
93
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
94
|
+
setStringValue(value: string | undefined): void;
|
|
95
|
+
expectValue(value: number | string | undefined): void;
|
|
96
|
+
protected getNativeHTMLInput(): HTMLInputElement;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Test helper class for Cloudscape tables.
|
|
101
|
+
*
|
|
102
|
+
* NOTE: - All indices given here for referencing table rows and columns are 0-based, as opposed to 1-based indices
|
|
103
|
+
* in the Cloudscape test utils. This helper class ensures to convert between the two systems.
|
|
104
|
+
* - If a table has selectable rows, the first column is occupied by the selection area! So add +1 to referenced column indices.
|
|
105
|
+
*/
|
|
106
|
+
declare class TableTesting extends AbstractComponentTesting<TableWrapper, FieldSpec> {
|
|
107
|
+
protected view: AbstractViewTesting<any>;
|
|
108
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
109
|
+
expectSelectCount(expectedSelectCount: number): void;
|
|
110
|
+
getRowCount(): number;
|
|
111
|
+
selectAllItems(): void;
|
|
112
|
+
expectSelectedItems(selectedRowIndices: number[]): void;
|
|
113
|
+
expectUnselectedItems(unselectedRowIndices: number[]): void;
|
|
114
|
+
selectItems(clickedRowIndices: number[]): void;
|
|
115
|
+
printRow(rowIndex: number, columnCount: number): void;
|
|
116
|
+
expectCellContent(rowIndex: number, colIndex: number, content: string | RegExp): void;
|
|
117
|
+
expectTableContent(content: (string | RegExp)[][]): void;
|
|
118
|
+
expectRowContent(rowIndex: number, content: (string | RegExp)[]): void;
|
|
119
|
+
editCellWithConfirm(rowIndex: number, colIndex: number, editSteps: () => Promise<void>): Promise<void>;
|
|
120
|
+
editCellWithCancel(rowIndex: number, colIndex: number, editSteps: () => Promise<void>): Promise<void>;
|
|
121
|
+
expectNotContainedInAnyRow(colIndex: number, content: string | RegExp): void;
|
|
122
|
+
awaitLoading(): Promise<void>;
|
|
123
|
+
awaitNotLoading(): Promise<void>;
|
|
124
|
+
changeColumnSorting(columnHeader: string): void;
|
|
125
|
+
expectSortedBy(columnHeader: string, desc: boolean): void;
|
|
126
|
+
private editCell;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare class WizardTesting extends AbstractComponentTesting<WizardWrapper, FieldSpec> {
|
|
130
|
+
protected view: AbstractViewTesting<any>;
|
|
131
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
132
|
+
cancel(): void;
|
|
133
|
+
skip(): void;
|
|
134
|
+
prev(): void;
|
|
135
|
+
next(): void;
|
|
136
|
+
confirm(): void;
|
|
137
|
+
goToStep(stepIndex: number): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class ButtonTesting extends AbstractComponentTesting<ButtonWrapper, FieldSpec> {
|
|
141
|
+
protected view: AbstractViewTesting<any>;
|
|
142
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
143
|
+
awaitLoading(): Promise<void>;
|
|
144
|
+
awaitNotLoading(): Promise<void>;
|
|
145
|
+
clickAndWaitForLoadingDone(): Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare class ButtonDropdownTesting extends AbstractComponentTesting<ButtonDropdownWrapper, FieldSpec> {
|
|
149
|
+
protected view: AbstractViewTesting<any>;
|
|
150
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
151
|
+
openDropdown(): Promise<void>;
|
|
152
|
+
clickItem(dataTestId: string): Promise<void>;
|
|
153
|
+
private getDropdown;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare class ModalTesting extends AbstractComponentTesting<ModalWrapper, ViewSpec<any>> {
|
|
157
|
+
protected view: AbstractViewTesting<any>;
|
|
158
|
+
constructor(viewSpec: ViewSpec<any>, view: AbstractViewTesting<any>);
|
|
159
|
+
expectHidden(): void;
|
|
160
|
+
expectVisible(): void;
|
|
161
|
+
awaitVisible(): Promise<void>;
|
|
162
|
+
awaitHidden(): Promise<void>;
|
|
163
|
+
dismiss(): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
declare class RatingTesting<E extends Object> extends AbstractComponentTesting<ElementWrapper, ViewSpec<any>> {
|
|
167
|
+
protected view: AbstractViewTesting<any>;
|
|
168
|
+
private readonly enumValuesInOrder;
|
|
169
|
+
constructor(viewSpec: ViewSpec<any>, view: AbstractViewTesting<any>, factory: EnumFactory<E>, toOrderNumber?: (value: E) => number);
|
|
170
|
+
static mockBoundingBox(): void;
|
|
171
|
+
static unmockBoundingBox(): void;
|
|
172
|
+
expectSelected(selectedEnum: E): void;
|
|
173
|
+
expectAllUnselected(): void;
|
|
174
|
+
select(selectedEnum: E): void;
|
|
175
|
+
unselectAll(): void;
|
|
176
|
+
expectEnabled(): void;
|
|
177
|
+
expectDisabled(): void;
|
|
178
|
+
private getByLabelText;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare class CheckboxTesting extends AbstractComponentTesting<CheckboxWrapper, FieldSpec> {
|
|
182
|
+
protected view: AbstractViewTesting<any>;
|
|
183
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
184
|
+
click(): void;
|
|
185
|
+
isChecked(): boolean;
|
|
186
|
+
getElement(): HTMLElement;
|
|
187
|
+
toggleIfNecessary(desiredCheckedState: boolean): void;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare class HeaderTesting extends AbstractComponentTesting<HeaderWrapper, FieldSpec> {
|
|
191
|
+
protected view: AbstractViewTesting<any>;
|
|
192
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
193
|
+
expectCounterLocalisation(variables?: any): void;
|
|
194
|
+
expectCounter(counterText: string | RegExp): void;
|
|
195
|
+
expectContent(content: string | RegExp): void;
|
|
196
|
+
expectNotContent(content: string | RegExp): void;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare class BoxTesting extends AbstractComponentTesting<BoxWrapper, FieldSpec> {
|
|
200
|
+
protected view: AbstractViewTesting<any>;
|
|
201
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
202
|
+
expectContent(content: string | RegExp): void;
|
|
203
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class CollectionPreferencesSetting {
|
|
207
|
+
pageSize: number | undefined;
|
|
208
|
+
wrapLines?: boolean;
|
|
209
|
+
stripedRows?: boolean;
|
|
210
|
+
compact?: boolean;
|
|
211
|
+
stickFirstColumns?: number;
|
|
212
|
+
stickLastColumns?: number;
|
|
213
|
+
}
|
|
214
|
+
declare class CollectionPreferencesTesting extends AbstractComponentTesting<CollectionPreferencesWrapper, FieldSpec> {
|
|
215
|
+
protected view: AbstractViewTesting<any>;
|
|
216
|
+
private supportedPageSizes;
|
|
217
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>, supportedPageSizes: number[]);
|
|
218
|
+
expectPreferences(preferences: CollectionPreferencesSetting): Promise<void>;
|
|
219
|
+
editPreferences(preferences: CollectionPreferencesSetting): Promise<void>;
|
|
220
|
+
private openPreferencesModal;
|
|
221
|
+
private confirmPreferencesModal;
|
|
222
|
+
private cancelPreferencesModal;
|
|
223
|
+
private getPageSizeIndex;
|
|
224
|
+
private editCheckboxSetting;
|
|
225
|
+
private expectCheckboxSetting;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare class LinkTesting extends AbstractComponentTesting<LinkWrapper, FieldSpec> {
|
|
229
|
+
protected view: AbstractViewTesting<any>;
|
|
230
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
declare class ToggleTesting extends AbstractComponentTesting<ToggleWrapper, FieldSpec> {
|
|
234
|
+
protected view: AbstractViewTesting<any>;
|
|
235
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
236
|
+
click(): void;
|
|
237
|
+
getElement(): HTMLElement;
|
|
238
|
+
toggleIfNecessary(desiredCheckedState: boolean): void;
|
|
239
|
+
isChecked(): boolean;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class FlashbarTesting extends AbstractComponentTesting<FlashbarWrapper, FieldSpec> {
|
|
243
|
+
protected view: AbstractViewTesting<any>;
|
|
244
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
245
|
+
awaitMessages(): Promise<void>;
|
|
246
|
+
expectMessagePresentCount(text: string | RegExp, count: number, headerMessage?: boolean): void;
|
|
247
|
+
expectMessagePresentOnce(text: string | RegExp, headerMessage?: boolean): void;
|
|
248
|
+
expectMessageNotPresent(text: string | RegExp, headerMessage?: boolean): void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare class SegmentedControlTesting<E extends Object> extends AbstractComponentTesting<SegmentedControlWrapper, FieldSpec> {
|
|
252
|
+
protected view: AbstractViewTesting<any>;
|
|
253
|
+
private factory;
|
|
254
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>, factory: EnumFactory<E>);
|
|
255
|
+
selectEnum(enumValue: E): Promise<void>;
|
|
256
|
+
select(index: number): Promise<void>;
|
|
257
|
+
expectSelected(index: number): void;
|
|
258
|
+
expectSelectedEnum(enumValue: E): void;
|
|
259
|
+
getSelectedEnum(): E;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare class AlertTesting extends AbstractComponentTesting<AlertWrapper, FieldSpec> {
|
|
263
|
+
protected view: AbstractViewTesting<any>;
|
|
264
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
265
|
+
expectContent(content: string | RegExp): void;
|
|
266
|
+
expectLocalisation(variables?: any, alternateNs?: LocalisationNamespace): void;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare class StatusIndicatorTesting extends AbstractComponentTesting<StatusIndicatorWrapper, FieldSpec> {
|
|
270
|
+
protected view: AbstractViewTesting<any>;
|
|
271
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
272
|
+
expectContent(content: string | RegExp): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare class CardsTesting extends AbstractComponentTesting<CardsWrapper, FieldSpec> {
|
|
276
|
+
protected view: AbstractViewTesting<any>;
|
|
277
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
278
|
+
expectSelectedItems(selectedItemIndices: number[]): void;
|
|
279
|
+
expectUnselectedItems(unselectedItemIndices: number[]): void;
|
|
280
|
+
awaitLoadingText(expectedText: string): Promise<void>;
|
|
281
|
+
clickItems(clickedItemIndices: number[]): void;
|
|
282
|
+
expectCardTitle(cardIndex: number, expectedTitle: string | RegExp): void;
|
|
283
|
+
getItemCount(): number;
|
|
284
|
+
awaitLoading(): Promise<void>;
|
|
285
|
+
awaitNotLoading(): Promise<void>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class TextareaTesting extends AbstractInputTesting<TextareaWrapper, HTMLTextAreaElement> {
|
|
289
|
+
protected view: AbstractViewTesting<any>;
|
|
290
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
291
|
+
setStringValue(value: string): void;
|
|
292
|
+
expectValue(value: number | string | undefined): void;
|
|
293
|
+
protected getNativeHTMLInput(): HTMLTextAreaElement;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
declare class TabsTesting extends AbstractComponentTesting<TabsWrapper, FieldSpec> {
|
|
297
|
+
protected view: AbstractViewTesting<any>;
|
|
298
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
299
|
+
expectActiveTab(index: number): void;
|
|
300
|
+
selectTab(index: number): void;
|
|
301
|
+
private assertTabAtIndex;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
declare class TextFilterTesting extends AbstractComponentTesting<TextFilterWrapper, FieldSpec> {
|
|
305
|
+
protected view: AbstractViewTesting<any>;
|
|
306
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
declare class TextContentTesting extends AbstractComponentTesting<TextContentWrapper, FieldSpec> {
|
|
310
|
+
protected view: AbstractViewTesting<any>;
|
|
311
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
312
|
+
expectContent(content: string | RegExp): void;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare class PaginationTesting extends AbstractComponentTesting<PaginationWrapper, FieldSpec> {
|
|
316
|
+
protected view: AbstractViewTesting<any>;
|
|
317
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
318
|
+
expectPageParams(currentPageDisplayIndex: string, pageCount: number): void;
|
|
319
|
+
changePage(fromIndex: number, toIndex: number): Promise<void>;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare class FormTesting extends AbstractComponentTesting<FormWrapper, IViewElementSpec> {
|
|
323
|
+
protected view: AbstractViewTesting<any>;
|
|
324
|
+
constructor(fieldSpec: IViewElementSpec, view: AbstractViewTesting<any>);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
declare class ProgressBarTesting extends AbstractComponentTesting<ProgressBarWrapper, FieldSpec> {
|
|
328
|
+
protected view: AbstractViewTesting<any>;
|
|
329
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
330
|
+
awaitPercentageDisplay(text: number): Promise<void>;
|
|
331
|
+
awaitResultText(text: string): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
declare class IconTesting extends AbstractComponentTesting<IconWrapper, FieldSpec> {
|
|
335
|
+
protected view: AbstractViewTesting<any>;
|
|
336
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Convenience factory to create each CS component testing class. It injects the parent view directly.
|
|
341
|
+
*/
|
|
342
|
+
declare class TestingFactory {
|
|
343
|
+
parentView: AbstractViewTesting<any>;
|
|
344
|
+
constructor(parentView: AbstractViewTesting<any>);
|
|
345
|
+
multiselect(fieldSpec: FieldSpec, expandToViewport?: boolean): MultiselectTesting;
|
|
346
|
+
select(fieldSpec: FieldSpec, expandToViewport?: boolean): SelectTesting;
|
|
347
|
+
stringInput(fieldSpec: FieldSpec): StringInputTesting;
|
|
348
|
+
numberInput(fieldSpec: FieldSpec): NumberInputTesting;
|
|
349
|
+
table(fieldSpec: FieldSpec): TableTesting;
|
|
350
|
+
wizard(fieldSpec: FieldSpec): WizardTesting;
|
|
351
|
+
datePicker(fieldSpec: FieldSpec): DatePickerTesting;
|
|
352
|
+
button(fieldSpec: FieldSpec): ButtonTesting;
|
|
353
|
+
buttonDropdown(fieldSpec: FieldSpec): ButtonDropdownTesting;
|
|
354
|
+
modal(viewSpec: ViewSpec<any>): ModalTesting;
|
|
355
|
+
rating<E extends Object>(viewSpec: ViewSpec<any>, factory: EnumFactory<E>, toOrderNumber?: (value: E) => number): RatingTesting<E>;
|
|
356
|
+
checkbox(fieldSpec: FieldSpec): CheckboxTesting;
|
|
357
|
+
header(fieldSpec: FieldSpec): HeaderTesting;
|
|
358
|
+
box(fieldSpec: FieldSpec): BoxTesting;
|
|
359
|
+
collectionPreferences(fieldSpec: FieldSpec, pageSizes: number[]): CollectionPreferencesTesting;
|
|
360
|
+
link(fieldSpec: FieldSpec): LinkTesting;
|
|
361
|
+
toggle(fieldSpec: FieldSpec): ToggleTesting;
|
|
362
|
+
flashbar(fieldSpec: FieldSpec): FlashbarTesting;
|
|
363
|
+
segmentedControl<E extends Object>(fieldSpec: FieldSpec, factory: EnumFactory<E>): SegmentedControlTesting<E>;
|
|
364
|
+
alert(fieldSpec: FieldSpec): AlertTesting;
|
|
365
|
+
statusIndicator(fieldSpec: FieldSpec): StatusIndicatorTesting;
|
|
366
|
+
cards(fieldSpec: FieldSpec): CardsTesting;
|
|
367
|
+
textarea(fieldSpec: FieldSpec): TextareaTesting;
|
|
368
|
+
tabs(fieldSpec: FieldSpec): TabsTesting;
|
|
369
|
+
textFilter(fieldSpec: FieldSpec): TextFilterTesting;
|
|
370
|
+
textContent(fieldSpec: FieldSpec): TextContentTesting;
|
|
371
|
+
pageSelect(fieldSpec: FieldSpec): PaginationTesting;
|
|
372
|
+
form(elementSpec: IViewElementSpec): FormTesting;
|
|
373
|
+
progressBar(fieldSpec: FieldSpec): ProgressBarTesting;
|
|
374
|
+
icon(fieldSpec: FieldSpec): IconTesting;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Base class of all view testing classes.
|
|
379
|
+
*/
|
|
380
|
+
declare abstract class AbstractViewTesting<ElementsType extends Object> {
|
|
381
|
+
protected namespace: LocalisationNamespace;
|
|
382
|
+
protected viewSpec: ViewSpec<ElementsType>;
|
|
383
|
+
private testLocalisation;
|
|
384
|
+
protected readonly parent: ViewSpec<any> | undefined;
|
|
385
|
+
protected readonly factory: TestingFactory;
|
|
386
|
+
protected constructor(namespace: LocalisationNamespace, viewSpec: ViewSpec<ElementsType>, testLocalisation: TestLocalisation);
|
|
387
|
+
getLocaliser(): Localiser;
|
|
388
|
+
fromSpec<F extends Object, TF extends Object>(componentSpec: ViewSpec<F>, testElements: (elements: F, factory: TestingFactory) => TF): ViewSpec<TF>;
|
|
389
|
+
printDOM(): void;
|
|
390
|
+
/**
|
|
391
|
+
* renders the component
|
|
392
|
+
*/
|
|
393
|
+
renderComponent(): void;
|
|
394
|
+
waitForView(viewSpec: ViewSpec<any>): Promise<void>;
|
|
395
|
+
expectViewNotPresent(viewSpec: ViewSpec<any>): void;
|
|
396
|
+
translate(key: string, variables?: LocalisationVariableType, alternateNs?: LocalisationNamespace): string;
|
|
397
|
+
/**
|
|
398
|
+
* To test triggering the default action, e.g. form submit, by pressing enter.
|
|
399
|
+
*/
|
|
400
|
+
pressEnter(element: HTMLElement): Promise<void>;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Base class of all individual CS component testing classes. Provides methods for accessing the common state of each
|
|
405
|
+
* CS component based on their underlying HTML Element.
|
|
406
|
+
*/
|
|
407
|
+
declare abstract class AbstractComponentTesting<WrapperType extends ElementWrapper$1 | ComponentWrapper, S extends IViewElementSpec> {
|
|
408
|
+
protected elementSpec: S;
|
|
409
|
+
protected view: AbstractViewTesting<any>;
|
|
410
|
+
private findFunction;
|
|
411
|
+
constructor(elementSpec: S, view: AbstractViewTesting<any>, findFunction: (selector: string) => (WrapperType | null));
|
|
412
|
+
static expectEnabled(element: HTMLElement, msg: string): void;
|
|
413
|
+
static expectDisabled(element: HTMLElement, msg: string): void;
|
|
414
|
+
protected static doFindElement<WrapperType extends ElementWrapper$1 | ComponentWrapper>(dataTestId: string, findFunction: (selector: string) => WrapperType | null): WrapperType | null;
|
|
415
|
+
expectFormFieldLabelDisplayed(): void;
|
|
416
|
+
expectFormFieldLabelNotDisplayed(): void;
|
|
417
|
+
getElement(): HTMLElement;
|
|
418
|
+
queryElement(): HTMLElement | null;
|
|
419
|
+
awaitElement(): Promise<HTMLElement>;
|
|
420
|
+
awaitPresent(): Promise<void>;
|
|
421
|
+
expectPresent(): void;
|
|
422
|
+
expectNotPresent(): void;
|
|
423
|
+
expectEnabled(): void;
|
|
424
|
+
expectDisabled(): void;
|
|
425
|
+
click(): void;
|
|
426
|
+
expectReadOnly(): void;
|
|
427
|
+
expectNotReadOnly(): void;
|
|
428
|
+
expectChecked(): void;
|
|
429
|
+
expectNotChecked(): void;
|
|
430
|
+
expectCheckState(checked: boolean): void;
|
|
431
|
+
expectContent(text: string): void;
|
|
432
|
+
awaitNotPresent(): Promise<void>;
|
|
433
|
+
getFormFieldWrapper(): FormFieldWrapper;
|
|
434
|
+
protected assertElement<T>(dataTestId: string, getterFunction: (dataTestId: string) => T | null | undefined): T;
|
|
435
|
+
protected elementNotFoundErrorMessage(dataTestId: string): string;
|
|
436
|
+
protected getElementWrapper(): WrapperType;
|
|
437
|
+
protected msgForExpect(index?: number, customSuffix?: string): string;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare class CSVNoItemsViewTesting<EntityType extends Object> extends AbstractViewTesting<CSVNoItemsViewElements> {
|
|
441
|
+
private entityTypeFactory;
|
|
442
|
+
noItemsView: ViewSpec<{
|
|
443
|
+
boxHeading: BoxTesting;
|
|
444
|
+
boxBody: BoxTesting;
|
|
445
|
+
}>;
|
|
446
|
+
constructor(namespace: LocalisationNamespace, viewSpec: ViewSpec<CSVNoItemsViewElements>, entityTypeFactory: EnumFactory<EntityType>, testLocalisation: TestLocalisation);
|
|
447
|
+
awaitPresent(): Promise<void>;
|
|
448
|
+
awaitNotPresent(): Promise<void>;
|
|
449
|
+
expectPresent(): void;
|
|
450
|
+
expectNotPresent(): void;
|
|
451
|
+
expectLocalisation(itemType: EntityType): void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
declare class CSVPriceInputViewTesting extends AbstractViewTesting<CSVPriceInputViewElements> {
|
|
455
|
+
private currencyFactory;
|
|
456
|
+
private expandToViewport?;
|
|
457
|
+
csvPriceInputView: ViewSpec<{
|
|
458
|
+
amountInput: NumberInputTesting;
|
|
459
|
+
currencyInput: SelectTesting;
|
|
460
|
+
displayBox: BoxTesting;
|
|
461
|
+
}>;
|
|
462
|
+
constructor(namespace: LocalisationNamespace, viewSpec: ViewSpec<CSVPriceInputViewElements>, testLocalisation: TestLocalisation, currencyFactory: EnumFactory<any>, expandToViewport?: boolean | undefined);
|
|
463
|
+
expectDisplayPrice(price: IPrice<any>): void;
|
|
464
|
+
setPrice(price: IPrice<any>): Promise<void>;
|
|
465
|
+
expectPrice(price: IPrice<any>): Promise<void>;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
declare class CSVSearchFilterViewTesting extends AbstractViewTesting<CSVSearchFilterViewElements> {
|
|
469
|
+
csvSearchFilterView: ViewSpec<{
|
|
470
|
+
searchTextFilter: StringInputTesting;
|
|
471
|
+
searchButton: ButtonTesting;
|
|
472
|
+
}>;
|
|
473
|
+
constructor(namespace: LocalisationNamespace, viewSpec: ViewSpec<CSVSearchFilterViewElements>, testLocalisation: TestLocalisation);
|
|
474
|
+
awaitNotLoading(): Promise<void>;
|
|
475
|
+
searchFor(searchText: string): void;
|
|
476
|
+
search(): void;
|
|
477
|
+
editSearchText(searchText: string): void;
|
|
478
|
+
expectState(expectedSearchText: string, disabledButton?: boolean): void;
|
|
479
|
+
expectFilteringEnabled(): void;
|
|
480
|
+
expectFilteringDisabled(): void;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
declare class CSVTextPromptModalViewTesting extends AbstractViewTesting<CSVTextPromptModalViewElements> {
|
|
484
|
+
csvTextPromptModalView: ViewSpec<{
|
|
485
|
+
headerHeading: HeaderTesting;
|
|
486
|
+
boxBodyText: BoxTesting;
|
|
487
|
+
buttonPrimary: ButtonTesting;
|
|
488
|
+
buttonSecondary: ButtonTesting;
|
|
489
|
+
modal: ModalTesting;
|
|
490
|
+
}>;
|
|
491
|
+
constructor(namespace: LocalisationNamespace, viewSpec: ViewSpec<CSVTextPromptModalViewElements>, testLocalisation: TestLocalisation);
|
|
492
|
+
expectHidden(): void;
|
|
493
|
+
expectVisible(): void;
|
|
494
|
+
awaitVisible(): Promise<void>;
|
|
495
|
+
awaitHidden(): Promise<void>;
|
|
496
|
+
dismiss(): void;
|
|
497
|
+
confirm(): void;
|
|
498
|
+
expectVisibleAfterOpsThenConfirm(operations: (() => void)[], navigatingAway?: boolean): Promise<void>;
|
|
499
|
+
expectVisibleAfterOpsThenDismiss(operations: (() => void)[], navigatingAway?: boolean): Promise<void>;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
declare class CopyToClipboardTesting extends AbstractComponentTesting<CopyToClipboardWrapper, FieldSpec> {
|
|
503
|
+
protected view: AbstractViewTesting<any>;
|
|
504
|
+
constructor(fieldSpec: FieldSpec, view: AbstractViewTesting<any>);
|
|
505
|
+
expectEnabled(): void;
|
|
506
|
+
copyText(text: string | RegExp): Promise<void>;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
declare class MockBrowserAPIs {
|
|
510
|
+
static mockConfirmAlways(confirm: boolean): Function;
|
|
511
|
+
static mockScroll(): Function;
|
|
512
|
+
static mockDateNow(epochMillisToReturn: number): Function;
|
|
513
|
+
static resetDateNow(): void;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
declare function setupRestClientMock(controllerSpec: ViewSpec<any>): MockRestClient;
|
|
517
|
+
declare class MockRestClient implements RealRestClient.IRestClient {
|
|
518
|
+
get: vitest.Mock<(...args: any[]) => any>;
|
|
519
|
+
put: vitest.Mock<(...args: any[]) => any>;
|
|
520
|
+
post: vitest.Mock<(...args: any[]) => any>;
|
|
521
|
+
del: vitest.Mock<(...args: any[]) => any>;
|
|
522
|
+
private readonly getResponseValues;
|
|
523
|
+
private readonly putResponseValues;
|
|
524
|
+
private readonly postResponseValues;
|
|
525
|
+
private readonly deleteResponseValues;
|
|
526
|
+
private readonly uuid;
|
|
527
|
+
constructor(name: string);
|
|
528
|
+
expectAllHaveBeenCalled(hard?: boolean): void;
|
|
529
|
+
addGetResponse(url: string, response: any, delayInMilliseconds?: number): void;
|
|
530
|
+
addPutResponse(url: string, response: any, delayInMilliseconds?: number): void;
|
|
531
|
+
addPostResponse(url: string, response: any, delayInMilliseconds?: number): void;
|
|
532
|
+
addDeleteResponse(url: string, response: any, delayInMilliseconds?: number): void;
|
|
533
|
+
private getDelayForLogging;
|
|
534
|
+
private mockGet;
|
|
535
|
+
private mockPut;
|
|
536
|
+
private mockPost;
|
|
537
|
+
private mockDelete;
|
|
538
|
+
private doMocking;
|
|
539
|
+
private mockImpl;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare class MockServerBuilder {
|
|
543
|
+
private port;
|
|
544
|
+
private mockData;
|
|
545
|
+
private redirectUrls;
|
|
546
|
+
private server;
|
|
547
|
+
private jsonServer;
|
|
548
|
+
constructor(port: number, requireFunc: Function);
|
|
549
|
+
addToMockData(key: string, data: any): void;
|
|
550
|
+
/**
|
|
551
|
+
* Puts mock data: Adds it to internal data structures and prepares it for mocking. It potentially updates
|
|
552
|
+
* the overall mock data object later passed into jsonServer router as well as the rewrite object later
|
|
553
|
+
* passed into jsonServer.rewriter.
|
|
554
|
+
*
|
|
555
|
+
* @param key The key of the data
|
|
556
|
+
* @param data The data itself
|
|
557
|
+
* @param urlRedirects The redirect URLs to be rewritten to the key url
|
|
558
|
+
* @param crud Whether this is a crud redirect
|
|
559
|
+
* @returns The loaded mock data object
|
|
560
|
+
*/
|
|
561
|
+
putMockData(key: string, data: any, urlRedirects: string[], crud?: boolean): void;
|
|
562
|
+
addToRedirects(key: string, urlRedirects: string[], crud: boolean): void;
|
|
563
|
+
rewritePostToGet(url: string): void;
|
|
564
|
+
static set200WithData(res: any, data: any): void;
|
|
565
|
+
static respondWithError(res: any, componentId: string, messageId: string, httpStatus: number, op: string, message: string): void;
|
|
566
|
+
mockCall(url: string, callProcessor: (req: any, res: any, next: Function) => void): void;
|
|
567
|
+
mockCRUDMulti(urls: string[], allElements: any, finder: (id: number) => any, operationDesc: string): void;
|
|
568
|
+
mockCRUD(url: string, allElements: any, finder: (id: number) => any, operationDesc: string): void;
|
|
569
|
+
start(): void;
|
|
570
|
+
private useCors;
|
|
571
|
+
private static allowCors;
|
|
572
|
+
private static postRewriteToGet;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare class ViewTestWrapperProps<T> {
|
|
576
|
+
initialValue: T;
|
|
577
|
+
view: (value: T, onChange: PropertyChangeFunction) => React.ReactNode;
|
|
578
|
+
}
|
|
579
|
+
declare function ViewTestWrapper<T>(props: ViewTestWrapperProps<T>): react_jsx_runtime.JSX.Element;
|
|
580
|
+
|
|
581
|
+
export { AbstractComponentTesting, AbstractInputTesting, AbstractSelectTesting, AbstractViewTesting, AlertTesting, BoxTesting, ButtonDropdownTesting, ButtonTesting, CSVNoItemsViewTesting, CSVPriceInputViewTesting, CSVSearchFilterViewTesting, CSVTextPromptModalViewTesting, CardsTesting, CheckboxTesting, CollectionPreferencesSetting, CollectionPreferencesTesting, CopyToClipboardTesting, DatePickerTesting, FlashbarTesting, FormTesting, HeaderTesting, IconTesting, LinkTesting, MockBrowserAPIs, MockRestClient, MockServerBuilder, ModalTesting, MultiselectTesting, NumberInputTesting, PaginationTesting, ProgressBarTesting, RatingTesting, SegmentedControlTesting, SelectTesting, StatusIndicatorTesting, StringInputTesting, TableTesting, TabsTesting, TestLocalisation, TestingFactory, TextContentTesting, TextFilterTesting, TextareaTesting, ToggleTesting, ViewTestWrapper, WizardTesting, setupRestClientMock };
|