From 2acaf38c7622393ce3296186f52ce62702f1b0ec Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Mon, 4 Nov 2024 15:58:59 +0100 Subject: [PATCH 01/12] chore: Separates the functional and snapshot tests in dirs --- .../base-props-support.test.tsx | 4 ++-- .../form-field-controls-integration.test.tsx | 12 ++++++------ .../{ => functional-tests}/naming-convention.test.ts | 2 +- .../outer-form-submit.test.tsx | 4 ++-- .../{ => functional-tests}/public-exports.test.ts | 6 ++++-- src/__tests__/{ => functional-tests}/ssr.test.ts | 4 ++-- .../test-a11y-validator.test.tsx | 2 +- .../{ => functional-tests}/test-utils.test.tsx | 4 ++-- .../use-base-component.test.tsx | 6 +++--- .../use-telemetry-usage.test.tsx | 6 +++--- .../__snapshots__/design-tokens.test.ts.snap | 0 .../__snapshots__/documenter.test.ts.snap | 0 .../__snapshots__/test-utils-selectors.test.tsx.snap | 0 .../{ => snapshot-tests}/design-tokens.test.ts | 2 +- .../{ => snapshot-tests}/documenter.test.ts | 2 +- .../test-utils-selectors.test.tsx | 0 16 files changed, 28 insertions(+), 26 deletions(-) rename src/__tests__/{ => functional-tests}/base-props-support.test.tsx (96%) rename src/__tests__/{ => functional-tests}/form-field-controls-integration.test.tsx (95%) rename src/__tests__/{ => functional-tests}/naming-convention.test.ts (87%) rename src/__tests__/{ => functional-tests}/outer-form-submit.test.tsx (89%) rename src/__tests__/{ => functional-tests}/public-exports.test.ts (71%) rename src/__tests__/{ => functional-tests}/ssr.test.ts (86%) rename src/__tests__/{ => functional-tests}/test-a11y-validator.test.tsx (97%) rename src/__tests__/{ => functional-tests}/test-utils.test.tsx (92%) rename src/__tests__/{ => functional-tests}/use-base-component.test.tsx (92%) rename src/__tests__/{ => functional-tests}/use-telemetry-usage.test.tsx (89%) rename src/__tests__/{ => snapshot-tests}/__snapshots__/design-tokens.test.ts.snap (100%) rename src/__tests__/{ => snapshot-tests}/__snapshots__/documenter.test.ts.snap (100%) rename src/__tests__/{ => snapshot-tests}/__snapshots__/test-utils-selectors.test.tsx.snap (100%) rename src/__tests__/{ => snapshot-tests}/design-tokens.test.ts (92%) rename src/__tests__/{ => snapshot-tests}/documenter.test.ts (83%) rename src/__tests__/{ => snapshot-tests}/test-utils-selectors.test.tsx (100%) diff --git a/src/__tests__/base-props-support.test.tsx b/src/__tests__/functional-tests/base-props-support.test.tsx similarity index 96% rename from src/__tests__/base-props-support.test.tsx rename to src/__tests__/functional-tests/base-props-support.test.tsx index dd21dc039d..1aab4b094e 100644 --- a/src/__tests__/base-props-support.test.tsx +++ b/src/__tests__/functional-tests/base-props-support.test.tsx @@ -3,8 +3,8 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { getAllComponents, requireComponent, supportsDOMProperties } from './utils'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent, supportsDOMProperties } from '../utils'; describe('Base props support', () => { const componentRoot = document.createElement('div'); diff --git a/src/__tests__/form-field-controls-integration.test.tsx b/src/__tests__/functional-tests/form-field-controls-integration.test.tsx similarity index 95% rename from src/__tests__/form-field-controls-integration.test.tsx rename to src/__tests__/functional-tests/form-field-controls-integration.test.tsx index ee52759e19..3446331721 100644 --- a/src/__tests__/form-field-controls-integration.test.tsx +++ b/src/__tests__/functional-tests/form-field-controls-integration.test.tsx @@ -3,11 +3,11 @@ import React from 'react'; import { render } from '@testing-library/react'; -import FormField, { FormFieldProps } from '../../lib/components/form-field'; -import { FormFieldValidationControlProps } from '../../lib/components/internal/context/form-field-context'; -import createWrapper, { ElementWrapper } from '../../lib/components/test-utils/dom'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { requireComponent } from './utils'; +import FormField, { FormFieldProps } from '../../../lib/components/form-field'; +import { FormFieldValidationControlProps } from '../../../lib/components/internal/context/form-field-context'; +import createWrapper, { ElementWrapper } from '../../../lib/components/test-utils/dom'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { requireComponent } from '../utils'; const formFieldControlComponents = [ { @@ -77,7 +77,7 @@ formFieldControlComponents.forEach(({ componentName, findNativeElement }) => { const requiredProps = getRequiredPropsForComponent(componentName) ?? {}; const renderResult = render( - {}} /> + { }} /> ); const formFieldWrapper = createWrapper(renderResult.container).findFormField()!; diff --git a/src/__tests__/naming-convention.test.ts b/src/__tests__/functional-tests/naming-convention.test.ts similarity index 87% rename from src/__tests__/naming-convention.test.ts rename to src/__tests__/functional-tests/naming-convention.test.ts index a6a317eba1..b2657f82ae 100644 --- a/src/__tests__/naming-convention.test.ts +++ b/src/__tests__/functional-tests/naming-convention.test.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { pascalCase } from 'change-case'; -import { getAllComponents, requireComponent } from './utils'; +import { getAllComponents, requireComponent } from '../utils'; describe('component displayName matches import directory name', () => { getAllComponents().forEach(componentName => { diff --git a/src/__tests__/outer-form-submit.test.tsx b/src/__tests__/functional-tests/outer-form-submit.test.tsx similarity index 89% rename from src/__tests__/outer-form-submit.test.tsx rename to src/__tests__/functional-tests/outer-form-submit.test.tsx index bdb1a9cd98..24303041ca 100644 --- a/src/__tests__/outer-form-submit.test.tsx +++ b/src/__tests__/functional-tests/outer-form-submit.test.tsx @@ -3,8 +3,8 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { getAllComponents, requireComponent } from './utils'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent } from '../utils'; const skippedComponents = ['button']; diff --git a/src/__tests__/public-exports.test.ts b/src/__tests__/functional-tests/public-exports.test.ts similarity index 71% rename from src/__tests__/public-exports.test.ts rename to src/__tests__/functional-tests/public-exports.test.ts index 3168c5dc9b..9a992c6190 100644 --- a/src/__tests__/public-exports.test.ts +++ b/src/__tests__/functional-tests/public-exports.test.ts @@ -5,7 +5,7 @@ import path from 'path'; // There are no typings for package.json // eslint-disable-next-line @typescript-eslint/no-var-requires -const packageJson = require('../../lib/components/package.json'); +const packageJson = require('../../../lib/components/package.json'); test('all exports declarations resolve to a file', () => { for (const exportPath of Object.values(packageJson.exports)) { @@ -13,6 +13,8 @@ test('all exports declarations resolve to a file', () => { if (exportPath === './internal/context/') { continue; } - expect(() => require.resolve(exportPath, { paths: [path.join(__dirname, '../../lib/components')] })).not.toThrow(); + expect(() => + require.resolve(exportPath, { paths: [path.join(__dirname, '../../../lib/components')] }) + ).not.toThrow(); } }); diff --git a/src/__tests__/ssr.test.ts b/src/__tests__/functional-tests/ssr.test.ts similarity index 86% rename from src/__tests__/ssr.test.ts rename to src/__tests__/functional-tests/ssr.test.ts index cf383a303a..96c7ba0f0a 100644 --- a/src/__tests__/ssr.test.ts +++ b/src/__tests__/functional-tests/ssr.test.ts @@ -7,8 +7,8 @@ import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { getAllComponents, requireComponent } from './utils'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent } from '../utils'; const skipComponents = [ 'modal', // it uses portal API which does not work on server diff --git a/src/__tests__/test-a11y-validator.test.tsx b/src/__tests__/functional-tests/test-a11y-validator.test.tsx similarity index 97% rename from src/__tests__/test-a11y-validator.test.tsx rename to src/__tests__/functional-tests/test-a11y-validator.test.tsx index 4709de523c..f730a16700 100644 --- a/src/__tests__/test-a11y-validator.test.tsx +++ b/src/__tests__/functional-tests/test-a11y-validator.test.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { render } from '@testing-library/react'; -import '../__a11y__/to-validate-a11y'; +import '../../__a11y__/to-validate-a11y'; describe('a11y validator', () => { test('valid', async () => { diff --git a/src/__tests__/test-utils.test.tsx b/src/__tests__/functional-tests/test-utils.test.tsx similarity index 92% rename from src/__tests__/test-utils.test.tsx rename to src/__tests__/functional-tests/test-utils.test.tsx index 06372116f6..905a9f885d 100644 --- a/src/__tests__/test-utils.test.tsx +++ b/src/__tests__/functional-tests/test-utils.test.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { render } from 'react-dom'; import { render as renderTestingLibrary } from '@testing-library/react'; -import Button from '../../lib/components/button'; -import createWrapper from '../../lib/components/test-utils/dom'; +import Button from '../../../lib/components/button'; +import createWrapper from '../../../lib/components/test-utils/dom'; describe('createWrapper', () => { let spy: jest.SpyInstance; diff --git a/src/__tests__/use-base-component.test.tsx b/src/__tests__/functional-tests/use-base-component.test.tsx similarity index 92% rename from src/__tests__/use-base-component.test.tsx rename to src/__tests__/functional-tests/use-base-component.test.tsx index 613734cbd6..7e9553cb91 100644 --- a/src/__tests__/use-base-component.test.tsx +++ b/src/__tests__/functional-tests/use-base-component.test.tsx @@ -6,9 +6,9 @@ import { pascalCase } from 'change-case'; import { COMPONENT_METADATA_KEY } from '@cloudscape-design/component-toolkit/internal'; -import { PACKAGE_VERSION } from '../../lib/components/internal/environment'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { getAllComponents, requireComponent, supportsDOMProperties } from './utils'; +import { PACKAGE_VERSION } from '../../../lib/components/internal/environment'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent, supportsDOMProperties } from '../utils'; describe('useBaseComponent hook is used in all allowlisted public components', () => { const componentRoot = document.createElement('div'); diff --git a/src/__tests__/use-telemetry-usage.test.tsx b/src/__tests__/functional-tests/use-telemetry-usage.test.tsx similarity index 89% rename from src/__tests__/use-telemetry-usage.test.tsx rename to src/__tests__/functional-tests/use-telemetry-usage.test.tsx index 022e079ee1..1208e4d51b 100644 --- a/src/__tests__/use-telemetry-usage.test.tsx +++ b/src/__tests__/functional-tests/use-telemetry-usage.test.tsx @@ -3,8 +3,8 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { getRequiredPropsForComponent } from './required-props-for-components'; -import { getAllComponents, requireComponent } from './utils'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent } from '../utils'; declare global { interface Window { @@ -25,7 +25,7 @@ describe('useTelemetry hook is used in all public components', () => { window.AWSC = { Clog: { - log: () => {}, + log: () => { }, }, }; diff --git a/src/__tests__/__snapshots__/design-tokens.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap similarity index 100% rename from src/__tests__/__snapshots__/design-tokens.test.ts.snap rename to src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap diff --git a/src/__tests__/__snapshots__/documenter.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap similarity index 100% rename from src/__tests__/__snapshots__/documenter.test.ts.snap rename to src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap diff --git a/src/__tests__/__snapshots__/test-utils-selectors.test.tsx.snap b/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap similarity index 100% rename from src/__tests__/__snapshots__/test-utils-selectors.test.tsx.snap rename to src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap diff --git a/src/__tests__/design-tokens.test.ts b/src/__tests__/snapshot-tests/design-tokens.test.ts similarity index 92% rename from src/__tests__/design-tokens.test.ts rename to src/__tests__/snapshot-tests/design-tokens.test.ts index 0ea13cfb03..e84d6c7027 100644 --- a/src/__tests__/design-tokens.test.ts +++ b/src/__tests__/snapshot-tests/design-tokens.test.ts @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { requireDesignTokensFile } from './utils'; +import { requireDesignTokensFile } from '../utils'; const themeNames = ['classic', 'visual-refresh']; diff --git a/src/__tests__/documenter.test.ts b/src/__tests__/snapshot-tests/documenter.test.ts similarity index 83% rename from src/__tests__/documenter.test.ts rename to src/__tests__/snapshot-tests/documenter.test.ts index 63204eaf2e..59542b266c 100644 --- a/src/__tests__/documenter.test.ts +++ b/src/__tests__/snapshot-tests/documenter.test.ts @@ -1,6 +1,6 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 -import { getAllComponents, requireComponentDefinition } from './utils'; +import { getAllComponents, requireComponentDefinition } from '../utils'; describe('Documenter', () => { test.each(getAllComponents())(`definition for %s matches the snapshot`, (componentName: string) => { diff --git a/src/__tests__/test-utils-selectors.test.tsx b/src/__tests__/snapshot-tests/test-utils-selectors.test.tsx similarity index 100% rename from src/__tests__/test-utils-selectors.test.tsx rename to src/__tests__/snapshot-tests/test-utils-selectors.test.tsx From 77a8d982958688e848ea3d61673eb8e84a932086 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Mon, 4 Nov 2024 16:57:31 +0100 Subject: [PATCH 02/12] feat: Adds snapshot tests for test-utils index wrappers --- .../form-field-controls-integration.test.tsx | 2 +- .../use-telemetry-usage.test.tsx | 2 +- .../test-utils-wrappers.test.tsx.snap | 1695 +++++++++++++++++ .../test-utils-wrappers.test.tsx | 23 + 4 files changed, 1720 insertions(+), 2 deletions(-) create mode 100644 src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap create mode 100644 src/__tests__/snapshot-tests/test-utils-wrappers.test.tsx diff --git a/src/__tests__/functional-tests/form-field-controls-integration.test.tsx b/src/__tests__/functional-tests/form-field-controls-integration.test.tsx index 3446331721..2f1637a41b 100644 --- a/src/__tests__/functional-tests/form-field-controls-integration.test.tsx +++ b/src/__tests__/functional-tests/form-field-controls-integration.test.tsx @@ -77,7 +77,7 @@ formFieldControlComponents.forEach(({ componentName, findNativeElement }) => { const requiredProps = getRequiredPropsForComponent(componentName) ?? {}; const renderResult = render( - { }} /> + {}} /> ); const formFieldWrapper = createWrapper(renderResult.container).findFormField()!; diff --git a/src/__tests__/functional-tests/use-telemetry-usage.test.tsx b/src/__tests__/functional-tests/use-telemetry-usage.test.tsx index 1208e4d51b..825c4cb679 100644 --- a/src/__tests__/functional-tests/use-telemetry-usage.test.tsx +++ b/src/__tests__/functional-tests/use-telemetry-usage.test.tsx @@ -25,7 +25,7 @@ describe('useTelemetry hook is used in all public components', () => { window.AWSC = { Clog: { - log: () => { }, + log: () => {}, }, }; diff --git a/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap b/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap new file mode 100644 index 0000000000..f41edd874d --- /dev/null +++ b/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap @@ -0,0 +1,1695 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Generate test utils ElementWrapper dom ElementWrapper matches the snapshot 1`] = ` +"import { ElementWrapper } from '@cloudscape-design/test-utils-core/dom'; +import { appendSelector } from '@cloudscape-design/test-utils-core/utils'; +export { ElementWrapper }; + + import AlertWrapper from './alert'; + export { AlertWrapper }; + + + import AnchorNavigationWrapper from './anchor-navigation'; + export { AnchorNavigationWrapper }; + + + import AnnotationWrapper from './annotation'; + export { AnnotationWrapper }; + + + import AppLayoutWrapper from './app-layout'; + export { AppLayoutWrapper }; + + + import AreaChartWrapper from './area-chart'; + export { AreaChartWrapper }; + + + import AttributeEditorWrapper from './attribute-editor'; + export { AttributeEditorWrapper }; + + + import AutosuggestWrapper from './autosuggest'; + export { AutosuggestWrapper }; + + + import BadgeWrapper from './badge'; + export { BadgeWrapper }; + + + import BarChartWrapper from './bar-chart'; + export { BarChartWrapper }; + + + import BoxWrapper from './box'; + export { BoxWrapper }; + + + import BreadcrumbGroupWrapper from './breadcrumb-group'; + export { BreadcrumbGroupWrapper }; + + + import ButtonWrapper from './button'; + export { ButtonWrapper }; + + + import ButtonDropdownWrapper from './button-dropdown'; + export { ButtonDropdownWrapper }; + + + import ButtonGroupWrapper from './button-group'; + export { ButtonGroupWrapper }; + + + import CalendarWrapper from './calendar'; + export { CalendarWrapper }; + + + import CardsWrapper from './cards'; + export { CardsWrapper }; + + + import CheckboxWrapper from './checkbox'; + export { CheckboxWrapper }; + + + import CodeEditorWrapper from './code-editor'; + export { CodeEditorWrapper }; + + + import CollectionPreferencesWrapper from './collection-preferences'; + export { CollectionPreferencesWrapper }; + + + import ColumnLayoutWrapper from './column-layout'; + export { ColumnLayoutWrapper }; + + + import ContainerWrapper from './container'; + export { ContainerWrapper }; + + + import ContentLayoutWrapper from './content-layout'; + export { ContentLayoutWrapper }; + + + import CopyToClipboardWrapper from './copy-to-clipboard'; + export { CopyToClipboardWrapper }; + + + import DateInputWrapper from './date-input'; + export { DateInputWrapper }; + + + import DatePickerWrapper from './date-picker'; + export { DatePickerWrapper }; + + + import DateRangePickerWrapper from './date-range-picker'; + export { DateRangePickerWrapper }; + + + import DrawerWrapper from './drawer'; + export { DrawerWrapper }; + + + import ExpandableSectionWrapper from './expandable-section'; + export { ExpandableSectionWrapper }; + + + import FileUploadWrapper from './file-upload'; + export { FileUploadWrapper }; + + + import FlashbarWrapper from './flashbar'; + export { FlashbarWrapper }; + + + import FormWrapper from './form'; + export { FormWrapper }; + + + import FormFieldWrapper from './form-field'; + export { FormFieldWrapper }; + + + import GridWrapper from './grid'; + export { GridWrapper }; + + + import HeaderWrapper from './header'; + export { HeaderWrapper }; + + + import HelpPanelWrapper from './help-panel'; + export { HelpPanelWrapper }; + + + import HotspotWrapper from './hotspot'; + export { HotspotWrapper }; + + + import IconWrapper from './icon'; + export { IconWrapper }; + + + import InputWrapper from './input'; + export { InputWrapper }; + + + import KeyValuePairsWrapper from './key-value-pairs'; + export { KeyValuePairsWrapper }; + + + import LineChartWrapper from './line-chart'; + export { LineChartWrapper }; + + + import LinkWrapper from './link'; + export { LinkWrapper }; + + + import LiveRegionWrapper from './live-region'; + export { LiveRegionWrapper }; + + + import MixedLineBarChartWrapper from './mixed-line-bar-chart'; + export { MixedLineBarChartWrapper }; + + + import ModalWrapper from './modal'; + export { ModalWrapper }; + + + import MultiselectWrapper from './multiselect'; + export { MultiselectWrapper }; + + + import PaginationWrapper from './pagination'; + export { PaginationWrapper }; + + + import PieChartWrapper from './pie-chart'; + export { PieChartWrapper }; + + + import PopoverWrapper from './popover'; + export { PopoverWrapper }; + + + import ProgressBarWrapper from './progress-bar'; + export { ProgressBarWrapper }; + + + import PromptInputWrapper from './prompt-input'; + export { PromptInputWrapper }; + + + import PropertyFilterWrapper from './property-filter'; + export { PropertyFilterWrapper }; + + + import RadioGroupWrapper from './radio-group'; + export { RadioGroupWrapper }; + + + import S3ResourceSelectorWrapper from './s3-resource-selector'; + export { S3ResourceSelectorWrapper }; + + + import SegmentedControlWrapper from './segmented-control'; + export { SegmentedControlWrapper }; + + + import SelectWrapper from './select'; + export { SelectWrapper }; + + + import SideNavigationWrapper from './side-navigation'; + export { SideNavigationWrapper }; + + + import SliderWrapper from './slider'; + export { SliderWrapper }; + + + import SpaceBetweenWrapper from './space-between'; + export { SpaceBetweenWrapper }; + + + import SpinnerWrapper from './spinner'; + export { SpinnerWrapper }; + + + import SplitPanelWrapper from './split-panel'; + export { SplitPanelWrapper }; + + + import StatusIndicatorWrapper from './status-indicator'; + export { StatusIndicatorWrapper }; + + + import StepsWrapper from './steps'; + export { StepsWrapper }; + + + import TableWrapper from './table'; + export { TableWrapper }; + + + import TabsWrapper from './tabs'; + export { TabsWrapper }; + + + import TagEditorWrapper from './tag-editor'; + export { TagEditorWrapper }; + + + import TextContentWrapper from './text-content'; + export { TextContentWrapper }; + + + import TextFilterWrapper from './text-filter'; + export { TextFilterWrapper }; + + + import TextareaWrapper from './textarea'; + export { TextareaWrapper }; + + + import TilesWrapper from './tiles'; + export { TilesWrapper }; + + + import TimeInputWrapper from './time-input'; + export { TimeInputWrapper }; + + + import ToggleWrapper from './toggle'; + export { ToggleWrapper }; + + + import ToggleButtonWrapper from './toggle-button'; + export { ToggleButtonWrapper }; + + + import TokenGroupWrapper from './token-group'; + export { TokenGroupWrapper }; + + + import TopNavigationWrapper from './top-navigation'; + export { TopNavigationWrapper }; + + + import TutorialPanelWrapper from './tutorial-panel'; + export { TutorialPanelWrapper }; + + + import WizardWrapper from './wizard'; + export { WizardWrapper }; + +declare module '@cloudscape-design/test-utils-core/dist/dom' { + interface ElementWrapper { + findAlert(selector?: string): AlertWrapper | null; +findAnchorNavigation(selector?: string): AnchorNavigationWrapper | null; +findAnnotation(selector?: string): AnnotationWrapper | null; +findAppLayout(selector?: string): AppLayoutWrapper | null; +findAreaChart(selector?: string): AreaChartWrapper | null; +findAttributeEditor(selector?: string): AttributeEditorWrapper | null; +findAutosuggest(selector?: string): AutosuggestWrapper | null; +findBadge(selector?: string): BadgeWrapper | null; +findBarChart(selector?: string): BarChartWrapper | null; +findBox(selector?: string): BoxWrapper | null; +findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper | null; +findButton(selector?: string): ButtonWrapper | null; +findButtonDropdown(selector?: string): ButtonDropdownWrapper | null; +findButtonGroup(selector?: string): ButtonGroupWrapper | null; +findCalendar(selector?: string): CalendarWrapper | null; +findCards(selector?: string): CardsWrapper | null; +findCheckbox(selector?: string): CheckboxWrapper | null; +findCodeEditor(selector?: string): CodeEditorWrapper | null; +findCollectionPreferences(selector?: string): CollectionPreferencesWrapper | null; +findColumnLayout(selector?: string): ColumnLayoutWrapper | null; +findContainer(selector?: string): ContainerWrapper | null; +findContentLayout(selector?: string): ContentLayoutWrapper | null; +findCopyToClipboard(selector?: string): CopyToClipboardWrapper | null; +findDateInput(selector?: string): DateInputWrapper | null; +findDatePicker(selector?: string): DatePickerWrapper | null; +findDateRangePicker(selector?: string): DateRangePickerWrapper | null; +findDrawer(selector?: string): DrawerWrapper | null; +findExpandableSection(selector?: string): ExpandableSectionWrapper | null; +findFileUpload(selector?: string): FileUploadWrapper | null; +findFlashbar(selector?: string): FlashbarWrapper | null; +findForm(selector?: string): FormWrapper | null; +findFormField(selector?: string): FormFieldWrapper | null; +findGrid(selector?: string): GridWrapper | null; +findHeader(selector?: string): HeaderWrapper | null; +findHelpPanel(selector?: string): HelpPanelWrapper | null; +findHotspot(selector?: string): HotspotWrapper | null; +findIcon(selector?: string): IconWrapper | null; +findInput(selector?: string): InputWrapper | null; +findKeyValuePairs(selector?: string): KeyValuePairsWrapper | null; +findLineChart(selector?: string): LineChartWrapper | null; +findLink(selector?: string): LinkWrapper | null; +findLiveRegion(selector?: string): LiveRegionWrapper | null; +findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper | null; +findModal(selector?: string): ModalWrapper | null; +findMultiselect(selector?: string): MultiselectWrapper | null; +findPagination(selector?: string): PaginationWrapper | null; +findPieChart(selector?: string): PieChartWrapper | null; +findPopover(selector?: string): PopoverWrapper | null; +findProgressBar(selector?: string): ProgressBarWrapper | null; +findPromptInput(selector?: string): PromptInputWrapper | null; +findPropertyFilter(selector?: string): PropertyFilterWrapper | null; +findRadioGroup(selector?: string): RadioGroupWrapper | null; +findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper | null; +findSegmentedControl(selector?: string): SegmentedControlWrapper | null; +findSelect(selector?: string): SelectWrapper | null; +findSideNavigation(selector?: string): SideNavigationWrapper | null; +findSlider(selector?: string): SliderWrapper | null; +findSpaceBetween(selector?: string): SpaceBetweenWrapper | null; +findSpinner(selector?: string): SpinnerWrapper | null; +findSplitPanel(selector?: string): SplitPanelWrapper | null; +findStatusIndicator(selector?: string): StatusIndicatorWrapper | null; +findSteps(selector?: string): StepsWrapper | null; +findTable(selector?: string): TableWrapper | null; +findTabs(selector?: string): TabsWrapper | null; +findTagEditor(selector?: string): TagEditorWrapper | null; +findTextContent(selector?: string): TextContentWrapper | null; +findTextFilter(selector?: string): TextFilterWrapper | null; +findTextarea(selector?: string): TextareaWrapper | null; +findTiles(selector?: string): TilesWrapper | null; +findTimeInput(selector?: string): TimeInputWrapper | null; +findToggle(selector?: string): ToggleWrapper | null; +findToggleButton(selector?: string): ToggleButtonWrapper | null; +findTokenGroup(selector?: string): TokenGroupWrapper | null; +findTopNavigation(selector?: string): TopNavigationWrapper | null; +findTutorialPanel(selector?: string): TutorialPanelWrapper | null; +findWizard(selector?: string): WizardWrapper | null; + } + } +ElementWrapper.prototype.findAlert = function(selector) { + const rootSelector = \`.\${AlertWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); + }; +ElementWrapper.prototype.findAnchorNavigation = function(selector) { + const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); + }; +ElementWrapper.prototype.findAnnotation = function(selector) { + const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); + }; +ElementWrapper.prototype.findAppLayout = function(selector) { + const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); + }; +ElementWrapper.prototype.findAreaChart = function(selector) { + const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); + }; +ElementWrapper.prototype.findAttributeEditor = function(selector) { + const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); + }; +ElementWrapper.prototype.findAutosuggest = function(selector) { + const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); + }; +ElementWrapper.prototype.findBadge = function(selector) { + const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); + }; +ElementWrapper.prototype.findBarChart = function(selector) { + const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); + }; +ElementWrapper.prototype.findBox = function(selector) { + const rootSelector = \`.\${BoxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); + }; +ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { + const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); + }; +ElementWrapper.prototype.findButton = function(selector) { + const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); + }; +ElementWrapper.prototype.findButtonDropdown = function(selector) { + const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); + }; +ElementWrapper.prototype.findButtonGroup = function(selector) { + const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); + }; +ElementWrapper.prototype.findCalendar = function(selector) { + const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); + }; +ElementWrapper.prototype.findCards = function(selector) { + const rootSelector = \`.\${CardsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); + }; +ElementWrapper.prototype.findCheckbox = function(selector) { + const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); + }; +ElementWrapper.prototype.findCodeEditor = function(selector) { + const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); + }; +ElementWrapper.prototype.findCollectionPreferences = function(selector) { + const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); + }; +ElementWrapper.prototype.findColumnLayout = function(selector) { + const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); + }; +ElementWrapper.prototype.findContainer = function(selector) { + const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); + }; +ElementWrapper.prototype.findContentLayout = function(selector) { + const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); + }; +ElementWrapper.prototype.findCopyToClipboard = function(selector) { + const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); + }; +ElementWrapper.prototype.findDateInput = function(selector) { + const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); + }; +ElementWrapper.prototype.findDatePicker = function(selector) { + const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); + }; +ElementWrapper.prototype.findDateRangePicker = function(selector) { + const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); + }; +ElementWrapper.prototype.findDrawer = function(selector) { + const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); + }; +ElementWrapper.prototype.findExpandableSection = function(selector) { + const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); + }; +ElementWrapper.prototype.findFileUpload = function(selector) { + const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); + }; +ElementWrapper.prototype.findFlashbar = function(selector) { + const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); + }; +ElementWrapper.prototype.findForm = function(selector) { + const rootSelector = \`.\${FormWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); + }; +ElementWrapper.prototype.findFormField = function(selector) { + const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); + }; +ElementWrapper.prototype.findGrid = function(selector) { + const rootSelector = \`.\${GridWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); + }; +ElementWrapper.prototype.findHeader = function(selector) { + const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); + }; +ElementWrapper.prototype.findHelpPanel = function(selector) { + const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); + }; +ElementWrapper.prototype.findHotspot = function(selector) { + const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); + }; +ElementWrapper.prototype.findIcon = function(selector) { + const rootSelector = \`.\${IconWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); + }; +ElementWrapper.prototype.findInput = function(selector) { + const rootSelector = \`.\${InputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); + }; +ElementWrapper.prototype.findKeyValuePairs = function(selector) { + const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); + }; +ElementWrapper.prototype.findLineChart = function(selector) { + const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); + }; +ElementWrapper.prototype.findLink = function(selector) { + const rootSelector = \`.\${LinkWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); + }; +ElementWrapper.prototype.findLiveRegion = function(selector) { + const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); + }; +ElementWrapper.prototype.findMixedLineBarChart = function(selector) { + const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); + }; +ElementWrapper.prototype.findModal = function(selector) { + const rootSelector = \`.\${ModalWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); + }; +ElementWrapper.prototype.findMultiselect = function(selector) { + const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); + }; +ElementWrapper.prototype.findPagination = function(selector) { + const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); + }; +ElementWrapper.prototype.findPieChart = function(selector) { + const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); + }; +ElementWrapper.prototype.findPopover = function(selector) { + const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); + }; +ElementWrapper.prototype.findProgressBar = function(selector) { + const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); + }; +ElementWrapper.prototype.findPromptInput = function(selector) { + const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); + }; +ElementWrapper.prototype.findPropertyFilter = function(selector) { + const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); + }; +ElementWrapper.prototype.findRadioGroup = function(selector) { + const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); + }; +ElementWrapper.prototype.findS3ResourceSelector = function(selector) { + const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); + }; +ElementWrapper.prototype.findSegmentedControl = function(selector) { + const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); + }; +ElementWrapper.prototype.findSelect = function(selector) { + const rootSelector = \`.\${SelectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); + }; +ElementWrapper.prototype.findSideNavigation = function(selector) { + const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); + }; +ElementWrapper.prototype.findSlider = function(selector) { + const rootSelector = \`.\${SliderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); + }; +ElementWrapper.prototype.findSpaceBetween = function(selector) { + const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); + }; +ElementWrapper.prototype.findSpinner = function(selector) { + const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); + }; +ElementWrapper.prototype.findSplitPanel = function(selector) { + const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); + }; +ElementWrapper.prototype.findStatusIndicator = function(selector) { + const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); + }; +ElementWrapper.prototype.findSteps = function(selector) { + const rootSelector = \`.\${StepsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); + }; +ElementWrapper.prototype.findTable = function(selector) { + const rootSelector = \`.\${TableWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); + }; +ElementWrapper.prototype.findTabs = function(selector) { + const rootSelector = \`.\${TabsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); + }; +ElementWrapper.prototype.findTagEditor = function(selector) { + const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); + }; +ElementWrapper.prototype.findTextContent = function(selector) { + const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); + }; +ElementWrapper.prototype.findTextFilter = function(selector) { + const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); + }; +ElementWrapper.prototype.findTextarea = function(selector) { + const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); + }; +ElementWrapper.prototype.findTiles = function(selector) { + const rootSelector = \`.\${TilesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); + }; +ElementWrapper.prototype.findTimeInput = function(selector) { + const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); + }; +ElementWrapper.prototype.findToggle = function(selector) { + const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); + }; +ElementWrapper.prototype.findToggleButton = function(selector) { + const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); + }; +ElementWrapper.prototype.findTokenGroup = function(selector) { + const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); + }; +ElementWrapper.prototype.findTopNavigation = function(selector) { + const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); + }; +ElementWrapper.prototype.findTutorialPanel = function(selector) { + const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); + }; +ElementWrapper.prototype.findWizard = function(selector) { + const rootSelector = \`.\${WizardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); + }; +export default function wrapper(root: Element = document.body) { if (document && document.body && !document.body.contains(root)) { console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly')}; return new ElementWrapper(root); }" +`; + +exports[`Generate test utils ElementWrapper selectors ElementWrapper matches the snapshot 1`] = ` +"import { ElementWrapper } from '@cloudscape-design/test-utils-core/selectors'; +import { appendSelector } from '@cloudscape-design/test-utils-core/utils'; +export { ElementWrapper }; + + import AlertWrapper from './alert'; + export { AlertWrapper }; + + + import AnchorNavigationWrapper from './anchor-navigation'; + export { AnchorNavigationWrapper }; + + + import AnnotationWrapper from './annotation'; + export { AnnotationWrapper }; + + + import AppLayoutWrapper from './app-layout'; + export { AppLayoutWrapper }; + + + import AreaChartWrapper from './area-chart'; + export { AreaChartWrapper }; + + + import AttributeEditorWrapper from './attribute-editor'; + export { AttributeEditorWrapper }; + + + import AutosuggestWrapper from './autosuggest'; + export { AutosuggestWrapper }; + + + import BadgeWrapper from './badge'; + export { BadgeWrapper }; + + + import BarChartWrapper from './bar-chart'; + export { BarChartWrapper }; + + + import BoxWrapper from './box'; + export { BoxWrapper }; + + + import BreadcrumbGroupWrapper from './breadcrumb-group'; + export { BreadcrumbGroupWrapper }; + + + import ButtonWrapper from './button'; + export { ButtonWrapper }; + + + import ButtonDropdownWrapper from './button-dropdown'; + export { ButtonDropdownWrapper }; + + + import ButtonGroupWrapper from './button-group'; + export { ButtonGroupWrapper }; + + + import CalendarWrapper from './calendar'; + export { CalendarWrapper }; + + + import CardsWrapper from './cards'; + export { CardsWrapper }; + + + import CheckboxWrapper from './checkbox'; + export { CheckboxWrapper }; + + + import CodeEditorWrapper from './code-editor'; + export { CodeEditorWrapper }; + + + import CollectionPreferencesWrapper from './collection-preferences'; + export { CollectionPreferencesWrapper }; + + + import ColumnLayoutWrapper from './column-layout'; + export { ColumnLayoutWrapper }; + + + import ContainerWrapper from './container'; + export { ContainerWrapper }; + + + import ContentLayoutWrapper from './content-layout'; + export { ContentLayoutWrapper }; + + + import CopyToClipboardWrapper from './copy-to-clipboard'; + export { CopyToClipboardWrapper }; + + + import DateInputWrapper from './date-input'; + export { DateInputWrapper }; + + + import DatePickerWrapper from './date-picker'; + export { DatePickerWrapper }; + + + import DateRangePickerWrapper from './date-range-picker'; + export { DateRangePickerWrapper }; + + + import DrawerWrapper from './drawer'; + export { DrawerWrapper }; + + + import ExpandableSectionWrapper from './expandable-section'; + export { ExpandableSectionWrapper }; + + + import FileUploadWrapper from './file-upload'; + export { FileUploadWrapper }; + + + import FlashbarWrapper from './flashbar'; + export { FlashbarWrapper }; + + + import FormWrapper from './form'; + export { FormWrapper }; + + + import FormFieldWrapper from './form-field'; + export { FormFieldWrapper }; + + + import GridWrapper from './grid'; + export { GridWrapper }; + + + import HeaderWrapper from './header'; + export { HeaderWrapper }; + + + import HelpPanelWrapper from './help-panel'; + export { HelpPanelWrapper }; + + + import HotspotWrapper from './hotspot'; + export { HotspotWrapper }; + + + import IconWrapper from './icon'; + export { IconWrapper }; + + + import InputWrapper from './input'; + export { InputWrapper }; + + + import KeyValuePairsWrapper from './key-value-pairs'; + export { KeyValuePairsWrapper }; + + + import LineChartWrapper from './line-chart'; + export { LineChartWrapper }; + + + import LinkWrapper from './link'; + export { LinkWrapper }; + + + import LiveRegionWrapper from './live-region'; + export { LiveRegionWrapper }; + + + import MixedLineBarChartWrapper from './mixed-line-bar-chart'; + export { MixedLineBarChartWrapper }; + + + import ModalWrapper from './modal'; + export { ModalWrapper }; + + + import MultiselectWrapper from './multiselect'; + export { MultiselectWrapper }; + + + import PaginationWrapper from './pagination'; + export { PaginationWrapper }; + + + import PieChartWrapper from './pie-chart'; + export { PieChartWrapper }; + + + import PopoverWrapper from './popover'; + export { PopoverWrapper }; + + + import ProgressBarWrapper from './progress-bar'; + export { ProgressBarWrapper }; + + + import PromptInputWrapper from './prompt-input'; + export { PromptInputWrapper }; + + + import PropertyFilterWrapper from './property-filter'; + export { PropertyFilterWrapper }; + + + import RadioGroupWrapper from './radio-group'; + export { RadioGroupWrapper }; + + + import S3ResourceSelectorWrapper from './s3-resource-selector'; + export { S3ResourceSelectorWrapper }; + + + import SegmentedControlWrapper from './segmented-control'; + export { SegmentedControlWrapper }; + + + import SelectWrapper from './select'; + export { SelectWrapper }; + + + import SideNavigationWrapper from './side-navigation'; + export { SideNavigationWrapper }; + + + import SliderWrapper from './slider'; + export { SliderWrapper }; + + + import SpaceBetweenWrapper from './space-between'; + export { SpaceBetweenWrapper }; + + + import SpinnerWrapper from './spinner'; + export { SpinnerWrapper }; + + + import SplitPanelWrapper from './split-panel'; + export { SplitPanelWrapper }; + + + import StatusIndicatorWrapper from './status-indicator'; + export { StatusIndicatorWrapper }; + + + import StepsWrapper from './steps'; + export { StepsWrapper }; + + + import TableWrapper from './table'; + export { TableWrapper }; + + + import TabsWrapper from './tabs'; + export { TabsWrapper }; + + + import TagEditorWrapper from './tag-editor'; + export { TagEditorWrapper }; + + + import TextContentWrapper from './text-content'; + export { TextContentWrapper }; + + + import TextFilterWrapper from './text-filter'; + export { TextFilterWrapper }; + + + import TextareaWrapper from './textarea'; + export { TextareaWrapper }; + + + import TilesWrapper from './tiles'; + export { TilesWrapper }; + + + import TimeInputWrapper from './time-input'; + export { TimeInputWrapper }; + + + import ToggleWrapper from './toggle'; + export { ToggleWrapper }; + + + import ToggleButtonWrapper from './toggle-button'; + export { ToggleButtonWrapper }; + + + import TokenGroupWrapper from './token-group'; + export { TokenGroupWrapper }; + + + import TopNavigationWrapper from './top-navigation'; + export { TopNavigationWrapper }; + + + import TutorialPanelWrapper from './tutorial-panel'; + export { TutorialPanelWrapper }; + + + import WizardWrapper from './wizard'; + export { WizardWrapper }; + +declare module '@cloudscape-design/test-utils-core/dist/selectors' { + interface ElementWrapper { + findAlert(selector?: string): AlertWrapper; +findAnchorNavigation(selector?: string): AnchorNavigationWrapper; +findAnnotation(selector?: string): AnnotationWrapper; +findAppLayout(selector?: string): AppLayoutWrapper; +findAreaChart(selector?: string): AreaChartWrapper; +findAttributeEditor(selector?: string): AttributeEditorWrapper; +findAutosuggest(selector?: string): AutosuggestWrapper; +findBadge(selector?: string): BadgeWrapper; +findBarChart(selector?: string): BarChartWrapper; +findBox(selector?: string): BoxWrapper; +findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper; +findButton(selector?: string): ButtonWrapper; +findButtonDropdown(selector?: string): ButtonDropdownWrapper; +findButtonGroup(selector?: string): ButtonGroupWrapper; +findCalendar(selector?: string): CalendarWrapper; +findCards(selector?: string): CardsWrapper; +findCheckbox(selector?: string): CheckboxWrapper; +findCodeEditor(selector?: string): CodeEditorWrapper; +findCollectionPreferences(selector?: string): CollectionPreferencesWrapper; +findColumnLayout(selector?: string): ColumnLayoutWrapper; +findContainer(selector?: string): ContainerWrapper; +findContentLayout(selector?: string): ContentLayoutWrapper; +findCopyToClipboard(selector?: string): CopyToClipboardWrapper; +findDateInput(selector?: string): DateInputWrapper; +findDatePicker(selector?: string): DatePickerWrapper; +findDateRangePicker(selector?: string): DateRangePickerWrapper; +findDrawer(selector?: string): DrawerWrapper; +findExpandableSection(selector?: string): ExpandableSectionWrapper; +findFileUpload(selector?: string): FileUploadWrapper; +findFlashbar(selector?: string): FlashbarWrapper; +findForm(selector?: string): FormWrapper; +findFormField(selector?: string): FormFieldWrapper; +findGrid(selector?: string): GridWrapper; +findHeader(selector?: string): HeaderWrapper; +findHelpPanel(selector?: string): HelpPanelWrapper; +findHotspot(selector?: string): HotspotWrapper; +findIcon(selector?: string): IconWrapper; +findInput(selector?: string): InputWrapper; +findKeyValuePairs(selector?: string): KeyValuePairsWrapper; +findLineChart(selector?: string): LineChartWrapper; +findLink(selector?: string): LinkWrapper; +findLiveRegion(selector?: string): LiveRegionWrapper; +findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper; +findModal(selector?: string): ModalWrapper; +findMultiselect(selector?: string): MultiselectWrapper; +findPagination(selector?: string): PaginationWrapper; +findPieChart(selector?: string): PieChartWrapper; +findPopover(selector?: string): PopoverWrapper; +findProgressBar(selector?: string): ProgressBarWrapper; +findPromptInput(selector?: string): PromptInputWrapper; +findPropertyFilter(selector?: string): PropertyFilterWrapper; +findRadioGroup(selector?: string): RadioGroupWrapper; +findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper; +findSegmentedControl(selector?: string): SegmentedControlWrapper; +findSelect(selector?: string): SelectWrapper; +findSideNavigation(selector?: string): SideNavigationWrapper; +findSlider(selector?: string): SliderWrapper; +findSpaceBetween(selector?: string): SpaceBetweenWrapper; +findSpinner(selector?: string): SpinnerWrapper; +findSplitPanel(selector?: string): SplitPanelWrapper; +findStatusIndicator(selector?: string): StatusIndicatorWrapper; +findSteps(selector?: string): StepsWrapper; +findTable(selector?: string): TableWrapper; +findTabs(selector?: string): TabsWrapper; +findTagEditor(selector?: string): TagEditorWrapper; +findTextContent(selector?: string): TextContentWrapper; +findTextFilter(selector?: string): TextFilterWrapper; +findTextarea(selector?: string): TextareaWrapper; +findTiles(selector?: string): TilesWrapper; +findTimeInput(selector?: string): TimeInputWrapper; +findToggle(selector?: string): ToggleWrapper; +findToggleButton(selector?: string): ToggleButtonWrapper; +findTokenGroup(selector?: string): TokenGroupWrapper; +findTopNavigation(selector?: string): TopNavigationWrapper; +findTutorialPanel(selector?: string): TutorialPanelWrapper; +findWizard(selector?: string): WizardWrapper; + } + } +ElementWrapper.prototype.findAlert = function(selector) { + const rootSelector = \`.\${AlertWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); + }; +ElementWrapper.prototype.findAnchorNavigation = function(selector) { + const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); + }; +ElementWrapper.prototype.findAnnotation = function(selector) { + const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); + }; +ElementWrapper.prototype.findAppLayout = function(selector) { + const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); + }; +ElementWrapper.prototype.findAreaChart = function(selector) { + const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); + }; +ElementWrapper.prototype.findAttributeEditor = function(selector) { + const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); + }; +ElementWrapper.prototype.findAutosuggest = function(selector) { + const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); + }; +ElementWrapper.prototype.findBadge = function(selector) { + const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); + }; +ElementWrapper.prototype.findBarChart = function(selector) { + const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); + }; +ElementWrapper.prototype.findBox = function(selector) { + const rootSelector = \`.\${BoxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); + }; +ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { + const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); + }; +ElementWrapper.prototype.findButton = function(selector) { + const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); + }; +ElementWrapper.prototype.findButtonDropdown = function(selector) { + const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); + }; +ElementWrapper.prototype.findButtonGroup = function(selector) { + const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); + }; +ElementWrapper.prototype.findCalendar = function(selector) { + const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); + }; +ElementWrapper.prototype.findCards = function(selector) { + const rootSelector = \`.\${CardsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); + }; +ElementWrapper.prototype.findCheckbox = function(selector) { + const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); + }; +ElementWrapper.prototype.findCodeEditor = function(selector) { + const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); + }; +ElementWrapper.prototype.findCollectionPreferences = function(selector) { + const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); + }; +ElementWrapper.prototype.findColumnLayout = function(selector) { + const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); + }; +ElementWrapper.prototype.findContainer = function(selector) { + const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); + }; +ElementWrapper.prototype.findContentLayout = function(selector) { + const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); + }; +ElementWrapper.prototype.findCopyToClipboard = function(selector) { + const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); + }; +ElementWrapper.prototype.findDateInput = function(selector) { + const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); + }; +ElementWrapper.prototype.findDatePicker = function(selector) { + const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); + }; +ElementWrapper.prototype.findDateRangePicker = function(selector) { + const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); + }; +ElementWrapper.prototype.findDrawer = function(selector) { + const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); + }; +ElementWrapper.prototype.findExpandableSection = function(selector) { + const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); + }; +ElementWrapper.prototype.findFileUpload = function(selector) { + const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); + }; +ElementWrapper.prototype.findFlashbar = function(selector) { + const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); + }; +ElementWrapper.prototype.findForm = function(selector) { + const rootSelector = \`.\${FormWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); + }; +ElementWrapper.prototype.findFormField = function(selector) { + const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); + }; +ElementWrapper.prototype.findGrid = function(selector) { + const rootSelector = \`.\${GridWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); + }; +ElementWrapper.prototype.findHeader = function(selector) { + const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); + }; +ElementWrapper.prototype.findHelpPanel = function(selector) { + const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); + }; +ElementWrapper.prototype.findHotspot = function(selector) { + const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); + }; +ElementWrapper.prototype.findIcon = function(selector) { + const rootSelector = \`.\${IconWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); + }; +ElementWrapper.prototype.findInput = function(selector) { + const rootSelector = \`.\${InputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); + }; +ElementWrapper.prototype.findKeyValuePairs = function(selector) { + const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); + }; +ElementWrapper.prototype.findLineChart = function(selector) { + const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); + }; +ElementWrapper.prototype.findLink = function(selector) { + const rootSelector = \`.\${LinkWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); + }; +ElementWrapper.prototype.findLiveRegion = function(selector) { + const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); + }; +ElementWrapper.prototype.findMixedLineBarChart = function(selector) { + const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); + }; +ElementWrapper.prototype.findModal = function(selector) { + const rootSelector = \`.\${ModalWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); + }; +ElementWrapper.prototype.findMultiselect = function(selector) { + const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); + }; +ElementWrapper.prototype.findPagination = function(selector) { + const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); + }; +ElementWrapper.prototype.findPieChart = function(selector) { + const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); + }; +ElementWrapper.prototype.findPopover = function(selector) { + const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); + }; +ElementWrapper.prototype.findProgressBar = function(selector) { + const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); + }; +ElementWrapper.prototype.findPromptInput = function(selector) { + const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); + }; +ElementWrapper.prototype.findPropertyFilter = function(selector) { + const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); + }; +ElementWrapper.prototype.findRadioGroup = function(selector) { + const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); + }; +ElementWrapper.prototype.findS3ResourceSelector = function(selector) { + const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); + }; +ElementWrapper.prototype.findSegmentedControl = function(selector) { + const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); + }; +ElementWrapper.prototype.findSelect = function(selector) { + const rootSelector = \`.\${SelectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); + }; +ElementWrapper.prototype.findSideNavigation = function(selector) { + const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); + }; +ElementWrapper.prototype.findSlider = function(selector) { + const rootSelector = \`.\${SliderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); + }; +ElementWrapper.prototype.findSpaceBetween = function(selector) { + const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); + }; +ElementWrapper.prototype.findSpinner = function(selector) { + const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); + }; +ElementWrapper.prototype.findSplitPanel = function(selector) { + const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); + }; +ElementWrapper.prototype.findStatusIndicator = function(selector) { + const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); + }; +ElementWrapper.prototype.findSteps = function(selector) { + const rootSelector = \`.\${StepsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); + }; +ElementWrapper.prototype.findTable = function(selector) { + const rootSelector = \`.\${TableWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); + }; +ElementWrapper.prototype.findTabs = function(selector) { + const rootSelector = \`.\${TabsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); + }; +ElementWrapper.prototype.findTagEditor = function(selector) { + const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); + }; +ElementWrapper.prototype.findTextContent = function(selector) { + const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); + }; +ElementWrapper.prototype.findTextFilter = function(selector) { + const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); + }; +ElementWrapper.prototype.findTextarea = function(selector) { + const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); + }; +ElementWrapper.prototype.findTiles = function(selector) { + const rootSelector = \`.\${TilesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); + }; +ElementWrapper.prototype.findTimeInput = function(selector) { + const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); + }; +ElementWrapper.prototype.findToggle = function(selector) { + const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); + }; +ElementWrapper.prototype.findToggleButton = function(selector) { + const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); + }; +ElementWrapper.prototype.findTokenGroup = function(selector) { + const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); + }; +ElementWrapper.prototype.findTopNavigation = function(selector) { + const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); + }; +ElementWrapper.prototype.findTutorialPanel = function(selector) { + const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); + }; +ElementWrapper.prototype.findWizard = function(selector) { + const rootSelector = \`.\${WizardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); + }; +export default function wrapper(root: string = 'body') { return new ElementWrapper(root); }" +`; diff --git a/src/__tests__/snapshot-tests/test-utils-wrappers.test.tsx b/src/__tests__/snapshot-tests/test-utils-wrappers.test.tsx new file mode 100644 index 0000000000..dcd11e1d60 --- /dev/null +++ b/src/__tests__/snapshot-tests/test-utils-wrappers.test.tsx @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import fs from 'fs'; +import path from 'path'; + +describe('Generate test utils ElementWrapper', () => { + const importPaths = [ + { + type: 'dom', + relativePath: '../../test-utils/dom/index.ts', + }, + { + type: 'selectors', + relativePath: '../../test-utils/selectors/index.ts', + }, + ] as const; + + test.each(importPaths)('$type ElementWrapper matches the snapshot', ({ relativePath }) => { + const testUtilsPath = path.join(__dirname, relativePath); + const domWrapper = fs.readFileSync(testUtilsPath, 'utf8'); + expect(domWrapper).toMatchSnapshot(); + }); +}); From 7a5e18d30c87e96c4b4944f07e16445f78287a58 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Fri, 8 Nov 2024 09:38:37 +0100 Subject: [PATCH 03/12] feat: Adds test id to the anchor list component (#2988) --- .../__snapshots__/documenter.test.ts.snap | 11 +++++++ .../__tests__/anchor-navigation.test.tsx | 30 +++++++++++++++++++ src/anchor-navigation/interfaces.ts | 7 +++++ src/anchor-navigation/internal.tsx | 10 +++++-- .../test-classes/styles.scss | 4 +++ src/test-utils/dom/anchor-navigation/index.ts | 15 ++++++++++ 6 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap index 82330a588c..2de01c0213 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap @@ -144,6 +144,11 @@ or when the \`activeHref\` prop is manually updated. "optional": false, "type": "number", }, + { + "name": "testId", + "optional": true, + "type": "string", + }, { "name": "text", "optional": false, @@ -176,6 +181,11 @@ or when the \`activeHref\` prop is manually updated. "optional": false, "type": "number", }, + { + "name": "testId", + "optional": true, + "type": "string", + }, { "name": "text", "optional": false, @@ -205,6 +215,7 @@ controlled manner, and internal scroll-spy will be disabled.", For example: \`"#section1.1"\` * \`level\` (number) - Level of nesting of the anchor. * \`info\` (string | undefined) - Additional information to display next to the link, for example: "New" or "Updated". +* \`testId\` (string | undefined) - Test id for the anchor item. Adds data-testid to the anchor item. Note: The list of anchors should be sorted in the order they appear on the page. ", diff --git a/src/anchor-navigation/__tests__/anchor-navigation.test.tsx b/src/anchor-navigation/__tests__/anchor-navigation.test.tsx index d76486835e..fecf07b6bc 100644 --- a/src/anchor-navigation/__tests__/anchor-navigation.test.tsx +++ b/src/anchor-navigation/__tests__/anchor-navigation.test.tsx @@ -60,6 +60,23 @@ describe('AnchorNavigation', () => { expect(wrapper.findAnchorByIndex(1)!.findInfo()!.getElement()).toHaveTextContent('New'); }); + it('finds anchor by test id', () => { + const wrapper = renderAnchorNavigation({ + anchors: [ + { text: 'Section 1', href: '#section1', level: 1, testId: 'section-1' }, + { text: 'Section 2', href: '#section2', level: 1, testId: 'section-2' }, + ], + }); + expect(wrapper.findAnchorByTestId('section-1')!.getElement()).toHaveTextContent('Section 1'); + }); + + it('returns the matching anchor by test id even if the test id contains double quotes', () => { + const wrapper = renderAnchorNavigation({ + anchors: [{ text: 'Section 1', href: '#section1', level: 1, testId: '"section-test-id"' }], + }); + expect(wrapper.findAnchorByTestId('"section-test-id"')!.getElement()).toHaveTextContent('Section 1'); + }); + it('applies aria-labelledby correctly', () => { const wrapper = renderAnchorNavigation({ anchors: [], @@ -99,6 +116,19 @@ describe('AnchorNavigation', () => { expect(wrapper.findAnchorByIndex(2)!.isActive()).toBe(true); }); + it('sets data-testid attribute to anchor when testId prop is specified', () => { + const wrapper = renderAnchorNavigation({ + anchors: [ + { text: 'Section 1', href: '#section1', level: 1, testId: 'section-1' }, + { text: 'Section 2', href: '#section2', level: 1, testId: 'section-2' }, + ], + activeHref: '#section2', + }); + + const anchorTestIds = wrapper.findAnchors().map(anchor => anchor.getElement().getAttribute('data-testid')); + expect(anchorTestIds).toEqual(['section-1', 'section-2']); + }); + it('calls onActiveHrefChange when a new anchor is active', () => { const onActiveHrefChange = jest.fn(); diff --git a/src/anchor-navigation/interfaces.ts b/src/anchor-navigation/interfaces.ts index 3309541fdd..d5142d498d 100644 --- a/src/anchor-navigation/interfaces.ts +++ b/src/anchor-navigation/interfaces.ts @@ -21,6 +21,7 @@ export interface AnchorNavigationProps extends BaseComponentProps { * For example: `"#section1.1"` * * `level` (number) - Level of nesting of the anchor. * * `info` (string | undefined) - Additional information to display next to the link, for example: "New" or "Updated". + * * `testId` (string | undefined) - Test id for the anchor item. Adds data-testid to the anchor item. * * Note: The list of anchors should be sorted in the order they appear on the page. */ @@ -75,5 +76,11 @@ export namespace AnchorNavigationProps { * Additional information to display next to the link, for example: "New" or "Updated". */ info?: string; + + /** + * Test ID of the anchor item. + * Assigns this value to the `data-testid` attribute of the anchor's root element. + */ + testId?: string; } } diff --git a/src/anchor-navigation/internal.tsx b/src/anchor-navigation/internal.tsx index af8d69ed44..c81bdd647e 100644 --- a/src/anchor-navigation/internal.tsx +++ b/src/anchor-navigation/internal.tsx @@ -63,6 +63,7 @@ export default function InternalAnchorNavigation({ key={index} index={index} anchor={anchor} + testId={anchor.testId} /> ); })} @@ -76,9 +77,10 @@ interface AnchorProps { onFollow: (anchor: AnchorNavigationProps.Anchor, event: React.SyntheticEvent | Event) => void; isActive: boolean; index: number; + testId?: string; } -const Anchor = ({ anchor, onFollow, isActive, index }: AnchorProps) => { +const Anchor = ({ anchor, onFollow, isActive, index, testId }: AnchorProps) => { checkSafeUrl('AnchorNavigation', anchor.href); const onClick = useCallback( @@ -93,7 +95,11 @@ const Anchor = ({ anchor, onFollow, isActive, index }: AnchorProps) => { const activeItemClasses = clsx(styles['anchor-item--active'], testUtilsStyles['anchor-item--active']); return ( -
  • +
  • | null { return this.find(`.${testUtilStyles['anchor-link']}[href="${href}"]`); } + + /** + * Returns the wrapper of the first anchor item that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `anchors` prop. + * If no matching anchor is found, returns `null`. + * + * @param {string} testId + * @returns {AnchorItemWrapper | null} + */ + findAnchorByTestId(testId: string): AnchorItemWrapper | null { + return this.findComponent( + `.${testUtilStyles['anchor-item']}[data-testid="${CSS.escape(testId)}"]`, + AnchorItemWrapper + ); + } } export class AnchorItemWrapper extends ElementWrapper { From 32259699e496b173adfe5f78dacb99a1b807ba60 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Fri, 8 Nov 2024 12:04:15 +0100 Subject: [PATCH 04/12] feat: Adds test id to flashbar dom selector (#2955) --- .../test-utils-selectors.test.tsx.snap | 1 + src/flashbar/__tests__/collapsible.test.tsx | 79 +++++++++++++++++++ src/flashbar/__tests__/flashbar.test.tsx | 61 ++++++++++++++ src/flashbar/collapsible-flashbar.tsx | 1 + src/flashbar/flash.tsx | 2 +- src/flashbar/interfaces.ts | 7 ++ src/flashbar/non-collapsible-flashbar.tsx | 3 +- src/test-utils/dom/anchor-navigation/index.ts | 7 +- src/test-utils/dom/flashbar/index.ts | 16 ++++ 9 files changed, 171 insertions(+), 6 deletions(-) diff --git a/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap b/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap index ea13fb73e6..8e84f3cf83 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap @@ -13,6 +13,7 @@ exports[`test-utils selectors 1`] = ` ], "anchor-navigation": [ "awsui_anchor-item--active_17oho", + "awsui_anchor-item_17oho", "awsui_anchor-link-info_17oho", "awsui_anchor-link-text_17oho", "awsui_anchor-link_17oho", diff --git a/src/flashbar/__tests__/collapsible.test.tsx b/src/flashbar/__tests__/collapsible.test.tsx index d9227b7bfb..db8f385307 100644 --- a/src/flashbar/__tests__/collapsible.test.tsx +++ b/src/flashbar/__tests__/collapsible.test.tsx @@ -151,6 +151,85 @@ describe('Collapsible Flashbar', () => { }); }); + test('assigns data-testid to flash items', () => { + const wrapper = renderFlashbar({ + items: [ + { + testId: 'flash-item-1', + content: 'first flash item', + }, + { + testId: 'flash-item-2', + content: 'second flash item', + }, + ], + }); + findNotificationBar(wrapper)!.click(); + const flashbarItemsTestIds = wrapper + .findItems() + .map(flashbar => flashbar.getElement()!.getAttribute('data-testid')); + + expect(flashbarItemsTestIds).toEqual(['flash-item-1', 'flash-item-2']); + }); + + test('findItemByTestId', () => { + const wrapper = renderFlashbar({ + items: [ + { + testId: 'flash-item-1', + content: 'first flash item', + }, + { + testId: 'flash-item-2', + content: 'second flash item', + }, + ], + }); + findNotificationBar(wrapper)!.click(); + const secondFlashItemFromTestId = wrapper.findItemByTestId('flash-item-2')!.getElement(); + + expect(secondFlashItemFromTestId).toHaveTextContent('second flash item'); + }); + + test('findItemByTestId returns the item even if the test ID contains double quotes', () => { + const wrapper = renderFlashbar({ + items: [ + { + testId: '"flash-item-1"', + content: 'first flash item', + }, + { + testId: '"flash-item-2"', + content: 'second flash item', + }, + ], + }); + findNotificationBar(wrapper)!.click(); + const flashItem = wrapper.findItemByTestId('"flash-item-1"')!.getElement(); + + expect(flashItem).toHaveTextContent('first flash item'); + }); + + test('findItemByTestId doesn not return the next items if the collapsible is not expanded', () => { + const wrapper = renderFlashbar({ + items: [ + { + testId: 'flash-item-1', + content: 'first flash item', + }, + { + testId: 'flash-item-2', + content: 'second flash item', + }, + ], + }); + const fistFlashItem = wrapper.findItemByTestId('flash-item-1'); + const secondFlashItem = wrapper.findItemByTestId('flash-item-2'); + + expect(fistFlashItem).toBeTruthy(); + expect(secondFlashItem).not.toBeTruthy(); + }); + test('findItemsByType', () => { { const wrapper = createFlashbarWrapper( diff --git a/src/flashbar/__tests__/flashbar.test.tsx b/src/flashbar/__tests__/flashbar.test.tsx index d7f283c851..494add2ae5 100644 --- a/src/flashbar/__tests__/flashbar.test.tsx +++ b/src/flashbar/__tests__/flashbar.test.tsx @@ -196,6 +196,67 @@ describe('Flashbar component', () => { } }); + test('assigns data-testid to flash items', () => { + const { container } = reactRender( + + ); + const wrapper = createWrapper(container); + const flashbarItemsTestIds = wrapper + .findFlashbar()! + .findItems() + .map(flashbar => flashbar.getElement()!.getAttribute('data-testid')); + + expect(flashbarItemsTestIds).toEqual(['flash-item-1', 'flash-item-2']); + }); + + test('findItemByTestId', () => { + const { container } = reactRender( + + ); + const wrapper = createWrapper(container); + const secondFlashItemFromTestId = wrapper.findFlashbar()!.findItemByTestId('flash-item-2')!.getElement(); + expect(secondFlashItemFromTestId).toHaveTextContent('second flash item'); + }); + + test('findItemByTestId returns the item even if the test ID contains double quotes', () => { + const { container } = reactRender( + + ); + const wrapper = createWrapper(container); + const flashItem = wrapper.findFlashbar()?.findItemByTestId('"flash-item-test-id"')!.getElement(); + + expect(flashItem).toHaveTextContent('flash item'); + }); + test('findItemsByType', () => { const wrapper = createFlashbarWrapper( | undefined) => (
  • { className: string; transitionState?: string; i18nStrings?: FlashbarProps.I18nStrings; diff --git a/src/flashbar/interfaces.ts b/src/flashbar/interfaces.ts index 16cad04c3b..f45bf6382d 100644 --- a/src/flashbar/interfaces.ts +++ b/src/flashbar/interfaces.ts @@ -20,6 +20,13 @@ export namespace FlashbarProps { buttonText?: ButtonProps['children']; onButtonClick?: ButtonProps['onClick']; onDismiss?: ButtonProps['onClick']; + + /** + * Test ID of the flash list item. + * Assigns this value to the `data-testid` attribute of the flash list item. + * Flash component is the direct child of the flash list item. + */ + testId?: string; } export interface I18nStrings { diff --git a/src/flashbar/non-collapsible-flashbar.tsx b/src/flashbar/non-collapsible-flashbar.tsx index 6d2dcfd49d..1a75e606f8 100644 --- a/src/flashbar/non-collapsible-flashbar.tsx +++ b/src/flashbar/non-collapsible-flashbar.tsx @@ -62,7 +62,7 @@ export default function NonCollapsibleFlashbar({ items, i18nStrings, ...restProp in={true} > {(state: string, transitionRootElement: React.Ref | undefined) => ( -
  • +
  • {renderItem(item, item.id ?? index, transitionRootElement, state)}
  • )} @@ -91,6 +91,7 @@ export default function NonCollapsibleFlashbar({ items, i18nStrings, ...restProp
  • {renderItem(item, item.id ?? index)} diff --git a/src/test-utils/dom/anchor-navigation/index.ts b/src/test-utils/dom/anchor-navigation/index.ts index 1a8ca5cae0..9b62f006a6 100644 --- a/src/test-utils/dom/anchor-navigation/index.ts +++ b/src/test-utils/dom/anchor-navigation/index.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ComponentWrapper, ElementWrapper, usesDom } from '@cloudscape-design/test-utils-core/dom'; +import { escapeSelector } from '@cloudscape-design/test-utils-core/utils.js'; import testUtilStyles from '../../../anchor-navigation/test-classes/styles.selectors.js'; @@ -42,10 +43,8 @@ export default class AnchorNavigationWrapper extends ComponentWrapper { * @returns {AnchorItemWrapper | null} */ findAnchorByTestId(testId: string): AnchorItemWrapper | null { - return this.findComponent( - `.${testUtilStyles['anchor-item']}[data-testid="${CSS.escape(testId)}"]`, - AnchorItemWrapper - ); + const escapedTestId = escapeSelector(testId); + return this.findComponent(`.${testUtilStyles['anchor-item']}[data-testid="${escapedTestId}"]`, AnchorItemWrapper); } } diff --git a/src/test-utils/dom/flashbar/index.ts b/src/test-utils/dom/flashbar/index.ts index dda96af880..11a659fdb0 100644 --- a/src/test-utils/dom/flashbar/index.ts +++ b/src/test-utils/dom/flashbar/index.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom'; +import { escapeSelector } from '@cloudscape-design/test-utils-core/utils'; import FlashWrapper from './flash'; @@ -31,6 +32,21 @@ export default class FlashbarWrapper extends ComponentWrapper { ); } + /** + * Returns the wrapper of the first flash list item that matches the specified test ID. + * If the items are stacked, the hidden items will not be returned. + * + * Looks for the `data-testid` attribute that is assigned via `items` prop. + * If no matching flash list item is found, returns `null`. + * + * @param {string} testId + * @returns {FlashbarWrapper | null} + */ + findItemByTestId(testId: string): FlashWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent(`.${styles['flash-list-item']}[data-testid="${escapedTestId}"]`, FlashWrapper); + } + /** * Returns the toggle button that expands and collapses stacked notifications. */ From 35ee8c7b741dbdaa8be3d49f4eb1f17ca2622909 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Fri, 8 Nov 2024 15:35:06 +0100 Subject: [PATCH 05/12] chore: Uses the new selectors inside existing tests (#2944) --- .../app-layout/refresh-content-width.page.tsx | 20 ++++----- pages/app-layout/with-drawers.page.tsx | 2 +- .../app-layout/with-one-open-drawer.page.tsx | 2 +- src/alert/__integ__/runtime-content.test.ts | 2 +- .../__integ__/annotation-scroll.test.ts | 4 +- .../__integ__/app-layout-drawers.test.ts | 4 +- .../app-layout-focus-delegation.test.ts | 45 ++++++------------- .../app-layout-refresh-content-width.test.ts | 10 ++--- .../__integ__/app-layout-split-panel.test.ts | 4 +- .../app-layout-sticky-elements.test.ts | 4 +- .../runtime-drawers-with-updates.test.ts | 6 +-- src/autosuggest/__integ__/form-submit.test.ts | 4 +- .../button-dropdown-disabled-reason.test.ts | 2 +- .../__integ__/button-dropdown-events.test.ts | 2 +- .../__integ__/button-group.test.ts | 6 +-- src/button/__tests__/internal.test.tsx | 11 +++-- .../__tests__/form-field-control-id.test.tsx | 7 ++- src/form/__tests__/analytics.test.tsx | 10 ++--- .../static-multi-page-create.test.ts | 7 +-- .../__integ__/static-single-page-flow.test.ts | 20 ++++----- src/modal/__tests__/analytics.test.tsx | 4 +- src/table/__integ__/inline-actions.test.ts | 2 +- src/table/__integ__/keyboard-scroll.test.ts | 2 +- 23 files changed, 82 insertions(+), 98 deletions(-) diff --git a/pages/app-layout/refresh-content-width.page.tsx b/pages/app-layout/refresh-content-width.page.tsx index ee3a115341..50b6bab6a4 100644 --- a/pages/app-layout/refresh-content-width.page.tsx +++ b/pages/app-layout/refresh-content-width.page.tsx @@ -32,11 +32,11 @@ export default function () { breadcrumbs={} maxContentWidth={maxContentWidth} content={ -
    +
    Demo page for layout types in visual refresh } />); act(() => void jest.runAllTimers()); const formWrapper = createWrapper(container).findForm(); - const cancelButton = formWrapper!.findActions()!.findButton('[data-testid="cancel"]'); + const cancelButton = formWrapper!.findActions()!.findButtonByTestId('cancel'); act(() => cancelButton!.click()); unmount(); @@ -160,7 +160,7 @@ describe('Form Analytics', () => { ); act(() => void jest.runAllTimers()); - const submitButton = createWrapper(container.ownerDocument.body).findButton('[data-testid="submit"]'); + const submitButton = createWrapper(container.ownerDocument.body).findButtonByTestId('submit'); act(() => submitButton!.click()); @@ -180,7 +180,7 @@ describe('Form Analytics', () => { ); act(() => void jest.runAllTimers()); const formWrapper = createWrapper(container).findForm(); - const submitButton = formWrapper!.findContent()!.findButton('[data-testid="submit"]'); + const submitButton = formWrapper!.findContent()!.findButtonByTestId('submit'); act(() => submitButton!.click()); unmount(); @@ -222,7 +222,7 @@ describe('Form Analytics', () => { ); act(() => void jest.runAllTimers()); const formWrapper = createWrapper(container).findForm(); - const submitButton = formWrapper!.findActions()!.findButton('[data-testid="submit"]'); + const submitButton = formWrapper!.findActions()!.findButtonByTestId('submit'); act(() => submitButton!.click()); unmount(); @@ -264,7 +264,7 @@ describe('Form Analytics', () => { ); act(() => void jest.runAllTimers()); const formWrapper = createWrapper(container).findForm(); - const submitButton = formWrapper!.findActions()!.findButton('[data-testid="submit"]'); + const submitButton = formWrapper!.findActions()!.findButtonByTestId('submit'); expect(getByTestId('submission-attempt').textContent).toBe('0'); diff --git a/src/internal/analytics/__integ__/static-multi-page-create.test.ts b/src/internal/analytics/__integ__/static-multi-page-create.test.ts index 91843a5f44..baeca0088a 100644 --- a/src/internal/analytics/__integ__/static-multi-page-create.test.ts +++ b/src/internal/analytics/__integ__/static-multi-page-create.test.ts @@ -318,8 +318,9 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Field error', setupTest(async page => { - await page.click('[data-testid=field1]'); - await page.setValue(wrapper.findInput('[data-testid=field1]').findNativeInput().toSelector(), 'error'); + const inputSelector = wrapper.findInputByTestId('field1').findNativeInput().toSelector(); + await page.click(inputSelector); + await page.setValue(inputSelector, 'error'); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'funnelSubStepStart', 'funnelSubStepError']); @@ -373,7 +374,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Correct substep number when the step is unmounted before blurring the substep', setupTest(async page => { - await page.click(wrapper.findInput('[data-testid=field4]').findNativeInput().toSelector()); + await page.click(wrapper.findInputByTestId('field4').findNativeInput().toSelector()); await page.click(wrapper.findWizard().findPrimaryButton().toSelector()); const funnelSubStepCompleteEvent = await page.getFunnelLogItem(6); diff --git a/src/internal/analytics/__integ__/static-single-page-flow.test.ts b/src/internal/analytics/__integ__/static-single-page-flow.test.ts index 7fc3e7f2d2..3a12831e86 100644 --- a/src/internal/analytics/__integ__/static-single-page-flow.test.ts +++ b/src/internal/analytics/__integ__/static-single-page-flow.test.ts @@ -98,7 +98,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Starts and ends substep when navigating between containers', setupTest(async page => { - await page.click('[data-testid=field1]'); + await page.click(wrapper.findInputByTestId('field1').toSelector()); await page.keys('Tab'); // From Input -> S3 Resource selector Info await page.keys('Tab'); // S3 Resource selector Info -> S3 Resource Selector Input await page.keys('Tab'); // S3 Resource selector Input -> S3 Resource selector Browse button @@ -210,7 +210,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form submission', setupTest(async page => { - await page.click('[data-testid=submit]'); + await page.click(wrapper.findButtonByTestId('submit').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual([ 'funnelStart', @@ -249,7 +249,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form cancelled', setupTest(async page => { - await page.click('[data-testid=cancel]'); + await page.click(wrapper.findButtonByTestId('cancel').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'funnelCancelled']); @@ -264,7 +264,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form abandoned', setupTest(async page => { - await page.click('[data-testid=unmount]'); + await page.click(wrapper.findButtonByTestId('unmount').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'funnelCancelled']); @@ -279,8 +279,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form inline error', setupTest(async page => { - await page.click('[data-testid=field1]'); - await page.setValue(wrapper.findInput('[data-testid=field1]').findNativeInput().toSelector(), 'error'); + await page.setValue(wrapper.findInputByTestId('field1').findNativeInput().toSelector(), 'error'); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'funnelSubStepStart', 'funnelSubStepError']); // FIXME: Missing funnelStepError? @@ -316,9 +315,8 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form error', setupTest(async page => { - await page.click('[data-testid=field1]'); - await page.setValue(wrapper.findInput('[data-testid=field1]').findNativeInput().toSelector(), 'error'); - await page.click('[data-testid=submit]'); + await page.setValue(wrapper.findInputByTestId('field1').findNativeInput().toSelector(), 'error'); + await page.click(wrapper.findButtonByTestId('submit').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual([ @@ -342,7 +340,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form external link', setupTest(async page => { - await page.click('[data-testid=external-link]'); + await page.click(wrapper.findLinkByTestId('external-link').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'externalLinkInteracted', 'funnelSubStepStart']); @@ -374,7 +372,7 @@ describe.each(['refresh', 'refresh-toolbar'] as Theme[])('%s', theme => { test( 'Form help panel link', setupTest(async page => { - await page.click('[data-testid=info-link]'); + await page.click(wrapper.findLinkByTestId('info-link').toSelector()); const { funnelLog, actions } = await page.getFunnelLog(); expect(actions).toEqual(['funnelStart', 'funnelStepStart', 'helpPanelInteracted', 'funnelSubStepStart']); diff --git a/src/modal/__tests__/analytics.test.tsx b/src/modal/__tests__/analytics.test.tsx index b38f5d5fbb..3c60bb646b 100644 --- a/src/modal/__tests__/analytics.test.tsx +++ b/src/modal/__tests__/analytics.test.tsx @@ -123,7 +123,7 @@ describe('Modal Analytics', () => { ); const wrapper = createWrapper(container); - wrapper.findModal()!.findFooter()!.findButton('[data-testid="submit"]')?.click(); + wrapper.findModal()!.findFooter()!.findButtonByTestId('submit')!.click(); act(() => void jest.runAllTimers()); expect(FunnelMetrics.funnelComplete).toHaveBeenCalledTimes(1); expect(FunnelMetrics.funnelComplete).toHaveBeenCalledWith( @@ -154,7 +154,7 @@ describe('Modal Analytics', () => { act(() => void jest.runAllTimers()); const wrapper = createWrapper(container); - wrapper.findModal()!.findFooter()!.findButton('[data-testid="submit"]')?.click(); + wrapper.findModal()!.findFooter()!.findButtonByTestId('submit')!.click(); rerender( { - const tableWrapper = createWrapper().findTable('[data-testid="items-table"]'); + const tableWrapper = createWrapper().findTableByTestId('items-table'); const wrapperSelector = tableWrapper.findAllByClassName(styles.wrapper).toSelector(); await browser.url('#/light/table/keyboard-scroll'); const page = new BasePageObject(browser); From bcd89ac9fc77e93227e1d054f5cb603663a8f5bf Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Tue, 12 Nov 2024 13:47:06 +0100 Subject: [PATCH 06/12] feat: Adds test id to breadcrumb items (#2956) --- .../__tests__/breadcrumb-group.test.tsx | 63 +++++++++++++++++++ src/breadcrumb-group/interfaces.ts | 6 ++ src/breadcrumb-group/item/item.tsx | 5 +- src/test-utils/dom/breadcrumb-group/index.ts | 14 +++++ 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/breadcrumb-group/__tests__/breadcrumb-group.test.tsx b/src/breadcrumb-group/__tests__/breadcrumb-group.test.tsx index 2a62737752..5a45c326ba 100644 --- a/src/breadcrumb-group/__tests__/breadcrumb-group.test.tsx +++ b/src/breadcrumb-group/__tests__/breadcrumb-group.test.tsx @@ -39,14 +39,17 @@ describe('BreadcrumbGroup Component', () => { { text: 'Item 1', href: '/#1', + testId: 'breadcrumb-item-1', }, { text: 'Item 2', href: '/#3', + testId: 'breadcrumb-item-2', }, { text: 'Item 3', href: '/#3', + testId: 'breadcrumb-item-3', }, ]; wrapper = renderBreadcrumbGroup({ items }); @@ -109,6 +112,48 @@ describe('BreadcrumbGroup Component', () => { expect(breadcrumbs.findBreadcrumbLink(2)?.getElement()).toHaveTextContent(items[1].text); }); + test('test-utils findBreadcrumbLinkByTestId finds the item with test id', () => { + const { container } = render(); + const breadcrumbItem = createWrapper(container) + .findBreadcrumbGroup()! + .findBreadcrumbLinkByTestId('breadcrumb-item-2')! + .getElement()!; + + expect(breadcrumbItem).toHaveTextContent('Item 2'); + }); + + test('test-utils findBreadcrumbLinkByTestId finds the item with test id, even if test id contains quotes', () => { + const { container } = render( + + ); + const breadcrumbItem = createWrapper(container) + .findBreadcrumbGroup()! + .findBreadcrumbLinkByTestId('"breadcrumb-item-test-id"')! + .getElement()!; + + expect(breadcrumbItem).toHaveTextContent('Breadcrumb item'); + }); + + test('assigns data-test id to the breadcrumb items', () => { + const { container } = render(); + const [firstItem, secondItem] = createWrapper(container) + .findAll(`.${itemStyles.breadcrumb}`) + .map(item => item.getElement()); + + expect(firstItem).toHaveAttribute('data-testid', 'breadcrumb-item-1'); + expect(firstItem).toHaveTextContent('Item 1'); + expect(secondItem).toHaveAttribute('data-testid', 'breadcrumb-item-2'); + expect(secondItem).toHaveTextContent('Item 2'); + }); + // Test for AWSUI-6738 test('all the icons stay visible when changing the items', () => { const { container, rerender } = render(); @@ -230,5 +275,23 @@ describe('BreadcrumbGroup Component', () => { expect(anchor).toHaveAttribute('tabindex', '-1'); }); }); + + test('breadcrumb items do not receive data-testid', () => { + const breadCrumbGroup = renderBreadcrumbGroup({ + items: [ + { + text: 'Item 1', + href: '/#1', + testId: 'breadcrumb-item-test-id', + }, + ], + }); + + const actualBreadcrumb = breadCrumbGroup.find(`.${itemStyles.breadcrumb}`)!.getElement(); + const ghostBreadcrumb = breadCrumbGroup.find(`.${itemStyles['ghost-breadcrumb']}`)!.getElement(); + + expect(actualBreadcrumb).toHaveAttribute('data-testid', 'breadcrumb-item-test-id'); + expect(ghostBreadcrumb).not.toHaveAttribute('data-testid', 'breadcrumb-item-test-id'); + }); }); }); diff --git a/src/breadcrumb-group/interfaces.ts b/src/breadcrumb-group/interfaces.ts index 9f7af69b9a..acad922c62 100644 --- a/src/breadcrumb-group/interfaces.ts +++ b/src/breadcrumb-group/interfaces.ts @@ -45,6 +45,12 @@ export namespace BreadcrumbGroupProps { export interface Item { text: string; href: string; + + /** + * Test ID of the breadcrumb item. + * Assigns this value to the `data-testid` attribute of the breadcrumb item. + */ + testId?: string; } export interface ClickDetail diff --git a/src/breadcrumb-group/item/item.tsx b/src/breadcrumb-group/item/item.tsx index b76b644f6e..2f1d1bc41b 100644 --- a/src/breadcrumb-group/item/item.tsx +++ b/src/breadcrumb-group/item/item.tsx @@ -98,7 +98,10 @@ export function BreadcrumbItem({ } return ( -
    +
    {isTruncated && !isGhost ? ( ) : ( diff --git a/src/test-utils/dom/breadcrumb-group/index.ts b/src/test-utils/dom/breadcrumb-group/index.ts index fe10fbd5c3..b533ec7e23 100644 --- a/src/test-utils/dom/breadcrumb-group/index.ts +++ b/src/test-utils/dom/breadcrumb-group/index.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom'; +import { escapeSelector } from '@cloudscape-design/test-utils-core/utils'; import ButtonDropdownWrapper from '../button-dropdown'; @@ -36,6 +37,19 @@ export default class BreadcrumbGroupWrapper extends ComponentWrapper { return this.find(`.${styles.item}:nth-child(${index}) .${itemStyles.anchor}`); } + /** + * Returns the wrapper of the first breadcrumb link that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `items` prop. + * If no matching breadcrumb link is found, returns `null`. + * + * @param {string} testId + * @returns {ElementWrapper | null} + */ + findBreadcrumbLinkByTestId(testId: string): ElementWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.find(`.${itemStyles.breadcrumb}[data-testid="${escapedTestId}"] .${itemStyles.anchor}`); + } + findDropdown(): ButtonDropdownWrapper | null { const buttonDropdown = this.find(`.${buttonDropdownStyles['button-dropdown']}`); return buttonDropdown && new ButtonDropdownWrapper(buttonDropdown.getElement()); From 60df1299c52dd11341341f07635986c9793df59c Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Tue, 12 Nov 2024 16:10:04 +0100 Subject: [PATCH 07/12] feat: Adds test id to the grid columns (#2960) --- src/grid/__tests__/grid.test.tsx | 57 ++++++++++++++++++++++++++++++++ src/grid/interfaces.tsx | 6 ++++ src/grid/internal.tsx | 1 + src/test-utils/dom/grid/index.ts | 14 ++++++++ 4 files changed, 78 insertions(+) diff --git a/src/grid/__tests__/grid.test.tsx b/src/grid/__tests__/grid.test.tsx index d47dadbcb0..5dc7c9c79d 100644 --- a/src/grid/__tests__/grid.test.tsx +++ b/src/grid/__tests__/grid.test.tsx @@ -50,4 +50,61 @@ describe('Grid component', () => { }); expect(wrapper.getElement().childElementCount).toBe(2); }); + + test('assigns data-testid to the columns', () => { + const wrapper = renderGrid({ + gridDefinition: [{ testId: 'column-1' }, { testId: 'column-2' }], + children: ( + <> +
    Column 1
    +
    Column 2
    + + ), + }); + const [firstColumn, secondColumn] = wrapper + .findAll(`.${styles['grid-column']}`) + .map(columnWrapper => columnWrapper.getElement()!); + + expect(firstColumn).toHaveAttribute('data-testid', 'column-1'); + expect(secondColumn).toHaveAttribute('data-testid', 'column-2'); + }); + + test('findColumn returns the correct column', () => { + const wrapper = renderGrid({ + children: ( + <> +
    Column 1
    +
    Column 2
    + + ), + }); + + const column = wrapper.findColumn(2)!.getElement(); + expect(column).toHaveTextContent('Column 2'); + }); + + test('findColumnByTestId returns the column with test id', () => { + const wrapper = renderGrid({ + gridDefinition: [{ testId: 'column-1' }, { testId: 'column-2' }], + children: ( + <> +
    Column 1
    +
    Column 2
    + + ), + }); + + const column = wrapper.findColumnByTestId('column-2')!.getElement(); + expect(column).toHaveTextContent('Column 2'); + }); + + test('findColumnByTestId returns the column with test id, even if test id contains a quote character', () => { + const wrapper = renderGrid({ + gridDefinition: [{ testId: '"column-test-id"' }], + children:
    Test column
    , + }); + + const column = wrapper.findColumnByTestId('"column-test-id"')!.getElement(); + expect(column).toHaveTextContent('Test column'); + }); }); diff --git a/src/grid/interfaces.tsx b/src/grid/interfaces.tsx index 8b9a722ea9..6d3e30f69c 100644 --- a/src/grid/interfaces.tsx +++ b/src/grid/interfaces.tsx @@ -65,5 +65,11 @@ export namespace GridProps { * The number of grid elements to push the column to the right by. */ push?: number | GridProps.BreakpointMapping; + + /** + * Test ID of the grid column. + * Assigns this value to the `data-testid` attribute of the column's root element. + */ + testId?: string; } } diff --git a/src/grid/internal.tsx b/src/grid/internal.tsx index a43cd42a10..bee337a7b5 100644 --- a/src/grid/internal.tsx +++ b/src/grid/internal.tsx @@ -89,6 +89,7 @@ const InternalGrid = React.forwardRef( return (
    { findColumn(columnIndex: number): ElementWrapper | null { return this.find(`.${styles['grid-column']}:nth-child(${columnIndex}) > div`); } + + /** + * Returns the wrapper of the first column that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `gridDefinition` prop. + * If no matching column is found, returns `null`. + * + * @param {string} testId + * @returns {HTMLDivElement | null} + */ + findColumnByTestId(testId: string): ElementWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.find(`.${styles['grid-column']}[data-testid="${escapedTestId}"] > div`); + } } From 9e0ec27071c909688966649cea50a1a1b85c931f Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Thu, 14 Nov 2024 09:03:50 +0100 Subject: [PATCH 08/12] feat: Adds test id to radio group buttons (#2978) --- .../__tests__/radio-group.test.tsx | 88 +++++++++++++++---- src/radio-group/interfaces.ts | 6 ++ src/radio-group/internal.tsx | 1 + src/radio-group/radio-button.tsx | 2 + src/test-utils/dom/radio-group/index.ts | 13 +++ 5 files changed, 92 insertions(+), 18 deletions(-) diff --git a/src/radio-group/__tests__/radio-group.test.tsx b/src/radio-group/__tests__/radio-group.test.tsx index 33d6b70aa4..140246fd9c 100644 --- a/src/radio-group/__tests__/radio-group.test.tsx +++ b/src/radio-group/__tests__/radio-group.test.tsx @@ -104,10 +104,14 @@ describe('items', () => { test('does not trigger change handler if disabled', () => { const onChange = jest.fn(); const { wrapper } = renderRadioGroup( - + ); - act(() => wrapper.findButtons()[1].findLabel().click()); + act(() => wrapper.findButtonByTestId('disabled-button')!.findLabel().click()); expect(onChange).not.toHaveBeenCalled(); }); @@ -159,29 +163,53 @@ describe('items', () => { }); test('displays the proper label', () => { - const { wrapper } = renderRadioGroup(); + const { wrapper } = renderRadioGroup( + + ); - expect(wrapper.findButtons()[0].findLabel().getElement()).toHaveTextContent('Please select'); + expect(wrapper.findButtonByTestId('test-button')!.findLabel().getElement()).toHaveTextContent('Please select'); }); test('displays no label text when label is empty', () => { - const { wrapper } = renderRadioGroup(); - expect(wrapper.findButtons()[0].findLabel().getElement()).toHaveTextContent(''); + const { wrapper } = renderRadioGroup( + + ); + expect(wrapper.findButtonByTestId('test-button')!.findLabel().getElement()).toHaveTextContent(''); }); test('displays the description', () => { const { wrapper } = renderRadioGroup( ); - expect(wrapper.findButtons()[0].findDescription()!.getElement()).toHaveTextContent('Radio description test'); + expect(wrapper.findButtonByTestId('test-button')!.findDescription()!.getElement()).toHaveTextContent( + 'Radio description test' + ); }); test('does not display description when it is not defined', () => { - const { wrapper } = renderRadioGroup(); - expect(wrapper.findButtons()[0].findDescription()).toBeNull(); + const { wrapper } = renderRadioGroup( + + ); + expect(wrapper.findButtonByTestId('test-button')!.findDescription()).toBeNull(); + }); + + test('adds test id to items when specified', () => { + const { wrapper } = renderRadioGroup( + + ); + + const buttonTestIds = wrapper.findButtons().map(button => button.getElement()!.getAttribute('data-testid')); + expect(buttonTestIds).toEqual(['item-1', 'item-2', 'item-3']); }); }); @@ -289,14 +317,14 @@ describe('value', () => { ); - check(wrapper.findButtons()[0], 'control-id-1'); - check(wrapper.findButtons()[1], 'control-id-2'); + check(wrapper.findButtonByTestId('radio-button-1')!, 'control-id-1'); + check(wrapper.findButtonByTestId('radio-button-2')!, 'control-id-2'); }); test('generates a own unique ids for setting up label relations when controlId is not set', () => { @@ -320,16 +348,16 @@ describe('value', () => { ); - const button2 = wrapper.findButtons()[1]; + const button2 = wrapper.findButtonByTestId('option-2')!; const id2 = button2.findNativeInput().getElement().id; - check(wrapper.findButtons()[0], id1); + check(wrapper.findButtonByTestId('option-1')!, id1); check(button2, id2); expect(id1).not.toBe(id2); }); @@ -382,3 +410,27 @@ describe('table grid navigation support', () => { expect(getRadioInput('#radio2')).toHaveAttribute('tabIndex', '-1'); }); }); + +describe('test utils', () => { + test('findButtonByTestId selects the button with the specified test id', () => { + const { wrapper } = renderRadioGroup( + + ); + + expect(wrapper.findButtonByTestId('button-2')!.getElement()).toHaveTextContent('two'); + }); + + test('findButtonByTestId selects the button even if test id contains quote character', () => { + const { wrapper } = renderRadioGroup( + + ); + + expect(wrapper.findButtonByTestId('test-"button"')!.getElement()).toHaveTextContent('Test button'); + }); +}); diff --git a/src/radio-group/interfaces.ts b/src/radio-group/interfaces.ts index 2858058de0..838ac3c6f0 100644 --- a/src/radio-group/interfaces.ts +++ b/src/radio-group/interfaces.ts @@ -72,6 +72,12 @@ export namespace RadioGroupProps { description?: React.ReactNode; disabled?: boolean; controlId?: string; + + /** + * Test ID of the radio button. + * Assigns this value to the `data-testid` attribute of the radio button's root element. + */ + testId?: string; } export interface ChangeDetail { diff --git a/src/radio-group/internal.tsx b/src/radio-group/internal.tsx index 1d00d5b32d..2d8ca818d8 100644 --- a/src/radio-group/internal.tsx +++ b/src/radio-group/internal.tsx @@ -67,6 +67,7 @@ const InternalRadioGroup = React.forwardRef( onChange={onChange} controlId={item.controlId} readOnly={readOnly} + testId={item.testId} {...getAnalyticsMetadataAttribute( !item.disabled && !readOnly ? { diff --git a/src/radio-group/radio-button.tsx b/src/radio-group/radio-button.tsx index 7a7a55d1f7..e6de4b7912 100644 --- a/src/radio-group/radio-button.tsx +++ b/src/radio-group/radio-button.tsx @@ -34,6 +34,7 @@ export default React.forwardRef(function RadioButton( onChange, readOnly, className, + testId, ...rest }: RadioButtonProps, ref: React.Ref @@ -54,6 +55,7 @@ export default React.forwardRef(function RadioButton( disabled={disabled} readOnly={readOnly} controlId={controlId} + data-testid={testId} {...copyAnalyticsMetadataAttribute(rest)} nativeControl={nativeControlProps => ( new RadioButtonWrapper(r.getElement())); } + /** + * Returns the wrapper of the first radio button that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `items` prop. + * If no matching radio button is found, returns `null`. + * + * @param {string} testId + * @returns {RadioButtonWrapper | null} + */ + findButtonByTestId(testId: string): RadioButtonWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent(`.${styles.radio}[data-testid="${escapedTestId}"]`, RadioButtonWrapper); + } + findInputByValue(value: string): ElementWrapper | null { const safeValue = escapeSelector(value); return this.find(`input[value="${safeValue}"]`); From 579974a3e647f02a321290c7ce8a92ebba8237d2 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Thu, 14 Nov 2024 12:38:51 +0100 Subject: [PATCH 09/12] feat: Adds extra selectors to the test utils (#2932) --- build-tools/tasks/test-utils.js | 142 +- build-tools/utils/pluralize.js | 90 + package-lock.json | 3 +- .../functional-tests/test-utils.test.tsx | 221 +- .../test-utils-wrappers.test.tsx.snap | 8038 ++++++++++++++--- 5 files changed, 7167 insertions(+), 1327 deletions(-) create mode 100644 build-tools/utils/pluralize.js diff --git a/build-tools/tasks/test-utils.js b/build-tools/tasks/test-utils.js index bc08604888..284f3f8e2d 100644 --- a/build-tools/tasks/test-utils.js +++ b/build-tools/tasks/test-utils.js @@ -7,6 +7,7 @@ const { pascalCase } = require('change-case'); const { default: convertToSelectorUtil } = require('@cloudscape-design/test-utils-converter'); const { through, task } = require('../utils/gulp-utils'); const { writeFile, listPublicItems } = require('../utils/files'); +const { pluralizeComponentName } = require('../utils/pluralize'); const themes = require('../utils/themes'); function toWrapper(componentClass) { @@ -15,24 +16,132 @@ function toWrapper(componentClass) { const testUtilsSrcDir = path.resolve('src/test-utils'); const configs = { + common: { + // These components are not meant to be present in multiple instances in a single app. + // For this reason no findAll and findByTestId finders will be generated for them. + noExtraFinders: ['AppLayout', 'TopNavigation'], + buildFinder: ({ componentName }) => ` + ElementWrapper.prototype.find${componentName} = function(selector) { + const rootSelector = \`.$\{${toWrapper(componentName)}.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ${toWrapper(componentName)}); + };`, + buildExtraFinders: ({ componentName, componentNamePlural }) => ` + ElementWrapper.prototype.findAll${componentNamePlural} = function(selector) { + return this.findAllComponents(${toWrapper(componentName)}, selector); + }; + + ElementWrapper.prototype.find${componentName}ByTestId = function(testId) { + const selector = \`.\${${toWrapper(componentName)}.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ${toWrapper(componentName)}); + };`, + }, dom: { defaultExport: `export default function wrapper(root: Element = document.body) { if (document && document.body && !document.body.contains(root)) { console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly')}; return new ElementWrapper(root); }`, - buildFinderInterface: ({ componentName }) => - `find${componentName}(selector?: string): ${toWrapper(componentName)} | null;`, + buildFinderInterface: ({ componentName }) => ` + /** + * Returns the wrapper of the first ${componentName} that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ${componentName}. + * If no matching ${componentName} is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {${toWrapper(componentName)} | null} + */ + find${componentName}(selector?: string): ${toWrapper(componentName)} | null;`, + buildExtraFinderInterfaces: ({ componentName, componentNamePlural }) => ` + /** + * Returns an array of ${componentName} wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ${componentNamePlural} inside the current wrapper. + * If no matching ${componentName} is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array<${toWrapper(componentName)}>} + */ + findAll${componentNamePlural}(selector?: string): Array<${toWrapper(componentName)}>; + /** + * Returns the first ${componentName} that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ${componentName} is found, returns \`null\`. + * + * @param {string} testId + * @returns {${toWrapper(componentName)} | null} + */ + find${componentName}ByTestId(testId: string): ${toWrapper(componentName)} | null;`, }, selectors: { defaultExport: `export default function wrapper(root: string = 'body') { return new ElementWrapper(root); }`, - buildFinderInterface: ({ componentName }) => - `find${componentName}(selector?: string): ${toWrapper(componentName)};`, + buildFinderInterface: ({ componentName, componentNamePlural }) => ` + /** + * Returns a wrapper that matches the ${componentNamePlural} with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ${componentNamePlural}. + * + * @param {string} [selector] CSS Selector + * @returns {${toWrapper(componentName)}} + */ + find${componentName}(selector?: string): ${toWrapper(componentName)};`, + buildExtraFinderInterfaces: ({ componentName, componentNamePlural }) => ` + /** + * Returns a multi-element wrapper that matches ${componentNamePlural} with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ${componentNamePlural}. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper<${toWrapper(componentName)}>} + */ + findAll${componentNamePlural}(selector?: string): MultiElementWrapper<${toWrapper(componentName)}>; + /** + * Returns a wrapper that matches the first ${componentName} with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {${toWrapper(componentName)}} + */ + find${componentName}ByTestId(testId: string): ${toWrapper(componentName)};`, }, }; +function generateFindersInterfaces({ testUtilMetaData, testUtilType, configs }) { + const { buildFinderInterface, buildExtraFinderInterfaces } = configs[testUtilType]; + const { noExtraFinders } = configs.common; + + const findersInterfaces = testUtilMetaData.map(metadata => { + if (noExtraFinders.includes(metadata.componentName)) { + return buildFinderInterface(metadata); + } + + return [buildFinderInterface(metadata), buildExtraFinderInterfaces(metadata)].join('\n'); + }); + + // we need to redeclare the interface in its original definition, extending a re-export will not work + // https://github.com/microsoft/TypeScript/issues/12607 + const interfaces = `declare module '@cloudscape-design/test-utils-core/dist/${testUtilType}' { + interface ElementWrapper { + ${findersInterfaces.join('\n')} + } + }`; + + return interfaces; +} + +function generateFindersImplementations({ testUtilMetaData, configs }) { + const { noExtraFinders, buildFinder, buildExtraFinders } = configs.common; + + const findersImplementations = testUtilMetaData.map(metadata => { + if (noExtraFinders.includes(metadata.componentName)) { + return buildFinder(metadata); + } + + return [buildFinder(metadata), buildExtraFinders(metadata)].join('\n'); + }); + + return findersImplementations.join('\n'); +} + function generateIndexFileContent(testUtilType, testUtilMetaData) { const config = configs[testUtilType]; if (config === undefined) { throw new Error('Unknown test util type'); } - const { defaultExport, buildFinderInterface } = config; return [ // language=TypeScript @@ -47,24 +156,9 @@ function generateIndexFileContent(testUtilType, testUtilMetaData) { export { ${componentName}Wrapper }; `; }), - // we need to redeclare the interface in its original definition, extending a re-export will not work - // https://github.com/microsoft/TypeScript/issues/12607 - `declare module '@cloudscape-design/test-utils-core/dist/${testUtilType}' { - interface ElementWrapper { - ${testUtilMetaData.map(metaData => buildFinderInterface(metaData)).join('\n')} - } - }`, - ...testUtilMetaData.map(({ componentName }) => { - const wrapperName = toWrapper(componentName); - // language=TypeScript - return `ElementWrapper.prototype.find${componentName} = function(selector) { - const rootSelector = \`.$\{${wrapperName}.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ${wrapperName}); - };`; - }), - defaultExport, + generateFindersInterfaces({ testUtilMetaData, testUtilType, configs }), + generateFindersImplementations({ testUtilMetaData, configs }), + config.defaultExport, ].join('\n'); } @@ -77,9 +171,11 @@ function generateTestUtilMetaData(testUtilType) { const componentNameKebab = componentFolderName; const componentName = pascalCase(componentNameKebab); + const componentNamePlural = pluralizeComponentName(componentName); const componentMetaData = { componentName, + componentNamePlural, relPathtestUtilFile, }; diff --git a/build-tools/utils/pluralize.js b/build-tools/utils/pluralize.js new file mode 100644 index 0000000000..affc84b951 --- /dev/null +++ b/build-tools/utils/pluralize.js @@ -0,0 +1,90 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +const pluralizationMap = { + Alert: 'Alerts', + AnchorNavigation: 'AnchorNavigations', + Annotation: 'Annotations', + AppLayout: 'AppLayouts', + AreaChart: 'AreaCharts', + AttributeEditor: 'AttributeEditors', + Autosuggest: 'Autosuggests', + Badge: 'Badges', + BarChart: 'BarCharts', + Box: 'Boxes', + BreadcrumbGroup: 'BreadcrumbGroups', + Button: 'Buttons', + ButtonDropdown: 'ButtonDropdowns', + ButtonGroup: 'ButtonGroups', + Calendar: 'Calendars', + Cards: 'Cards', + Checkbox: 'Checkboxes', + CodeEditor: 'CodeEditors', + CollectionPreferences: 'CollectionPreferences', + ColumnLayout: 'ColumnLayouts', + Container: 'Containers', + ContentLayout: 'ContentLayouts', + CopyToClipboard: 'CopyToClipboards', + DateInput: 'DateInputs', + DatePicker: 'DatePickers', + DateRangePicker: 'DateRangePickers', + Drawer: 'Drawers', + ExpandableSection: 'ExpandableSections', + FileUpload: 'FileUploads', + Flashbar: 'Flashbars', + Form: 'Forms', + FormField: 'FormFields', + Grid: 'Grids', + Header: 'Headers', + HelpPanel: 'HelpPanels', + Hotspot: 'Hotspots', + Icon: 'Icons', + Input: 'Inputs', + KeyValuePairs: 'KeyValuePairs', + LineChart: 'LineCharts', + Link: 'Links', + LiveRegion: 'LiveRegions', + MixedLineBarChart: 'MixedLineBarCharts', + Modal: 'Modals', + Multiselect: 'Multiselects', + Pagination: 'Paginations', + PieChart: 'PieCharts', + Popover: 'Popovers', + ProgressBar: 'ProgressBars', + PromptInput: 'PromptInputs', + PropertyFilter: 'PropertyFilters', + RadioGroup: 'RadioGroups', + S3ResourceSelector: 'S3ResourceSelectors', + SegmentedControl: 'SegmentedControls', + Select: 'Selects', + SideNavigation: 'SideNavigations', + Slider: 'Sliders', + SpaceBetween: 'SpaceBetweens', + Spinner: 'Spinners', + SplitPanel: 'SplitPanels', + StatusIndicator: 'StatusIndicators', + Steps: 'Steps', + Table: 'Tables', + Tabs: 'Tabs', + TagEditor: 'TagEditors', + TextContent: 'TextContents', + TextFilter: 'TextFilters', + Textarea: 'Textareas', + Tiles: 'Tiles', + TimeInput: 'TimeInputs', + Toggle: 'Toggles', + ToggleButton: 'ToggleButtons', + TokenGroup: 'TokenGroups', + TopNavigation: 'TopNavigations', + TutorialPanel: 'TutorialPanels', + Wizard: 'Wizards', +}; + +function pluralizeComponentName(componentName) { + if (!(componentName in pluralizationMap)) { + throw new Error(`Could not find the plural case for ${componentName}.`); + } + + return pluralizationMap[componentName]; +} + +module.exports = { pluralizeComponentName }; diff --git a/package-lock.json b/package-lock.json index 7e513fb680..e66b3937c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14706,8 +14706,9 @@ }, "node_modules/pluralize": { "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } diff --git a/src/__tests__/functional-tests/test-utils.test.tsx b/src/__tests__/functional-tests/test-utils.test.tsx index 905a9f885d..3ce5ded87b 100644 --- a/src/__tests__/functional-tests/test-utils.test.tsx +++ b/src/__tests__/functional-tests/test-utils.test.tsx @@ -7,9 +7,76 @@ import React from 'react'; import { render } from 'react-dom'; import { render as renderTestingLibrary } from '@testing-library/react'; +import { pascalCase } from 'change-case'; +import { Modal } from '../../../lib/components'; import Button from '../../../lib/components/button'; -import createWrapper from '../../../lib/components/test-utils/dom'; +import createWrapperDom, { ElementWrapper as DomElementWrapper } from '../../../lib/components/test-utils/dom'; +import createWrapperSelectors from '../../../lib/components/test-utils/selectors'; +import { getRequiredPropsForComponent } from '../required-props-for-components'; +import { getAllComponents, requireComponent } from '../utils'; + +const componentsWithNoExtraFinders = ['top-navigation', 'app-layout']; +const componentsWithExceptions = ['annotation-context', ...componentsWithNoExtraFinders]; +const components = getAllComponents().filter(component => !componentsWithExceptions.includes(component)); + +const RENDER_COMPONENTS_DEFAULT_PROPS: Record[] = [ + { + 'data-testid': 'first-item', + 'data-name': 'first item', + }, + { + 'data-testid': 'second-item', + 'data-name': 'second item', + }, +]; + +function renderModal(props = RENDER_COMPONENTS_DEFAULT_PROPS) { + const root = document.createElement('div'); + document.body.appendChild(root); + + return renderTestingLibrary( +
    + {props.map(({ ...customProps }, index) => ( + + ))} +
    , + { container: root } + ); +} + +function renderComponents(componentName: string, props = RENDER_COMPONENTS_DEFAULT_PROPS) { + if (componentName === 'modal') { + return renderModal(props); + } + + const { default: Component } = requireComponent(componentName); + const defaultProps = getRequiredPropsForComponent(componentName); + return renderTestingLibrary( +
    + {props.map(({ ...customProps }, index) => ( + + ))} +
    + ); +} + +function getComponentSelectors(componentName: string) { + const componentNamePascalCase = pascalCase(componentName); + const findAllRegex = new RegExp(`findAll${componentNamePascalCase}.*`); + + // The same set of selector functions are present in both dom and selectors. + // For this reason, looking into DOM is representative of both groups. + const wrapperPropsList = Object.keys(DomElementWrapper.prototype); + + // Every component has the same set of selector functions. + // For this reason, casting the function names into the Alert component. + const findName = `find${componentNamePascalCase}` as 'findAlert'; + const findAllName = wrapperPropsList.find(selector => findAllRegex.test(selector)) as 'findAllAlerts'; + const findByTestIdName = `find${componentNamePascalCase}ByTestId` as 'findAlertByTestId'; + + return { findName, findAllName, findByTestIdName }; +} describe('createWrapper', () => { let spy: jest.SpyInstance; @@ -27,23 +94,169 @@ describe('createWrapper', () => { document.body.appendChild(container); render(React.createElement(Button), container); - createWrapper(container); + createWrapperDom(container); expect(spy).not.toBeCalled(); }); + test('given detached node when creating a wrapper then a warning is printed', () => { const container = document.createElement('div'); render(React.createElement(Button), container); - createWrapper(container); + createWrapperDom(container); expect(spy).toBeCalledTimes(1); }); + test('given node rendered with "@testing-library/react" when creating a wrapper then no warning is printed', () => { const { container } = renderTestingLibrary(React.createElement(Button)); - createWrapper(container); + createWrapperDom(container); expect(spy).not.toBeCalled(); }); }); + +describe.each(components)('ElementWrapper selectors for %s component', componentName => { + const { findName, findAllName, findByTestIdName } = getComponentSelectors(componentName); + + describe('dom wrapper', () => { + test(`${findName} returns the first ${componentName}`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperDom(container); + const element = wrapper[findName]()!.getElement(); + + expect(element).toHaveAttribute('data-name', 'first item'); + }); + + test(`${findAllName} returns all of the ${componentName} components`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperDom(container); + const elementNameAttributes = wrapper[findAllName]().map(component => + component!.getElement().getAttribute('data-name') + ); + + expect(elementNameAttributes).toEqual(['first item', 'second item']); + }); + + test(`${findAllName} returns only the matching ${componentName} components, when a selector is specified`, () => { + const { container } = renderComponents(componentName, [ + { className: 'first-type', 'data-name': 'first item' }, + { className: 'second-type', 'data-name': 'second item' }, + { className: 'second-type', 'data-name': 'third item' }, + ]); + const wrapper = createWrapperDom(container); + const elementNameAttributes = wrapper[findAllName]('.second-type').map(component => + component!.getElement().getAttribute('data-name') + ); + + expect(elementNameAttributes).toEqual(['second item', 'third item']); + }); + + test(`${findByTestIdName} returns the ${componentName} with matching test id`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperDom(container); + const element = wrapper[findByTestIdName]('second-item')!.getElement(); + + expect(element).toHaveAttribute('data-name', 'second item'); + }); + + test(`${findByTestIdName} returns the correct ${componentName}, even when test id contains double quotes`, () => { + const { container } = renderComponents(componentName, [{ 'data-testid': '"test-id-with-quotes"' }]); + const wrapper = createWrapperDom(container); + + expect(wrapper[findByTestIdName]('"test-id-with-quotes"')).toBeTruthy(); + }); + }); + + describe('selectors wrapper', () => { + test(`${findName} returns a selector that matches the ${componentName}`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperSelectors(); + const selector = wrapper[findName]().toSelector(); + const element = container.querySelector(selector); + + expect(element).toHaveAttribute('data-name', 'first item'); + }); + + test(`${findAllName} returns a selector that matches the ${componentName} with nth-child index`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperSelectors(); + const selector = wrapper[findAllName]().get(2).toSelector(); + const element = container.querySelector(selector); + + expect(element).toHaveAttribute('data-name', 'second item'); + }); + + test(`${findAllName} appends the specified selector to the default ${componentName} selectors`, () => { + const { container } = renderComponents(componentName, [ + { className: 'first-type', 'data-name': 'first item' }, + { className: 'second-type', 'data-name': 'second item' }, + ]); + const wrapper = createWrapperSelectors(); + const firstElement = container.querySelector(wrapper[findAllName]('.second-type').get(1).toSelector()); + const secondElement = container.querySelector(wrapper[findAllName]('.second-type').get(2).toSelector()); + + expect(firstElement).toBeFalsy(); + expect(secondElement).toBeTruthy(); + }); + + test(`${findByTestIdName} returns selector matching the ${componentName} with test id`, () => { + const { container } = renderComponents(componentName); + const wrapper = createWrapperSelectors(); + const selector = wrapper[findByTestIdName]('second-item').toSelector(); + const element = container.querySelector(selector); + + expect(element).toHaveAttribute('data-name', 'second item'); + }); + + test(`${findByTestIdName} returns selector matching the ${componentName}, even when test id contains double quotes`, () => { + const { container } = renderComponents(componentName, [{ 'data-testid': '"test-id-with-quotes"' }]); + const wrapper = createWrapperSelectors(); + const selector = wrapper[findByTestIdName]('"test-id-with-quotes"').toSelector(); + const element = container.querySelector(selector); + + expect(element).toBeTruthy(); + }); + }); +}); + +describe.each(componentsWithNoExtraFinders)('ElementWrapper selectors for %s component', componentName => { + const { findName, findAllName, findByTestIdName } = getComponentSelectors(componentName); + const renderOnlyOneInstance = () => renderComponents(componentName, [{}]); + + describe('dom wrapper', () => { + test(`${findName} returns the first ${componentName}`, () => { + const { container } = renderOnlyOneInstance(); + const wrapper = createWrapperDom(container); + const element = wrapper[findName]()!.getElement(); + + expect(element).toBeTruthy(); + }); + + test('it does not have findAll or findByTestId finders', () => { + const wrapper = createWrapperDom(); + + expect(findAllName).toBeUndefined(); + expect(wrapper[findByTestIdName]).toBeFalsy(); + }); + }); + + describe('selectors wrapper', () => { + test(`${findName} returns a selector that matches the ${componentName}`, () => { + const { container } = renderOnlyOneInstance(); + const wrapper = createWrapperSelectors(); + const selector = wrapper[findName]().toSelector(); + const element = container.querySelector(selector); + + expect(element).toBeTruthy(); + }); + + test('it does not have findAll or findByTestId finders', () => { + const wrapper = createWrapperDom(); + + expect(findAllName).toBeUndefined(); + expect(wrapper[findByTestIdName]).toBeFalsy(); + }); + }); +}); diff --git a/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap b/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap index f41edd874d..63712e191e 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/test-utils-wrappers.test.tsx.snap @@ -310,1386 +310,6826 @@ export { ElementWrapper }; declare module '@cloudscape-design/test-utils-core/dist/dom' { interface ElementWrapper { - findAlert(selector?: string): AlertWrapper | null; -findAnchorNavigation(selector?: string): AnchorNavigationWrapper | null; -findAnnotation(selector?: string): AnnotationWrapper | null; -findAppLayout(selector?: string): AppLayoutWrapper | null; -findAreaChart(selector?: string): AreaChartWrapper | null; -findAttributeEditor(selector?: string): AttributeEditorWrapper | null; -findAutosuggest(selector?: string): AutosuggestWrapper | null; -findBadge(selector?: string): BadgeWrapper | null; -findBarChart(selector?: string): BarChartWrapper | null; -findBox(selector?: string): BoxWrapper | null; -findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper | null; -findButton(selector?: string): ButtonWrapper | null; -findButtonDropdown(selector?: string): ButtonDropdownWrapper | null; -findButtonGroup(selector?: string): ButtonGroupWrapper | null; -findCalendar(selector?: string): CalendarWrapper | null; -findCards(selector?: string): CardsWrapper | null; -findCheckbox(selector?: string): CheckboxWrapper | null; -findCodeEditor(selector?: string): CodeEditorWrapper | null; -findCollectionPreferences(selector?: string): CollectionPreferencesWrapper | null; -findColumnLayout(selector?: string): ColumnLayoutWrapper | null; -findContainer(selector?: string): ContainerWrapper | null; -findContentLayout(selector?: string): ContentLayoutWrapper | null; -findCopyToClipboard(selector?: string): CopyToClipboardWrapper | null; -findDateInput(selector?: string): DateInputWrapper | null; -findDatePicker(selector?: string): DatePickerWrapper | null; -findDateRangePicker(selector?: string): DateRangePickerWrapper | null; -findDrawer(selector?: string): DrawerWrapper | null; -findExpandableSection(selector?: string): ExpandableSectionWrapper | null; -findFileUpload(selector?: string): FileUploadWrapper | null; -findFlashbar(selector?: string): FlashbarWrapper | null; -findForm(selector?: string): FormWrapper | null; -findFormField(selector?: string): FormFieldWrapper | null; -findGrid(selector?: string): GridWrapper | null; -findHeader(selector?: string): HeaderWrapper | null; -findHelpPanel(selector?: string): HelpPanelWrapper | null; -findHotspot(selector?: string): HotspotWrapper | null; -findIcon(selector?: string): IconWrapper | null; -findInput(selector?: string): InputWrapper | null; -findKeyValuePairs(selector?: string): KeyValuePairsWrapper | null; -findLineChart(selector?: string): LineChartWrapper | null; -findLink(selector?: string): LinkWrapper | null; -findLiveRegion(selector?: string): LiveRegionWrapper | null; -findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper | null; -findModal(selector?: string): ModalWrapper | null; -findMultiselect(selector?: string): MultiselectWrapper | null; -findPagination(selector?: string): PaginationWrapper | null; -findPieChart(selector?: string): PieChartWrapper | null; -findPopover(selector?: string): PopoverWrapper | null; -findProgressBar(selector?: string): ProgressBarWrapper | null; -findPromptInput(selector?: string): PromptInputWrapper | null; -findPropertyFilter(selector?: string): PropertyFilterWrapper | null; -findRadioGroup(selector?: string): RadioGroupWrapper | null; -findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper | null; -findSegmentedControl(selector?: string): SegmentedControlWrapper | null; -findSelect(selector?: string): SelectWrapper | null; -findSideNavigation(selector?: string): SideNavigationWrapper | null; -findSlider(selector?: string): SliderWrapper | null; -findSpaceBetween(selector?: string): SpaceBetweenWrapper | null; -findSpinner(selector?: string): SpinnerWrapper | null; -findSplitPanel(selector?: string): SplitPanelWrapper | null; -findStatusIndicator(selector?: string): StatusIndicatorWrapper | null; -findSteps(selector?: string): StepsWrapper | null; -findTable(selector?: string): TableWrapper | null; -findTabs(selector?: string): TabsWrapper | null; -findTagEditor(selector?: string): TagEditorWrapper | null; -findTextContent(selector?: string): TextContentWrapper | null; -findTextFilter(selector?: string): TextFilterWrapper | null; -findTextarea(selector?: string): TextareaWrapper | null; -findTiles(selector?: string): TilesWrapper | null; -findTimeInput(selector?: string): TimeInputWrapper | null; -findToggle(selector?: string): ToggleWrapper | null; -findToggleButton(selector?: string): ToggleButtonWrapper | null; -findTokenGroup(selector?: string): TokenGroupWrapper | null; -findTopNavigation(selector?: string): TopNavigationWrapper | null; -findTutorialPanel(selector?: string): TutorialPanelWrapper | null; -findWizard(selector?: string): WizardWrapper | null; + + /** + * Returns the wrapper of the first Alert that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Alert. + * If no matching Alert is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AlertWrapper | null} + */ + findAlert(selector?: string): AlertWrapper | null; + + /** + * Returns an array of Alert wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Alerts inside the current wrapper. + * If no matching Alert is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAlerts(selector?: string): Array; + /** + * Returns the first Alert that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Alert is found, returns \`null\`. + * + * @param {string} testId + * @returns {AlertWrapper | null} + */ + findAlertByTestId(testId: string): AlertWrapper | null; + + /** + * Returns the wrapper of the first AnchorNavigation that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first AnchorNavigation. + * If no matching AnchorNavigation is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AnchorNavigationWrapper | null} + */ + findAnchorNavigation(selector?: string): AnchorNavigationWrapper | null; + + /** + * Returns an array of AnchorNavigation wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the AnchorNavigations inside the current wrapper. + * If no matching AnchorNavigation is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAnchorNavigations(selector?: string): Array; + /** + * Returns the first AnchorNavigation that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching AnchorNavigation is found, returns \`null\`. + * + * @param {string} testId + * @returns {AnchorNavigationWrapper | null} + */ + findAnchorNavigationByTestId(testId: string): AnchorNavigationWrapper | null; + + /** + * Returns the wrapper of the first Annotation that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Annotation. + * If no matching Annotation is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AnnotationWrapper | null} + */ + findAnnotation(selector?: string): AnnotationWrapper | null; + + /** + * Returns an array of Annotation wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Annotations inside the current wrapper. + * If no matching Annotation is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAnnotations(selector?: string): Array; + /** + * Returns the first Annotation that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Annotation is found, returns \`null\`. + * + * @param {string} testId + * @returns {AnnotationWrapper | null} + */ + findAnnotationByTestId(testId: string): AnnotationWrapper | null; + + /** + * Returns the wrapper of the first AppLayout that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first AppLayout. + * If no matching AppLayout is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AppLayoutWrapper | null} + */ + findAppLayout(selector?: string): AppLayoutWrapper | null; + + /** + * Returns the wrapper of the first AreaChart that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first AreaChart. + * If no matching AreaChart is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AreaChartWrapper | null} + */ + findAreaChart(selector?: string): AreaChartWrapper | null; + + /** + * Returns an array of AreaChart wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the AreaCharts inside the current wrapper. + * If no matching AreaChart is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAreaCharts(selector?: string): Array; + /** + * Returns the first AreaChart that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching AreaChart is found, returns \`null\`. + * + * @param {string} testId + * @returns {AreaChartWrapper | null} + */ + findAreaChartByTestId(testId: string): AreaChartWrapper | null; + + /** + * Returns the wrapper of the first AttributeEditor that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first AttributeEditor. + * If no matching AttributeEditor is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AttributeEditorWrapper | null} + */ + findAttributeEditor(selector?: string): AttributeEditorWrapper | null; + + /** + * Returns an array of AttributeEditor wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the AttributeEditors inside the current wrapper. + * If no matching AttributeEditor is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAttributeEditors(selector?: string): Array; + /** + * Returns the first AttributeEditor that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching AttributeEditor is found, returns \`null\`. + * + * @param {string} testId + * @returns {AttributeEditorWrapper | null} + */ + findAttributeEditorByTestId(testId: string): AttributeEditorWrapper | null; + + /** + * Returns the wrapper of the first Autosuggest that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Autosuggest. + * If no matching Autosuggest is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {AutosuggestWrapper | null} + */ + findAutosuggest(selector?: string): AutosuggestWrapper | null; + + /** + * Returns an array of Autosuggest wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Autosuggests inside the current wrapper. + * If no matching Autosuggest is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllAutosuggests(selector?: string): Array; + /** + * Returns the first Autosuggest that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Autosuggest is found, returns \`null\`. + * + * @param {string} testId + * @returns {AutosuggestWrapper | null} + */ + findAutosuggestByTestId(testId: string): AutosuggestWrapper | null; + + /** + * Returns the wrapper of the first Badge that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Badge. + * If no matching Badge is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {BadgeWrapper | null} + */ + findBadge(selector?: string): BadgeWrapper | null; + + /** + * Returns an array of Badge wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Badges inside the current wrapper. + * If no matching Badge is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllBadges(selector?: string): Array; + /** + * Returns the first Badge that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Badge is found, returns \`null\`. + * + * @param {string} testId + * @returns {BadgeWrapper | null} + */ + findBadgeByTestId(testId: string): BadgeWrapper | null; + + /** + * Returns the wrapper of the first BarChart that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first BarChart. + * If no matching BarChart is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {BarChartWrapper | null} + */ + findBarChart(selector?: string): BarChartWrapper | null; + + /** + * Returns an array of BarChart wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the BarCharts inside the current wrapper. + * If no matching BarChart is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllBarCharts(selector?: string): Array; + /** + * Returns the first BarChart that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching BarChart is found, returns \`null\`. + * + * @param {string} testId + * @returns {BarChartWrapper | null} + */ + findBarChartByTestId(testId: string): BarChartWrapper | null; + + /** + * Returns the wrapper of the first Box that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Box. + * If no matching Box is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {BoxWrapper | null} + */ + findBox(selector?: string): BoxWrapper | null; + + /** + * Returns an array of Box wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Boxes inside the current wrapper. + * If no matching Box is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllBoxes(selector?: string): Array; + /** + * Returns the first Box that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Box is found, returns \`null\`. + * + * @param {string} testId + * @returns {BoxWrapper | null} + */ + findBoxByTestId(testId: string): BoxWrapper | null; + + /** + * Returns the wrapper of the first BreadcrumbGroup that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first BreadcrumbGroup. + * If no matching BreadcrumbGroup is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {BreadcrumbGroupWrapper | null} + */ + findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper | null; + + /** + * Returns an array of BreadcrumbGroup wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the BreadcrumbGroups inside the current wrapper. + * If no matching BreadcrumbGroup is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllBreadcrumbGroups(selector?: string): Array; + /** + * Returns the first BreadcrumbGroup that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching BreadcrumbGroup is found, returns \`null\`. + * + * @param {string} testId + * @returns {BreadcrumbGroupWrapper | null} + */ + findBreadcrumbGroupByTestId(testId: string): BreadcrumbGroupWrapper | null; + + /** + * Returns the wrapper of the first Button that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Button. + * If no matching Button is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonWrapper | null} + */ + findButton(selector?: string): ButtonWrapper | null; + + /** + * Returns an array of Button wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Buttons inside the current wrapper. + * If no matching Button is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllButtons(selector?: string): Array; + /** + * Returns the first Button that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Button is found, returns \`null\`. + * + * @param {string} testId + * @returns {ButtonWrapper | null} + */ + findButtonByTestId(testId: string): ButtonWrapper | null; + + /** + * Returns the wrapper of the first ButtonDropdown that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ButtonDropdown. + * If no matching ButtonDropdown is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonDropdownWrapper | null} + */ + findButtonDropdown(selector?: string): ButtonDropdownWrapper | null; + + /** + * Returns an array of ButtonDropdown wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ButtonDropdowns inside the current wrapper. + * If no matching ButtonDropdown is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllButtonDropdowns(selector?: string): Array; + /** + * Returns the first ButtonDropdown that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ButtonDropdown is found, returns \`null\`. + * + * @param {string} testId + * @returns {ButtonDropdownWrapper | null} + */ + findButtonDropdownByTestId(testId: string): ButtonDropdownWrapper | null; + + /** + * Returns the wrapper of the first ButtonGroup that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ButtonGroup. + * If no matching ButtonGroup is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonGroupWrapper | null} + */ + findButtonGroup(selector?: string): ButtonGroupWrapper | null; + + /** + * Returns an array of ButtonGroup wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ButtonGroups inside the current wrapper. + * If no matching ButtonGroup is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllButtonGroups(selector?: string): Array; + /** + * Returns the first ButtonGroup that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ButtonGroup is found, returns \`null\`. + * + * @param {string} testId + * @returns {ButtonGroupWrapper | null} + */ + findButtonGroupByTestId(testId: string): ButtonGroupWrapper | null; + + /** + * Returns the wrapper of the first Calendar that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Calendar. + * If no matching Calendar is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CalendarWrapper | null} + */ + findCalendar(selector?: string): CalendarWrapper | null; + + /** + * Returns an array of Calendar wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Calendars inside the current wrapper. + * If no matching Calendar is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCalendars(selector?: string): Array; + /** + * Returns the first Calendar that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Calendar is found, returns \`null\`. + * + * @param {string} testId + * @returns {CalendarWrapper | null} + */ + findCalendarByTestId(testId: string): CalendarWrapper | null; + + /** + * Returns the wrapper of the first Cards that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Cards. + * If no matching Cards is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CardsWrapper | null} + */ + findCards(selector?: string): CardsWrapper | null; + + /** + * Returns an array of Cards wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Cards inside the current wrapper. + * If no matching Cards is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCards(selector?: string): Array; + /** + * Returns the first Cards that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Cards is found, returns \`null\`. + * + * @param {string} testId + * @returns {CardsWrapper | null} + */ + findCardsByTestId(testId: string): CardsWrapper | null; + + /** + * Returns the wrapper of the first Checkbox that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Checkbox. + * If no matching Checkbox is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CheckboxWrapper | null} + */ + findCheckbox(selector?: string): CheckboxWrapper | null; + + /** + * Returns an array of Checkbox wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Checkboxes inside the current wrapper. + * If no matching Checkbox is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCheckboxes(selector?: string): Array; + /** + * Returns the first Checkbox that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Checkbox is found, returns \`null\`. + * + * @param {string} testId + * @returns {CheckboxWrapper | null} + */ + findCheckboxByTestId(testId: string): CheckboxWrapper | null; + + /** + * Returns the wrapper of the first CodeEditor that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first CodeEditor. + * If no matching CodeEditor is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CodeEditorWrapper | null} + */ + findCodeEditor(selector?: string): CodeEditorWrapper | null; + + /** + * Returns an array of CodeEditor wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the CodeEditors inside the current wrapper. + * If no matching CodeEditor is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCodeEditors(selector?: string): Array; + /** + * Returns the first CodeEditor that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching CodeEditor is found, returns \`null\`. + * + * @param {string} testId + * @returns {CodeEditorWrapper | null} + */ + findCodeEditorByTestId(testId: string): CodeEditorWrapper | null; + + /** + * Returns the wrapper of the first CollectionPreferences that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first CollectionPreferences. + * If no matching CollectionPreferences is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CollectionPreferencesWrapper | null} + */ + findCollectionPreferences(selector?: string): CollectionPreferencesWrapper | null; + + /** + * Returns an array of CollectionPreferences wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the CollectionPreferences inside the current wrapper. + * If no matching CollectionPreferences is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCollectionPreferences(selector?: string): Array; + /** + * Returns the first CollectionPreferences that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching CollectionPreferences is found, returns \`null\`. + * + * @param {string} testId + * @returns {CollectionPreferencesWrapper | null} + */ + findCollectionPreferencesByTestId(testId: string): CollectionPreferencesWrapper | null; + + /** + * Returns the wrapper of the first ColumnLayout that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ColumnLayout. + * If no matching ColumnLayout is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ColumnLayoutWrapper | null} + */ + findColumnLayout(selector?: string): ColumnLayoutWrapper | null; + + /** + * Returns an array of ColumnLayout wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ColumnLayouts inside the current wrapper. + * If no matching ColumnLayout is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllColumnLayouts(selector?: string): Array; + /** + * Returns the first ColumnLayout that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ColumnLayout is found, returns \`null\`. + * + * @param {string} testId + * @returns {ColumnLayoutWrapper | null} + */ + findColumnLayoutByTestId(testId: string): ColumnLayoutWrapper | null; + + /** + * Returns the wrapper of the first Container that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Container. + * If no matching Container is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ContainerWrapper | null} + */ + findContainer(selector?: string): ContainerWrapper | null; + + /** + * Returns an array of Container wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Containers inside the current wrapper. + * If no matching Container is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllContainers(selector?: string): Array; + /** + * Returns the first Container that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Container is found, returns \`null\`. + * + * @param {string} testId + * @returns {ContainerWrapper | null} + */ + findContainerByTestId(testId: string): ContainerWrapper | null; + + /** + * Returns the wrapper of the first ContentLayout that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ContentLayout. + * If no matching ContentLayout is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ContentLayoutWrapper | null} + */ + findContentLayout(selector?: string): ContentLayoutWrapper | null; + + /** + * Returns an array of ContentLayout wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ContentLayouts inside the current wrapper. + * If no matching ContentLayout is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllContentLayouts(selector?: string): Array; + /** + * Returns the first ContentLayout that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ContentLayout is found, returns \`null\`. + * + * @param {string} testId + * @returns {ContentLayoutWrapper | null} + */ + findContentLayoutByTestId(testId: string): ContentLayoutWrapper | null; + + /** + * Returns the wrapper of the first CopyToClipboard that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first CopyToClipboard. + * If no matching CopyToClipboard is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {CopyToClipboardWrapper | null} + */ + findCopyToClipboard(selector?: string): CopyToClipboardWrapper | null; + + /** + * Returns an array of CopyToClipboard wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the CopyToClipboards inside the current wrapper. + * If no matching CopyToClipboard is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllCopyToClipboards(selector?: string): Array; + /** + * Returns the first CopyToClipboard that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching CopyToClipboard is found, returns \`null\`. + * + * @param {string} testId + * @returns {CopyToClipboardWrapper | null} + */ + findCopyToClipboardByTestId(testId: string): CopyToClipboardWrapper | null; + + /** + * Returns the wrapper of the first DateInput that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first DateInput. + * If no matching DateInput is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {DateInputWrapper | null} + */ + findDateInput(selector?: string): DateInputWrapper | null; + + /** + * Returns an array of DateInput wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the DateInputs inside the current wrapper. + * If no matching DateInput is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllDateInputs(selector?: string): Array; + /** + * Returns the first DateInput that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching DateInput is found, returns \`null\`. + * + * @param {string} testId + * @returns {DateInputWrapper | null} + */ + findDateInputByTestId(testId: string): DateInputWrapper | null; + + /** + * Returns the wrapper of the first DatePicker that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first DatePicker. + * If no matching DatePicker is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {DatePickerWrapper | null} + */ + findDatePicker(selector?: string): DatePickerWrapper | null; + + /** + * Returns an array of DatePicker wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the DatePickers inside the current wrapper. + * If no matching DatePicker is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllDatePickers(selector?: string): Array; + /** + * Returns the first DatePicker that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching DatePicker is found, returns \`null\`. + * + * @param {string} testId + * @returns {DatePickerWrapper | null} + */ + findDatePickerByTestId(testId: string): DatePickerWrapper | null; + + /** + * Returns the wrapper of the first DateRangePicker that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first DateRangePicker. + * If no matching DateRangePicker is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {DateRangePickerWrapper | null} + */ + findDateRangePicker(selector?: string): DateRangePickerWrapper | null; + + /** + * Returns an array of DateRangePicker wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the DateRangePickers inside the current wrapper. + * If no matching DateRangePicker is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllDateRangePickers(selector?: string): Array; + /** + * Returns the first DateRangePicker that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching DateRangePicker is found, returns \`null\`. + * + * @param {string} testId + * @returns {DateRangePickerWrapper | null} + */ + findDateRangePickerByTestId(testId: string): DateRangePickerWrapper | null; + + /** + * Returns the wrapper of the first Drawer that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Drawer. + * If no matching Drawer is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {DrawerWrapper | null} + */ + findDrawer(selector?: string): DrawerWrapper | null; + + /** + * Returns an array of Drawer wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Drawers inside the current wrapper. + * If no matching Drawer is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllDrawers(selector?: string): Array; + /** + * Returns the first Drawer that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Drawer is found, returns \`null\`. + * + * @param {string} testId + * @returns {DrawerWrapper | null} + */ + findDrawerByTestId(testId: string): DrawerWrapper | null; + + /** + * Returns the wrapper of the first ExpandableSection that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ExpandableSection. + * If no matching ExpandableSection is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ExpandableSectionWrapper | null} + */ + findExpandableSection(selector?: string): ExpandableSectionWrapper | null; + + /** + * Returns an array of ExpandableSection wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ExpandableSections inside the current wrapper. + * If no matching ExpandableSection is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllExpandableSections(selector?: string): Array; + /** + * Returns the first ExpandableSection that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ExpandableSection is found, returns \`null\`. + * + * @param {string} testId + * @returns {ExpandableSectionWrapper | null} + */ + findExpandableSectionByTestId(testId: string): ExpandableSectionWrapper | null; + + /** + * Returns the wrapper of the first FileUpload that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first FileUpload. + * If no matching FileUpload is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {FileUploadWrapper | null} + */ + findFileUpload(selector?: string): FileUploadWrapper | null; + + /** + * Returns an array of FileUpload wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the FileUploads inside the current wrapper. + * If no matching FileUpload is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllFileUploads(selector?: string): Array; + /** + * Returns the first FileUpload that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching FileUpload is found, returns \`null\`. + * + * @param {string} testId + * @returns {FileUploadWrapper | null} + */ + findFileUploadByTestId(testId: string): FileUploadWrapper | null; + + /** + * Returns the wrapper of the first Flashbar that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Flashbar. + * If no matching Flashbar is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {FlashbarWrapper | null} + */ + findFlashbar(selector?: string): FlashbarWrapper | null; + + /** + * Returns an array of Flashbar wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Flashbars inside the current wrapper. + * If no matching Flashbar is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllFlashbars(selector?: string): Array; + /** + * Returns the first Flashbar that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Flashbar is found, returns \`null\`. + * + * @param {string} testId + * @returns {FlashbarWrapper | null} + */ + findFlashbarByTestId(testId: string): FlashbarWrapper | null; + + /** + * Returns the wrapper of the first Form that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Form. + * If no matching Form is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {FormWrapper | null} + */ + findForm(selector?: string): FormWrapper | null; + + /** + * Returns an array of Form wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Forms inside the current wrapper. + * If no matching Form is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllForms(selector?: string): Array; + /** + * Returns the first Form that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Form is found, returns \`null\`. + * + * @param {string} testId + * @returns {FormWrapper | null} + */ + findFormByTestId(testId: string): FormWrapper | null; + + /** + * Returns the wrapper of the first FormField that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first FormField. + * If no matching FormField is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {FormFieldWrapper | null} + */ + findFormField(selector?: string): FormFieldWrapper | null; + + /** + * Returns an array of FormField wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the FormFields inside the current wrapper. + * If no matching FormField is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllFormFields(selector?: string): Array; + /** + * Returns the first FormField that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching FormField is found, returns \`null\`. + * + * @param {string} testId + * @returns {FormFieldWrapper | null} + */ + findFormFieldByTestId(testId: string): FormFieldWrapper | null; + + /** + * Returns the wrapper of the first Grid that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Grid. + * If no matching Grid is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {GridWrapper | null} + */ + findGrid(selector?: string): GridWrapper | null; + + /** + * Returns an array of Grid wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Grids inside the current wrapper. + * If no matching Grid is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllGrids(selector?: string): Array; + /** + * Returns the first Grid that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Grid is found, returns \`null\`. + * + * @param {string} testId + * @returns {GridWrapper | null} + */ + findGridByTestId(testId: string): GridWrapper | null; + + /** + * Returns the wrapper of the first Header that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Header. + * If no matching Header is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {HeaderWrapper | null} + */ + findHeader(selector?: string): HeaderWrapper | null; + + /** + * Returns an array of Header wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Headers inside the current wrapper. + * If no matching Header is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllHeaders(selector?: string): Array; + /** + * Returns the first Header that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Header is found, returns \`null\`. + * + * @param {string} testId + * @returns {HeaderWrapper | null} + */ + findHeaderByTestId(testId: string): HeaderWrapper | null; + + /** + * Returns the wrapper of the first HelpPanel that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first HelpPanel. + * If no matching HelpPanel is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {HelpPanelWrapper | null} + */ + findHelpPanel(selector?: string): HelpPanelWrapper | null; + + /** + * Returns an array of HelpPanel wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the HelpPanels inside the current wrapper. + * If no matching HelpPanel is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllHelpPanels(selector?: string): Array; + /** + * Returns the first HelpPanel that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching HelpPanel is found, returns \`null\`. + * + * @param {string} testId + * @returns {HelpPanelWrapper | null} + */ + findHelpPanelByTestId(testId: string): HelpPanelWrapper | null; + + /** + * Returns the wrapper of the first Hotspot that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Hotspot. + * If no matching Hotspot is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {HotspotWrapper | null} + */ + findHotspot(selector?: string): HotspotWrapper | null; + + /** + * Returns an array of Hotspot wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Hotspots inside the current wrapper. + * If no matching Hotspot is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllHotspots(selector?: string): Array; + /** + * Returns the first Hotspot that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Hotspot is found, returns \`null\`. + * + * @param {string} testId + * @returns {HotspotWrapper | null} + */ + findHotspotByTestId(testId: string): HotspotWrapper | null; + + /** + * Returns the wrapper of the first Icon that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Icon. + * If no matching Icon is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {IconWrapper | null} + */ + findIcon(selector?: string): IconWrapper | null; + + /** + * Returns an array of Icon wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Icons inside the current wrapper. + * If no matching Icon is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllIcons(selector?: string): Array; + /** + * Returns the first Icon that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Icon is found, returns \`null\`. + * + * @param {string} testId + * @returns {IconWrapper | null} + */ + findIconByTestId(testId: string): IconWrapper | null; + + /** + * Returns the wrapper of the first Input that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Input. + * If no matching Input is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {InputWrapper | null} + */ + findInput(selector?: string): InputWrapper | null; + + /** + * Returns an array of Input wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Inputs inside the current wrapper. + * If no matching Input is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllInputs(selector?: string): Array; + /** + * Returns the first Input that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Input is found, returns \`null\`. + * + * @param {string} testId + * @returns {InputWrapper | null} + */ + findInputByTestId(testId: string): InputWrapper | null; + + /** + * Returns the wrapper of the first KeyValuePairs that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first KeyValuePairs. + * If no matching KeyValuePairs is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {KeyValuePairsWrapper | null} + */ + findKeyValuePairs(selector?: string): KeyValuePairsWrapper | null; + + /** + * Returns an array of KeyValuePairs wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the KeyValuePairs inside the current wrapper. + * If no matching KeyValuePairs is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllKeyValuePairs(selector?: string): Array; + /** + * Returns the first KeyValuePairs that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching KeyValuePairs is found, returns \`null\`. + * + * @param {string} testId + * @returns {KeyValuePairsWrapper | null} + */ + findKeyValuePairsByTestId(testId: string): KeyValuePairsWrapper | null; + + /** + * Returns the wrapper of the first LineChart that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first LineChart. + * If no matching LineChart is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {LineChartWrapper | null} + */ + findLineChart(selector?: string): LineChartWrapper | null; + + /** + * Returns an array of LineChart wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the LineCharts inside the current wrapper. + * If no matching LineChart is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllLineCharts(selector?: string): Array; + /** + * Returns the first LineChart that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching LineChart is found, returns \`null\`. + * + * @param {string} testId + * @returns {LineChartWrapper | null} + */ + findLineChartByTestId(testId: string): LineChartWrapper | null; + + /** + * Returns the wrapper of the first Link that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Link. + * If no matching Link is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {LinkWrapper | null} + */ + findLink(selector?: string): LinkWrapper | null; + + /** + * Returns an array of Link wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Links inside the current wrapper. + * If no matching Link is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllLinks(selector?: string): Array; + /** + * Returns the first Link that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Link is found, returns \`null\`. + * + * @param {string} testId + * @returns {LinkWrapper | null} + */ + findLinkByTestId(testId: string): LinkWrapper | null; + + /** + * Returns the wrapper of the first LiveRegion that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first LiveRegion. + * If no matching LiveRegion is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {LiveRegionWrapper | null} + */ + findLiveRegion(selector?: string): LiveRegionWrapper | null; + + /** + * Returns an array of LiveRegion wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the LiveRegions inside the current wrapper. + * If no matching LiveRegion is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllLiveRegions(selector?: string): Array; + /** + * Returns the first LiveRegion that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching LiveRegion is found, returns \`null\`. + * + * @param {string} testId + * @returns {LiveRegionWrapper | null} + */ + findLiveRegionByTestId(testId: string): LiveRegionWrapper | null; + + /** + * Returns the wrapper of the first MixedLineBarChart that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first MixedLineBarChart. + * If no matching MixedLineBarChart is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {MixedLineBarChartWrapper | null} + */ + findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper | null; + + /** + * Returns an array of MixedLineBarChart wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the MixedLineBarCharts inside the current wrapper. + * If no matching MixedLineBarChart is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllMixedLineBarCharts(selector?: string): Array; + /** + * Returns the first MixedLineBarChart that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching MixedLineBarChart is found, returns \`null\`. + * + * @param {string} testId + * @returns {MixedLineBarChartWrapper | null} + */ + findMixedLineBarChartByTestId(testId: string): MixedLineBarChartWrapper | null; + + /** + * Returns the wrapper of the first Modal that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Modal. + * If no matching Modal is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ModalWrapper | null} + */ + findModal(selector?: string): ModalWrapper | null; + + /** + * Returns an array of Modal wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Modals inside the current wrapper. + * If no matching Modal is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllModals(selector?: string): Array; + /** + * Returns the first Modal that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Modal is found, returns \`null\`. + * + * @param {string} testId + * @returns {ModalWrapper | null} + */ + findModalByTestId(testId: string): ModalWrapper | null; + + /** + * Returns the wrapper of the first Multiselect that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Multiselect. + * If no matching Multiselect is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {MultiselectWrapper | null} + */ + findMultiselect(selector?: string): MultiselectWrapper | null; + + /** + * Returns an array of Multiselect wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Multiselects inside the current wrapper. + * If no matching Multiselect is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllMultiselects(selector?: string): Array; + /** + * Returns the first Multiselect that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Multiselect is found, returns \`null\`. + * + * @param {string} testId + * @returns {MultiselectWrapper | null} + */ + findMultiselectByTestId(testId: string): MultiselectWrapper | null; + + /** + * Returns the wrapper of the first Pagination that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Pagination. + * If no matching Pagination is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {PaginationWrapper | null} + */ + findPagination(selector?: string): PaginationWrapper | null; + + /** + * Returns an array of Pagination wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Paginations inside the current wrapper. + * If no matching Pagination is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllPaginations(selector?: string): Array; + /** + * Returns the first Pagination that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Pagination is found, returns \`null\`. + * + * @param {string} testId + * @returns {PaginationWrapper | null} + */ + findPaginationByTestId(testId: string): PaginationWrapper | null; + + /** + * Returns the wrapper of the first PieChart that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first PieChart. + * If no matching PieChart is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {PieChartWrapper | null} + */ + findPieChart(selector?: string): PieChartWrapper | null; + + /** + * Returns an array of PieChart wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the PieCharts inside the current wrapper. + * If no matching PieChart is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllPieCharts(selector?: string): Array; + /** + * Returns the first PieChart that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching PieChart is found, returns \`null\`. + * + * @param {string} testId + * @returns {PieChartWrapper | null} + */ + findPieChartByTestId(testId: string): PieChartWrapper | null; + + /** + * Returns the wrapper of the first Popover that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Popover. + * If no matching Popover is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {PopoverWrapper | null} + */ + findPopover(selector?: string): PopoverWrapper | null; + + /** + * Returns an array of Popover wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Popovers inside the current wrapper. + * If no matching Popover is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllPopovers(selector?: string): Array; + /** + * Returns the first Popover that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Popover is found, returns \`null\`. + * + * @param {string} testId + * @returns {PopoverWrapper | null} + */ + findPopoverByTestId(testId: string): PopoverWrapper | null; + + /** + * Returns the wrapper of the first ProgressBar that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ProgressBar. + * If no matching ProgressBar is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ProgressBarWrapper | null} + */ + findProgressBar(selector?: string): ProgressBarWrapper | null; + + /** + * Returns an array of ProgressBar wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ProgressBars inside the current wrapper. + * If no matching ProgressBar is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllProgressBars(selector?: string): Array; + /** + * Returns the first ProgressBar that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ProgressBar is found, returns \`null\`. + * + * @param {string} testId + * @returns {ProgressBarWrapper | null} + */ + findProgressBarByTestId(testId: string): ProgressBarWrapper | null; + + /** + * Returns the wrapper of the first PromptInput that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first PromptInput. + * If no matching PromptInput is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {PromptInputWrapper | null} + */ + findPromptInput(selector?: string): PromptInputWrapper | null; + + /** + * Returns an array of PromptInput wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the PromptInputs inside the current wrapper. + * If no matching PromptInput is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllPromptInputs(selector?: string): Array; + /** + * Returns the first PromptInput that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching PromptInput is found, returns \`null\`. + * + * @param {string} testId + * @returns {PromptInputWrapper | null} + */ + findPromptInputByTestId(testId: string): PromptInputWrapper | null; + + /** + * Returns the wrapper of the first PropertyFilter that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first PropertyFilter. + * If no matching PropertyFilter is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {PropertyFilterWrapper | null} + */ + findPropertyFilter(selector?: string): PropertyFilterWrapper | null; + + /** + * Returns an array of PropertyFilter wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the PropertyFilters inside the current wrapper. + * If no matching PropertyFilter is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllPropertyFilters(selector?: string): Array; + /** + * Returns the first PropertyFilter that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching PropertyFilter is found, returns \`null\`. + * + * @param {string} testId + * @returns {PropertyFilterWrapper | null} + */ + findPropertyFilterByTestId(testId: string): PropertyFilterWrapper | null; + + /** + * Returns the wrapper of the first RadioGroup that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first RadioGroup. + * If no matching RadioGroup is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {RadioGroupWrapper | null} + */ + findRadioGroup(selector?: string): RadioGroupWrapper | null; + + /** + * Returns an array of RadioGroup wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the RadioGroups inside the current wrapper. + * If no matching RadioGroup is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllRadioGroups(selector?: string): Array; + /** + * Returns the first RadioGroup that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching RadioGroup is found, returns \`null\`. + * + * @param {string} testId + * @returns {RadioGroupWrapper | null} + */ + findRadioGroupByTestId(testId: string): RadioGroupWrapper | null; + + /** + * Returns the wrapper of the first S3ResourceSelector that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first S3ResourceSelector. + * If no matching S3ResourceSelector is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {S3ResourceSelectorWrapper | null} + */ + findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper | null; + + /** + * Returns an array of S3ResourceSelector wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the S3ResourceSelectors inside the current wrapper. + * If no matching S3ResourceSelector is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllS3ResourceSelectors(selector?: string): Array; + /** + * Returns the first S3ResourceSelector that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching S3ResourceSelector is found, returns \`null\`. + * + * @param {string} testId + * @returns {S3ResourceSelectorWrapper | null} + */ + findS3ResourceSelectorByTestId(testId: string): S3ResourceSelectorWrapper | null; + + /** + * Returns the wrapper of the first SegmentedControl that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first SegmentedControl. + * If no matching SegmentedControl is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SegmentedControlWrapper | null} + */ + findSegmentedControl(selector?: string): SegmentedControlWrapper | null; + + /** + * Returns an array of SegmentedControl wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the SegmentedControls inside the current wrapper. + * If no matching SegmentedControl is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSegmentedControls(selector?: string): Array; + /** + * Returns the first SegmentedControl that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching SegmentedControl is found, returns \`null\`. + * + * @param {string} testId + * @returns {SegmentedControlWrapper | null} + */ + findSegmentedControlByTestId(testId: string): SegmentedControlWrapper | null; + + /** + * Returns the wrapper of the first Select that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Select. + * If no matching Select is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SelectWrapper | null} + */ + findSelect(selector?: string): SelectWrapper | null; + + /** + * Returns an array of Select wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Selects inside the current wrapper. + * If no matching Select is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSelects(selector?: string): Array; + /** + * Returns the first Select that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Select is found, returns \`null\`. + * + * @param {string} testId + * @returns {SelectWrapper | null} + */ + findSelectByTestId(testId: string): SelectWrapper | null; + + /** + * Returns the wrapper of the first SideNavigation that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first SideNavigation. + * If no matching SideNavigation is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SideNavigationWrapper | null} + */ + findSideNavigation(selector?: string): SideNavigationWrapper | null; + + /** + * Returns an array of SideNavigation wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the SideNavigations inside the current wrapper. + * If no matching SideNavigation is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSideNavigations(selector?: string): Array; + /** + * Returns the first SideNavigation that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching SideNavigation is found, returns \`null\`. + * + * @param {string} testId + * @returns {SideNavigationWrapper | null} + */ + findSideNavigationByTestId(testId: string): SideNavigationWrapper | null; + + /** + * Returns the wrapper of the first Slider that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Slider. + * If no matching Slider is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SliderWrapper | null} + */ + findSlider(selector?: string): SliderWrapper | null; + + /** + * Returns an array of Slider wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Sliders inside the current wrapper. + * If no matching Slider is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSliders(selector?: string): Array; + /** + * Returns the first Slider that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Slider is found, returns \`null\`. + * + * @param {string} testId + * @returns {SliderWrapper | null} + */ + findSliderByTestId(testId: string): SliderWrapper | null; + + /** + * Returns the wrapper of the first SpaceBetween that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first SpaceBetween. + * If no matching SpaceBetween is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SpaceBetweenWrapper | null} + */ + findSpaceBetween(selector?: string): SpaceBetweenWrapper | null; + + /** + * Returns an array of SpaceBetween wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the SpaceBetweens inside the current wrapper. + * If no matching SpaceBetween is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSpaceBetweens(selector?: string): Array; + /** + * Returns the first SpaceBetween that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching SpaceBetween is found, returns \`null\`. + * + * @param {string} testId + * @returns {SpaceBetweenWrapper | null} + */ + findSpaceBetweenByTestId(testId: string): SpaceBetweenWrapper | null; + + /** + * Returns the wrapper of the first Spinner that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Spinner. + * If no matching Spinner is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SpinnerWrapper | null} + */ + findSpinner(selector?: string): SpinnerWrapper | null; + + /** + * Returns an array of Spinner wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Spinners inside the current wrapper. + * If no matching Spinner is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSpinners(selector?: string): Array; + /** + * Returns the first Spinner that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Spinner is found, returns \`null\`. + * + * @param {string} testId + * @returns {SpinnerWrapper | null} + */ + findSpinnerByTestId(testId: string): SpinnerWrapper | null; + + /** + * Returns the wrapper of the first SplitPanel that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first SplitPanel. + * If no matching SplitPanel is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {SplitPanelWrapper | null} + */ + findSplitPanel(selector?: string): SplitPanelWrapper | null; + + /** + * Returns an array of SplitPanel wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the SplitPanels inside the current wrapper. + * If no matching SplitPanel is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSplitPanels(selector?: string): Array; + /** + * Returns the first SplitPanel that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching SplitPanel is found, returns \`null\`. + * + * @param {string} testId + * @returns {SplitPanelWrapper | null} + */ + findSplitPanelByTestId(testId: string): SplitPanelWrapper | null; + + /** + * Returns the wrapper of the first StatusIndicator that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first StatusIndicator. + * If no matching StatusIndicator is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {StatusIndicatorWrapper | null} + */ + findStatusIndicator(selector?: string): StatusIndicatorWrapper | null; + + /** + * Returns an array of StatusIndicator wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the StatusIndicators inside the current wrapper. + * If no matching StatusIndicator is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllStatusIndicators(selector?: string): Array; + /** + * Returns the first StatusIndicator that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching StatusIndicator is found, returns \`null\`. + * + * @param {string} testId + * @returns {StatusIndicatorWrapper | null} + */ + findStatusIndicatorByTestId(testId: string): StatusIndicatorWrapper | null; + + /** + * Returns the wrapper of the first Steps that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Steps. + * If no matching Steps is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {StepsWrapper | null} + */ + findSteps(selector?: string): StepsWrapper | null; + + /** + * Returns an array of Steps wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Steps inside the current wrapper. + * If no matching Steps is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllSteps(selector?: string): Array; + /** + * Returns the first Steps that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Steps is found, returns \`null\`. + * + * @param {string} testId + * @returns {StepsWrapper | null} + */ + findStepsByTestId(testId: string): StepsWrapper | null; + + /** + * Returns the wrapper of the first Table that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Table. + * If no matching Table is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TableWrapper | null} + */ + findTable(selector?: string): TableWrapper | null; + + /** + * Returns an array of Table wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Tables inside the current wrapper. + * If no matching Table is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTables(selector?: string): Array; + /** + * Returns the first Table that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Table is found, returns \`null\`. + * + * @param {string} testId + * @returns {TableWrapper | null} + */ + findTableByTestId(testId: string): TableWrapper | null; + + /** + * Returns the wrapper of the first Tabs that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Tabs. + * If no matching Tabs is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TabsWrapper | null} + */ + findTabs(selector?: string): TabsWrapper | null; + + /** + * Returns an array of Tabs wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Tabs inside the current wrapper. + * If no matching Tabs is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTabs(selector?: string): Array; + /** + * Returns the first Tabs that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Tabs is found, returns \`null\`. + * + * @param {string} testId + * @returns {TabsWrapper | null} + */ + findTabsByTestId(testId: string): TabsWrapper | null; + + /** + * Returns the wrapper of the first TagEditor that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TagEditor. + * If no matching TagEditor is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TagEditorWrapper | null} + */ + findTagEditor(selector?: string): TagEditorWrapper | null; + + /** + * Returns an array of TagEditor wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TagEditors inside the current wrapper. + * If no matching TagEditor is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTagEditors(selector?: string): Array; + /** + * Returns the first TagEditor that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TagEditor is found, returns \`null\`. + * + * @param {string} testId + * @returns {TagEditorWrapper | null} + */ + findTagEditorByTestId(testId: string): TagEditorWrapper | null; + + /** + * Returns the wrapper of the first TextContent that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TextContent. + * If no matching TextContent is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TextContentWrapper | null} + */ + findTextContent(selector?: string): TextContentWrapper | null; + + /** + * Returns an array of TextContent wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TextContents inside the current wrapper. + * If no matching TextContent is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTextContents(selector?: string): Array; + /** + * Returns the first TextContent that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TextContent is found, returns \`null\`. + * + * @param {string} testId + * @returns {TextContentWrapper | null} + */ + findTextContentByTestId(testId: string): TextContentWrapper | null; + + /** + * Returns the wrapper of the first TextFilter that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TextFilter. + * If no matching TextFilter is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TextFilterWrapper | null} + */ + findTextFilter(selector?: string): TextFilterWrapper | null; + + /** + * Returns an array of TextFilter wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TextFilters inside the current wrapper. + * If no matching TextFilter is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTextFilters(selector?: string): Array; + /** + * Returns the first TextFilter that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TextFilter is found, returns \`null\`. + * + * @param {string} testId + * @returns {TextFilterWrapper | null} + */ + findTextFilterByTestId(testId: string): TextFilterWrapper | null; + + /** + * Returns the wrapper of the first Textarea that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Textarea. + * If no matching Textarea is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TextareaWrapper | null} + */ + findTextarea(selector?: string): TextareaWrapper | null; + + /** + * Returns an array of Textarea wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Textareas inside the current wrapper. + * If no matching Textarea is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTextareas(selector?: string): Array; + /** + * Returns the first Textarea that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Textarea is found, returns \`null\`. + * + * @param {string} testId + * @returns {TextareaWrapper | null} + */ + findTextareaByTestId(testId: string): TextareaWrapper | null; + + /** + * Returns the wrapper of the first Tiles that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Tiles. + * If no matching Tiles is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TilesWrapper | null} + */ + findTiles(selector?: string): TilesWrapper | null; + + /** + * Returns an array of Tiles wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Tiles inside the current wrapper. + * If no matching Tiles is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTiles(selector?: string): Array; + /** + * Returns the first Tiles that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Tiles is found, returns \`null\`. + * + * @param {string} testId + * @returns {TilesWrapper | null} + */ + findTilesByTestId(testId: string): TilesWrapper | null; + + /** + * Returns the wrapper of the first TimeInput that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TimeInput. + * If no matching TimeInput is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TimeInputWrapper | null} + */ + findTimeInput(selector?: string): TimeInputWrapper | null; + + /** + * Returns an array of TimeInput wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TimeInputs inside the current wrapper. + * If no matching TimeInput is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTimeInputs(selector?: string): Array; + /** + * Returns the first TimeInput that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TimeInput is found, returns \`null\`. + * + * @param {string} testId + * @returns {TimeInputWrapper | null} + */ + findTimeInputByTestId(testId: string): TimeInputWrapper | null; + + /** + * Returns the wrapper of the first Toggle that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Toggle. + * If no matching Toggle is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ToggleWrapper | null} + */ + findToggle(selector?: string): ToggleWrapper | null; + + /** + * Returns an array of Toggle wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Toggles inside the current wrapper. + * If no matching Toggle is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllToggles(selector?: string): Array; + /** + * Returns the first Toggle that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Toggle is found, returns \`null\`. + * + * @param {string} testId + * @returns {ToggleWrapper | null} + */ + findToggleByTestId(testId: string): ToggleWrapper | null; + + /** + * Returns the wrapper of the first ToggleButton that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first ToggleButton. + * If no matching ToggleButton is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {ToggleButtonWrapper | null} + */ + findToggleButton(selector?: string): ToggleButtonWrapper | null; + + /** + * Returns an array of ToggleButton wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the ToggleButtons inside the current wrapper. + * If no matching ToggleButton is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllToggleButtons(selector?: string): Array; + /** + * Returns the first ToggleButton that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching ToggleButton is found, returns \`null\`. + * + * @param {string} testId + * @returns {ToggleButtonWrapper | null} + */ + findToggleButtonByTestId(testId: string): ToggleButtonWrapper | null; + + /** + * Returns the wrapper of the first TokenGroup that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TokenGroup. + * If no matching TokenGroup is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TokenGroupWrapper | null} + */ + findTokenGroup(selector?: string): TokenGroupWrapper | null; + + /** + * Returns an array of TokenGroup wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TokenGroups inside the current wrapper. + * If no matching TokenGroup is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTokenGroups(selector?: string): Array; + /** + * Returns the first TokenGroup that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TokenGroup is found, returns \`null\`. + * + * @param {string} testId + * @returns {TokenGroupWrapper | null} + */ + findTokenGroupByTestId(testId: string): TokenGroupWrapper | null; + + /** + * Returns the wrapper of the first TopNavigation that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TopNavigation. + * If no matching TopNavigation is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TopNavigationWrapper | null} + */ + findTopNavigation(selector?: string): TopNavigationWrapper | null; + + /** + * Returns the wrapper of the first TutorialPanel that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first TutorialPanel. + * If no matching TutorialPanel is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {TutorialPanelWrapper | null} + */ + findTutorialPanel(selector?: string): TutorialPanelWrapper | null; + + /** + * Returns an array of TutorialPanel wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the TutorialPanels inside the current wrapper. + * If no matching TutorialPanel is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllTutorialPanels(selector?: string): Array; + /** + * Returns the first TutorialPanel that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching TutorialPanel is found, returns \`null\`. + * + * @param {string} testId + * @returns {TutorialPanelWrapper | null} + */ + findTutorialPanelByTestId(testId: string): TutorialPanelWrapper | null; + + /** + * Returns the wrapper of the first Wizard that matches the specified CSS selector. + * If no CSS selector is specified, returns the wrapper of the first Wizard. + * If no matching Wizard is found, returns \`null\`. + * + * @param {string} [selector] CSS Selector + * @returns {WizardWrapper | null} + */ + findWizard(selector?: string): WizardWrapper | null; + + /** + * Returns an array of Wizard wrapper that matches the specified CSS selector. + * If no CSS selector is specified, returns all of the Wizards inside the current wrapper. + * If no matching Wizard is found, returns an empty array. + * + * @param {string} [selector] CSS Selector + * @returns {Array} + */ + findAllWizards(selector?: string): Array; + /** + * Returns the first Wizard that matches the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * If no matching Wizard is found, returns \`null\`. + * + * @param {string} testId + * @returns {WizardWrapper | null} + */ + findWizardByTestId(testId: string): WizardWrapper | null; } - } -ElementWrapper.prototype.findAlert = function(selector) { - const rootSelector = \`.\${AlertWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); - }; -ElementWrapper.prototype.findAnchorNavigation = function(selector) { - const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); - }; -ElementWrapper.prototype.findAnnotation = function(selector) { - const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); - }; -ElementWrapper.prototype.findAppLayout = function(selector) { - const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); - }; -ElementWrapper.prototype.findAreaChart = function(selector) { - const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); - }; -ElementWrapper.prototype.findAttributeEditor = function(selector) { - const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); - }; -ElementWrapper.prototype.findAutosuggest = function(selector) { - const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); - }; -ElementWrapper.prototype.findBadge = function(selector) { - const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); - }; -ElementWrapper.prototype.findBarChart = function(selector) { - const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); - }; -ElementWrapper.prototype.findBox = function(selector) { - const rootSelector = \`.\${BoxWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); - }; -ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { - const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); - }; -ElementWrapper.prototype.findButton = function(selector) { - const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); - }; -ElementWrapper.prototype.findButtonDropdown = function(selector) { - const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); - }; -ElementWrapper.prototype.findButtonGroup = function(selector) { - const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); - }; -ElementWrapper.prototype.findCalendar = function(selector) { - const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); - }; -ElementWrapper.prototype.findCards = function(selector) { - const rootSelector = \`.\${CardsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); - }; -ElementWrapper.prototype.findCheckbox = function(selector) { - const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); - }; -ElementWrapper.prototype.findCodeEditor = function(selector) { - const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); - }; -ElementWrapper.prototype.findCollectionPreferences = function(selector) { - const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); - }; -ElementWrapper.prototype.findColumnLayout = function(selector) { - const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); - }; -ElementWrapper.prototype.findContainer = function(selector) { - const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); - }; -ElementWrapper.prototype.findContentLayout = function(selector) { - const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); - }; -ElementWrapper.prototype.findCopyToClipboard = function(selector) { - const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); - }; -ElementWrapper.prototype.findDateInput = function(selector) { - const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); - }; -ElementWrapper.prototype.findDatePicker = function(selector) { - const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); - }; -ElementWrapper.prototype.findDateRangePicker = function(selector) { - const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); - }; -ElementWrapper.prototype.findDrawer = function(selector) { - const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); - }; -ElementWrapper.prototype.findExpandableSection = function(selector) { - const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); - }; -ElementWrapper.prototype.findFileUpload = function(selector) { - const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); - }; -ElementWrapper.prototype.findFlashbar = function(selector) { - const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); - }; -ElementWrapper.prototype.findForm = function(selector) { - const rootSelector = \`.\${FormWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); - }; -ElementWrapper.prototype.findFormField = function(selector) { - const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); - }; -ElementWrapper.prototype.findGrid = function(selector) { - const rootSelector = \`.\${GridWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); - }; -ElementWrapper.prototype.findHeader = function(selector) { - const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); - }; -ElementWrapper.prototype.findHelpPanel = function(selector) { - const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); - }; -ElementWrapper.prototype.findHotspot = function(selector) { - const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); - }; -ElementWrapper.prototype.findIcon = function(selector) { - const rootSelector = \`.\${IconWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); - }; -ElementWrapper.prototype.findInput = function(selector) { - const rootSelector = \`.\${InputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); - }; -ElementWrapper.prototype.findKeyValuePairs = function(selector) { - const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); - }; -ElementWrapper.prototype.findLineChart = function(selector) { - const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); - }; -ElementWrapper.prototype.findLink = function(selector) { - const rootSelector = \`.\${LinkWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); - }; -ElementWrapper.prototype.findLiveRegion = function(selector) { - const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); - }; -ElementWrapper.prototype.findMixedLineBarChart = function(selector) { - const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); - }; -ElementWrapper.prototype.findModal = function(selector) { - const rootSelector = \`.\${ModalWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); - }; -ElementWrapper.prototype.findMultiselect = function(selector) { - const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); - }; -ElementWrapper.prototype.findPagination = function(selector) { - const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); - }; -ElementWrapper.prototype.findPieChart = function(selector) { - const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); - }; -ElementWrapper.prototype.findPopover = function(selector) { - const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); - }; -ElementWrapper.prototype.findProgressBar = function(selector) { - const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); - }; -ElementWrapper.prototype.findPromptInput = function(selector) { - const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); - }; -ElementWrapper.prototype.findPropertyFilter = function(selector) { - const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); - }; -ElementWrapper.prototype.findRadioGroup = function(selector) { - const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); - }; -ElementWrapper.prototype.findS3ResourceSelector = function(selector) { - const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); - }; -ElementWrapper.prototype.findSegmentedControl = function(selector) { - const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); - }; -ElementWrapper.prototype.findSelect = function(selector) { - const rootSelector = \`.\${SelectWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); - }; -ElementWrapper.prototype.findSideNavigation = function(selector) { - const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); - }; -ElementWrapper.prototype.findSlider = function(selector) { - const rootSelector = \`.\${SliderWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); - }; -ElementWrapper.prototype.findSpaceBetween = function(selector) { - const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); - }; -ElementWrapper.prototype.findSpinner = function(selector) { - const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); - }; -ElementWrapper.prototype.findSplitPanel = function(selector) { - const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); - }; -ElementWrapper.prototype.findStatusIndicator = function(selector) { - const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); - }; -ElementWrapper.prototype.findSteps = function(selector) { - const rootSelector = \`.\${StepsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); - }; -ElementWrapper.prototype.findTable = function(selector) { - const rootSelector = \`.\${TableWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); - }; -ElementWrapper.prototype.findTabs = function(selector) { - const rootSelector = \`.\${TabsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); - }; -ElementWrapper.prototype.findTagEditor = function(selector) { - const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); - }; -ElementWrapper.prototype.findTextContent = function(selector) { - const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); - }; -ElementWrapper.prototype.findTextFilter = function(selector) { - const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); - }; -ElementWrapper.prototype.findTextarea = function(selector) { - const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); - }; -ElementWrapper.prototype.findTiles = function(selector) { - const rootSelector = \`.\${TilesWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); - }; -ElementWrapper.prototype.findTimeInput = function(selector) { - const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); - }; -ElementWrapper.prototype.findToggle = function(selector) { - const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); - }; -ElementWrapper.prototype.findToggleButton = function(selector) { - const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); - }; -ElementWrapper.prototype.findTokenGroup = function(selector) { - const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); - }; -ElementWrapper.prototype.findTopNavigation = function(selector) { - const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); - }; -ElementWrapper.prototype.findTutorialPanel = function(selector) { - const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); - }; -ElementWrapper.prototype.findWizard = function(selector) { - const rootSelector = \`.\${WizardWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); - }; -export default function wrapper(root: Element = document.body) { if (document && document.body && !document.body.contains(root)) { console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly')}; return new ElementWrapper(root); }" -`; + } -exports[`Generate test utils ElementWrapper selectors ElementWrapper matches the snapshot 1`] = ` -"import { ElementWrapper } from '@cloudscape-design/test-utils-core/selectors'; -import { appendSelector } from '@cloudscape-design/test-utils-core/utils'; -export { ElementWrapper }; + ElementWrapper.prototype.findAlert = function(selector) { + const rootSelector = \`.\${AlertWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); + }; - import AlertWrapper from './alert'; - export { AlertWrapper }; - + ElementWrapper.prototype.findAllAlerts = function(selector) { + return this.findAllComponents(AlertWrapper, selector); + }; - import AnchorNavigationWrapper from './anchor-navigation'; - export { AnchorNavigationWrapper }; - + ElementWrapper.prototype.findAlertByTestId = function(testId) { + const selector = \`.\${AlertWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AlertWrapper); + }; - import AnnotationWrapper from './annotation'; - export { AnnotationWrapper }; - + ElementWrapper.prototype.findAnchorNavigation = function(selector) { + const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); + }; - import AppLayoutWrapper from './app-layout'; - export { AppLayoutWrapper }; - + ElementWrapper.prototype.findAllAnchorNavigations = function(selector) { + return this.findAllComponents(AnchorNavigationWrapper, selector); + }; - import AreaChartWrapper from './area-chart'; - export { AreaChartWrapper }; - + ElementWrapper.prototype.findAnchorNavigationByTestId = function(testId) { + const selector = \`.\${AnchorNavigationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AnchorNavigationWrapper); + }; - import AttributeEditorWrapper from './attribute-editor'; - export { AttributeEditorWrapper }; - + ElementWrapper.prototype.findAnnotation = function(selector) { + const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); + }; - import AutosuggestWrapper from './autosuggest'; - export { AutosuggestWrapper }; - + ElementWrapper.prototype.findAllAnnotations = function(selector) { + return this.findAllComponents(AnnotationWrapper, selector); + }; - import BadgeWrapper from './badge'; - export { BadgeWrapper }; - + ElementWrapper.prototype.findAnnotationByTestId = function(testId) { + const selector = \`.\${AnnotationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AnnotationWrapper); + }; - import BarChartWrapper from './bar-chart'; - export { BarChartWrapper }; - + ElementWrapper.prototype.findAppLayout = function(selector) { + const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); + }; - import BoxWrapper from './box'; - export { BoxWrapper }; - + ElementWrapper.prototype.findAreaChart = function(selector) { + const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); + }; - import BreadcrumbGroupWrapper from './breadcrumb-group'; - export { BreadcrumbGroupWrapper }; - + ElementWrapper.prototype.findAllAreaCharts = function(selector) { + return this.findAllComponents(AreaChartWrapper, selector); + }; - import ButtonWrapper from './button'; - export { ButtonWrapper }; - + ElementWrapper.prototype.findAreaChartByTestId = function(testId) { + const selector = \`.\${AreaChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AreaChartWrapper); + }; - import ButtonDropdownWrapper from './button-dropdown'; - export { ButtonDropdownWrapper }; - + ElementWrapper.prototype.findAttributeEditor = function(selector) { + const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); + }; - import ButtonGroupWrapper from './button-group'; - export { ButtonGroupWrapper }; - + ElementWrapper.prototype.findAllAttributeEditors = function(selector) { + return this.findAllComponents(AttributeEditorWrapper, selector); + }; - import CalendarWrapper from './calendar'; - export { CalendarWrapper }; - + ElementWrapper.prototype.findAttributeEditorByTestId = function(testId) { + const selector = \`.\${AttributeEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AttributeEditorWrapper); + }; - import CardsWrapper from './cards'; - export { CardsWrapper }; - + ElementWrapper.prototype.findAutosuggest = function(selector) { + const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); + }; - import CheckboxWrapper from './checkbox'; - export { CheckboxWrapper }; - + ElementWrapper.prototype.findAllAutosuggests = function(selector) { + return this.findAllComponents(AutosuggestWrapper, selector); + }; - import CodeEditorWrapper from './code-editor'; - export { CodeEditorWrapper }; - + ElementWrapper.prototype.findAutosuggestByTestId = function(testId) { + const selector = \`.\${AutosuggestWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AutosuggestWrapper); + }; - import CollectionPreferencesWrapper from './collection-preferences'; - export { CollectionPreferencesWrapper }; - + ElementWrapper.prototype.findBadge = function(selector) { + const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); + }; - import ColumnLayoutWrapper from './column-layout'; - export { ColumnLayoutWrapper }; - + ElementWrapper.prototype.findAllBadges = function(selector) { + return this.findAllComponents(BadgeWrapper, selector); + }; - import ContainerWrapper from './container'; - export { ContainerWrapper }; - + ElementWrapper.prototype.findBadgeByTestId = function(testId) { + const selector = \`.\${BadgeWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BadgeWrapper); + }; - import ContentLayoutWrapper from './content-layout'; - export { ContentLayoutWrapper }; - + ElementWrapper.prototype.findBarChart = function(selector) { + const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); + }; - import CopyToClipboardWrapper from './copy-to-clipboard'; - export { CopyToClipboardWrapper }; - + ElementWrapper.prototype.findAllBarCharts = function(selector) { + return this.findAllComponents(BarChartWrapper, selector); + }; - import DateInputWrapper from './date-input'; - export { DateInputWrapper }; - + ElementWrapper.prototype.findBarChartByTestId = function(testId) { + const selector = \`.\${BarChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BarChartWrapper); + }; - import DatePickerWrapper from './date-picker'; - export { DatePickerWrapper }; - + ElementWrapper.prototype.findBox = function(selector) { + const rootSelector = \`.\${BoxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); + }; - import DateRangePickerWrapper from './date-range-picker'; - export { DateRangePickerWrapper }; - + ElementWrapper.prototype.findAllBoxes = function(selector) { + return this.findAllComponents(BoxWrapper, selector); + }; - import DrawerWrapper from './drawer'; - export { DrawerWrapper }; - + ElementWrapper.prototype.findBoxByTestId = function(testId) { + const selector = \`.\${BoxWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BoxWrapper); + }; - import ExpandableSectionWrapper from './expandable-section'; - export { ExpandableSectionWrapper }; - + ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { + const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); + }; - import FileUploadWrapper from './file-upload'; - export { FileUploadWrapper }; - + ElementWrapper.prototype.findAllBreadcrumbGroups = function(selector) { + return this.findAllComponents(BreadcrumbGroupWrapper, selector); + }; - import FlashbarWrapper from './flashbar'; - export { FlashbarWrapper }; - + ElementWrapper.prototype.findBreadcrumbGroupByTestId = function(testId) { + const selector = \`.\${BreadcrumbGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BreadcrumbGroupWrapper); + }; - import FormWrapper from './form'; - export { FormWrapper }; - + ElementWrapper.prototype.findButton = function(selector) { + const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); + }; - import FormFieldWrapper from './form-field'; - export { FormFieldWrapper }; - + ElementWrapper.prototype.findAllButtons = function(selector) { + return this.findAllComponents(ButtonWrapper, selector); + }; - import GridWrapper from './grid'; - export { GridWrapper }; - + ElementWrapper.prototype.findButtonByTestId = function(testId) { + const selector = \`.\${ButtonWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonWrapper); + }; - import HeaderWrapper from './header'; - export { HeaderWrapper }; - + ElementWrapper.prototype.findButtonDropdown = function(selector) { + const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); + }; - import HelpPanelWrapper from './help-panel'; - export { HelpPanelWrapper }; - + ElementWrapper.prototype.findAllButtonDropdowns = function(selector) { + return this.findAllComponents(ButtonDropdownWrapper, selector); + }; - import HotspotWrapper from './hotspot'; - export { HotspotWrapper }; - + ElementWrapper.prototype.findButtonDropdownByTestId = function(testId) { + const selector = \`.\${ButtonDropdownWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonDropdownWrapper); + }; - import IconWrapper from './icon'; - export { IconWrapper }; - + ElementWrapper.prototype.findButtonGroup = function(selector) { + const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); + }; - import InputWrapper from './input'; - export { InputWrapper }; - + ElementWrapper.prototype.findAllButtonGroups = function(selector) { + return this.findAllComponents(ButtonGroupWrapper, selector); + }; - import KeyValuePairsWrapper from './key-value-pairs'; - export { KeyValuePairsWrapper }; - + ElementWrapper.prototype.findButtonGroupByTestId = function(testId) { + const selector = \`.\${ButtonGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonGroupWrapper); + }; - import LineChartWrapper from './line-chart'; - export { LineChartWrapper }; - + ElementWrapper.prototype.findCalendar = function(selector) { + const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); + }; - import LinkWrapper from './link'; - export { LinkWrapper }; - + ElementWrapper.prototype.findAllCalendars = function(selector) { + return this.findAllComponents(CalendarWrapper, selector); + }; - import LiveRegionWrapper from './live-region'; - export { LiveRegionWrapper }; - + ElementWrapper.prototype.findCalendarByTestId = function(testId) { + const selector = \`.\${CalendarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CalendarWrapper); + }; - import MixedLineBarChartWrapper from './mixed-line-bar-chart'; - export { MixedLineBarChartWrapper }; - + ElementWrapper.prototype.findCards = function(selector) { + const rootSelector = \`.\${CardsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); + }; - import ModalWrapper from './modal'; - export { ModalWrapper }; - + ElementWrapper.prototype.findAllCards = function(selector) { + return this.findAllComponents(CardsWrapper, selector); + }; - import MultiselectWrapper from './multiselect'; - export { MultiselectWrapper }; - + ElementWrapper.prototype.findCardsByTestId = function(testId) { + const selector = \`.\${CardsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CardsWrapper); + }; - import PaginationWrapper from './pagination'; - export { PaginationWrapper }; - + ElementWrapper.prototype.findCheckbox = function(selector) { + const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); + }; - import PieChartWrapper from './pie-chart'; - export { PieChartWrapper }; - + ElementWrapper.prototype.findAllCheckboxes = function(selector) { + return this.findAllComponents(CheckboxWrapper, selector); + }; - import PopoverWrapper from './popover'; - export { PopoverWrapper }; - + ElementWrapper.prototype.findCheckboxByTestId = function(testId) { + const selector = \`.\${CheckboxWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CheckboxWrapper); + }; - import ProgressBarWrapper from './progress-bar'; - export { ProgressBarWrapper }; - + ElementWrapper.prototype.findCodeEditor = function(selector) { + const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); + }; - import PromptInputWrapper from './prompt-input'; - export { PromptInputWrapper }; - + ElementWrapper.prototype.findAllCodeEditors = function(selector) { + return this.findAllComponents(CodeEditorWrapper, selector); + }; - import PropertyFilterWrapper from './property-filter'; - export { PropertyFilterWrapper }; - + ElementWrapper.prototype.findCodeEditorByTestId = function(testId) { + const selector = \`.\${CodeEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CodeEditorWrapper); + }; - import RadioGroupWrapper from './radio-group'; - export { RadioGroupWrapper }; - + ElementWrapper.prototype.findCollectionPreferences = function(selector) { + const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); + }; - import S3ResourceSelectorWrapper from './s3-resource-selector'; - export { S3ResourceSelectorWrapper }; - + ElementWrapper.prototype.findAllCollectionPreferences = function(selector) { + return this.findAllComponents(CollectionPreferencesWrapper, selector); + }; - import SegmentedControlWrapper from './segmented-control'; - export { SegmentedControlWrapper }; - + ElementWrapper.prototype.findCollectionPreferencesByTestId = function(testId) { + const selector = \`.\${CollectionPreferencesWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CollectionPreferencesWrapper); + }; - import SelectWrapper from './select'; - export { SelectWrapper }; - + ElementWrapper.prototype.findColumnLayout = function(selector) { + const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); + }; - import SideNavigationWrapper from './side-navigation'; - export { SideNavigationWrapper }; - + ElementWrapper.prototype.findAllColumnLayouts = function(selector) { + return this.findAllComponents(ColumnLayoutWrapper, selector); + }; - import SliderWrapper from './slider'; - export { SliderWrapper }; - + ElementWrapper.prototype.findColumnLayoutByTestId = function(testId) { + const selector = \`.\${ColumnLayoutWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ColumnLayoutWrapper); + }; - import SpaceBetweenWrapper from './space-between'; - export { SpaceBetweenWrapper }; - + ElementWrapper.prototype.findContainer = function(selector) { + const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); + }; - import SpinnerWrapper from './spinner'; - export { SpinnerWrapper }; - + ElementWrapper.prototype.findAllContainers = function(selector) { + return this.findAllComponents(ContainerWrapper, selector); + }; - import SplitPanelWrapper from './split-panel'; - export { SplitPanelWrapper }; - + ElementWrapper.prototype.findContainerByTestId = function(testId) { + const selector = \`.\${ContainerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ContainerWrapper); + }; - import StatusIndicatorWrapper from './status-indicator'; - export { StatusIndicatorWrapper }; - + ElementWrapper.prototype.findContentLayout = function(selector) { + const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); + }; - import StepsWrapper from './steps'; - export { StepsWrapper }; - + ElementWrapper.prototype.findAllContentLayouts = function(selector) { + return this.findAllComponents(ContentLayoutWrapper, selector); + }; - import TableWrapper from './table'; - export { TableWrapper }; - + ElementWrapper.prototype.findContentLayoutByTestId = function(testId) { + const selector = \`.\${ContentLayoutWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ContentLayoutWrapper); + }; - import TabsWrapper from './tabs'; - export { TabsWrapper }; - + ElementWrapper.prototype.findCopyToClipboard = function(selector) { + const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); + }; - import TagEditorWrapper from './tag-editor'; - export { TagEditorWrapper }; - + ElementWrapper.prototype.findAllCopyToClipboards = function(selector) { + return this.findAllComponents(CopyToClipboardWrapper, selector); + }; - import TextContentWrapper from './text-content'; - export { TextContentWrapper }; - + ElementWrapper.prototype.findCopyToClipboardByTestId = function(testId) { + const selector = \`.\${CopyToClipboardWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CopyToClipboardWrapper); + }; - import TextFilterWrapper from './text-filter'; - export { TextFilterWrapper }; - + ElementWrapper.prototype.findDateInput = function(selector) { + const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); + }; - import TextareaWrapper from './textarea'; - export { TextareaWrapper }; - + ElementWrapper.prototype.findAllDateInputs = function(selector) { + return this.findAllComponents(DateInputWrapper, selector); + }; + + ElementWrapper.prototype.findDateInputByTestId = function(testId) { + const selector = \`.\${DateInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DateInputWrapper); + }; + + ElementWrapper.prototype.findDatePicker = function(selector) { + const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); + }; + + ElementWrapper.prototype.findAllDatePickers = function(selector) { + return this.findAllComponents(DatePickerWrapper, selector); + }; + + ElementWrapper.prototype.findDatePickerByTestId = function(testId) { + const selector = \`.\${DatePickerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DatePickerWrapper); + }; + + ElementWrapper.prototype.findDateRangePicker = function(selector) { + const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); + }; + + ElementWrapper.prototype.findAllDateRangePickers = function(selector) { + return this.findAllComponents(DateRangePickerWrapper, selector); + }; + + ElementWrapper.prototype.findDateRangePickerByTestId = function(testId) { + const selector = \`.\${DateRangePickerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DateRangePickerWrapper); + }; + + ElementWrapper.prototype.findDrawer = function(selector) { + const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); + }; + + ElementWrapper.prototype.findAllDrawers = function(selector) { + return this.findAllComponents(DrawerWrapper, selector); + }; + + ElementWrapper.prototype.findDrawerByTestId = function(testId) { + const selector = \`.\${DrawerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DrawerWrapper); + }; + + ElementWrapper.prototype.findExpandableSection = function(selector) { + const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); + }; + + ElementWrapper.prototype.findAllExpandableSections = function(selector) { + return this.findAllComponents(ExpandableSectionWrapper, selector); + }; + + ElementWrapper.prototype.findExpandableSectionByTestId = function(testId) { + const selector = \`.\${ExpandableSectionWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ExpandableSectionWrapper); + }; + + ElementWrapper.prototype.findFileUpload = function(selector) { + const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); + }; + + ElementWrapper.prototype.findAllFileUploads = function(selector) { + return this.findAllComponents(FileUploadWrapper, selector); + }; + + ElementWrapper.prototype.findFileUploadByTestId = function(testId) { + const selector = \`.\${FileUploadWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FileUploadWrapper); + }; + + ElementWrapper.prototype.findFlashbar = function(selector) { + const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); + }; + + ElementWrapper.prototype.findAllFlashbars = function(selector) { + return this.findAllComponents(FlashbarWrapper, selector); + }; + + ElementWrapper.prototype.findFlashbarByTestId = function(testId) { + const selector = \`.\${FlashbarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FlashbarWrapper); + }; + + ElementWrapper.prototype.findForm = function(selector) { + const rootSelector = \`.\${FormWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); + }; + + ElementWrapper.prototype.findAllForms = function(selector) { + return this.findAllComponents(FormWrapper, selector); + }; + + ElementWrapper.prototype.findFormByTestId = function(testId) { + const selector = \`.\${FormWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FormWrapper); + }; + + ElementWrapper.prototype.findFormField = function(selector) { + const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); + }; + + ElementWrapper.prototype.findAllFormFields = function(selector) { + return this.findAllComponents(FormFieldWrapper, selector); + }; + + ElementWrapper.prototype.findFormFieldByTestId = function(testId) { + const selector = \`.\${FormFieldWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FormFieldWrapper); + }; + + ElementWrapper.prototype.findGrid = function(selector) { + const rootSelector = \`.\${GridWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); + }; + + ElementWrapper.prototype.findAllGrids = function(selector) { + return this.findAllComponents(GridWrapper, selector); + }; + + ElementWrapper.prototype.findGridByTestId = function(testId) { + const selector = \`.\${GridWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, GridWrapper); + }; + + ElementWrapper.prototype.findHeader = function(selector) { + const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); + }; + + ElementWrapper.prototype.findAllHeaders = function(selector) { + return this.findAllComponents(HeaderWrapper, selector); + }; + + ElementWrapper.prototype.findHeaderByTestId = function(testId) { + const selector = \`.\${HeaderWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HeaderWrapper); + }; + + ElementWrapper.prototype.findHelpPanel = function(selector) { + const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); + }; + + ElementWrapper.prototype.findAllHelpPanels = function(selector) { + return this.findAllComponents(HelpPanelWrapper, selector); + }; + + ElementWrapper.prototype.findHelpPanelByTestId = function(testId) { + const selector = \`.\${HelpPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HelpPanelWrapper); + }; + + ElementWrapper.prototype.findHotspot = function(selector) { + const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); + }; + + ElementWrapper.prototype.findAllHotspots = function(selector) { + return this.findAllComponents(HotspotWrapper, selector); + }; + + ElementWrapper.prototype.findHotspotByTestId = function(testId) { + const selector = \`.\${HotspotWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HotspotWrapper); + }; + + ElementWrapper.prototype.findIcon = function(selector) { + const rootSelector = \`.\${IconWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); + }; + + ElementWrapper.prototype.findAllIcons = function(selector) { + return this.findAllComponents(IconWrapper, selector); + }; + + ElementWrapper.prototype.findIconByTestId = function(testId) { + const selector = \`.\${IconWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, IconWrapper); + }; + + ElementWrapper.prototype.findInput = function(selector) { + const rootSelector = \`.\${InputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); + }; + + ElementWrapper.prototype.findAllInputs = function(selector) { + return this.findAllComponents(InputWrapper, selector); + }; + + ElementWrapper.prototype.findInputByTestId = function(testId) { + const selector = \`.\${InputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, InputWrapper); + }; + + ElementWrapper.prototype.findKeyValuePairs = function(selector) { + const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); + }; + + ElementWrapper.prototype.findAllKeyValuePairs = function(selector) { + return this.findAllComponents(KeyValuePairsWrapper, selector); + }; + + ElementWrapper.prototype.findKeyValuePairsByTestId = function(testId) { + const selector = \`.\${KeyValuePairsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, KeyValuePairsWrapper); + }; + + ElementWrapper.prototype.findLineChart = function(selector) { + const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); + }; + + ElementWrapper.prototype.findAllLineCharts = function(selector) { + return this.findAllComponents(LineChartWrapper, selector); + }; + + ElementWrapper.prototype.findLineChartByTestId = function(testId) { + const selector = \`.\${LineChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LineChartWrapper); + }; + + ElementWrapper.prototype.findLink = function(selector) { + const rootSelector = \`.\${LinkWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); + }; + + ElementWrapper.prototype.findAllLinks = function(selector) { + return this.findAllComponents(LinkWrapper, selector); + }; + + ElementWrapper.prototype.findLinkByTestId = function(testId) { + const selector = \`.\${LinkWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LinkWrapper); + }; + + ElementWrapper.prototype.findLiveRegion = function(selector) { + const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); + }; + + ElementWrapper.prototype.findAllLiveRegions = function(selector) { + return this.findAllComponents(LiveRegionWrapper, selector); + }; + + ElementWrapper.prototype.findLiveRegionByTestId = function(testId) { + const selector = \`.\${LiveRegionWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LiveRegionWrapper); + }; + + ElementWrapper.prototype.findMixedLineBarChart = function(selector) { + const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); + }; + + ElementWrapper.prototype.findAllMixedLineBarCharts = function(selector) { + return this.findAllComponents(MixedLineBarChartWrapper, selector); + }; + + ElementWrapper.prototype.findMixedLineBarChartByTestId = function(testId) { + const selector = \`.\${MixedLineBarChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, MixedLineBarChartWrapper); + }; + + ElementWrapper.prototype.findModal = function(selector) { + const rootSelector = \`.\${ModalWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); + }; + + ElementWrapper.prototype.findAllModals = function(selector) { + return this.findAllComponents(ModalWrapper, selector); + }; + + ElementWrapper.prototype.findModalByTestId = function(testId) { + const selector = \`.\${ModalWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ModalWrapper); + }; + + ElementWrapper.prototype.findMultiselect = function(selector) { + const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); + }; + + ElementWrapper.prototype.findAllMultiselects = function(selector) { + return this.findAllComponents(MultiselectWrapper, selector); + }; + + ElementWrapper.prototype.findMultiselectByTestId = function(testId) { + const selector = \`.\${MultiselectWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, MultiselectWrapper); + }; + + ElementWrapper.prototype.findPagination = function(selector) { + const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); + }; + + ElementWrapper.prototype.findAllPaginations = function(selector) { + return this.findAllComponents(PaginationWrapper, selector); + }; + + ElementWrapper.prototype.findPaginationByTestId = function(testId) { + const selector = \`.\${PaginationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PaginationWrapper); + }; + + ElementWrapper.prototype.findPieChart = function(selector) { + const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); + }; + + ElementWrapper.prototype.findAllPieCharts = function(selector) { + return this.findAllComponents(PieChartWrapper, selector); + }; + + ElementWrapper.prototype.findPieChartByTestId = function(testId) { + const selector = \`.\${PieChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PieChartWrapper); + }; + + ElementWrapper.prototype.findPopover = function(selector) { + const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); + }; + + ElementWrapper.prototype.findAllPopovers = function(selector) { + return this.findAllComponents(PopoverWrapper, selector); + }; + + ElementWrapper.prototype.findPopoverByTestId = function(testId) { + const selector = \`.\${PopoverWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PopoverWrapper); + }; + + ElementWrapper.prototype.findProgressBar = function(selector) { + const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); + }; + + ElementWrapper.prototype.findAllProgressBars = function(selector) { + return this.findAllComponents(ProgressBarWrapper, selector); + }; + + ElementWrapper.prototype.findProgressBarByTestId = function(testId) { + const selector = \`.\${ProgressBarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ProgressBarWrapper); + }; + + ElementWrapper.prototype.findPromptInput = function(selector) { + const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); + }; + + ElementWrapper.prototype.findAllPromptInputs = function(selector) { + return this.findAllComponents(PromptInputWrapper, selector); + }; + + ElementWrapper.prototype.findPromptInputByTestId = function(testId) { + const selector = \`.\${PromptInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PromptInputWrapper); + }; + + ElementWrapper.prototype.findPropertyFilter = function(selector) { + const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); + }; + + ElementWrapper.prototype.findAllPropertyFilters = function(selector) { + return this.findAllComponents(PropertyFilterWrapper, selector); + }; + + ElementWrapper.prototype.findPropertyFilterByTestId = function(testId) { + const selector = \`.\${PropertyFilterWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PropertyFilterWrapper); + }; + + ElementWrapper.prototype.findRadioGroup = function(selector) { + const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); + }; + + ElementWrapper.prototype.findAllRadioGroups = function(selector) { + return this.findAllComponents(RadioGroupWrapper, selector); + }; + + ElementWrapper.prototype.findRadioGroupByTestId = function(testId) { + const selector = \`.\${RadioGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, RadioGroupWrapper); + }; + + ElementWrapper.prototype.findS3ResourceSelector = function(selector) { + const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); + }; + + ElementWrapper.prototype.findAllS3ResourceSelectors = function(selector) { + return this.findAllComponents(S3ResourceSelectorWrapper, selector); + }; + + ElementWrapper.prototype.findS3ResourceSelectorByTestId = function(testId) { + const selector = \`.\${S3ResourceSelectorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, S3ResourceSelectorWrapper); + }; + + ElementWrapper.prototype.findSegmentedControl = function(selector) { + const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); + }; + + ElementWrapper.prototype.findAllSegmentedControls = function(selector) { + return this.findAllComponents(SegmentedControlWrapper, selector); + }; + + ElementWrapper.prototype.findSegmentedControlByTestId = function(testId) { + const selector = \`.\${SegmentedControlWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SegmentedControlWrapper); + }; + + ElementWrapper.prototype.findSelect = function(selector) { + const rootSelector = \`.\${SelectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); + }; + + ElementWrapper.prototype.findAllSelects = function(selector) { + return this.findAllComponents(SelectWrapper, selector); + }; + + ElementWrapper.prototype.findSelectByTestId = function(testId) { + const selector = \`.\${SelectWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SelectWrapper); + }; + + ElementWrapper.prototype.findSideNavigation = function(selector) { + const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); + }; + + ElementWrapper.prototype.findAllSideNavigations = function(selector) { + return this.findAllComponents(SideNavigationWrapper, selector); + }; + + ElementWrapper.prototype.findSideNavigationByTestId = function(testId) { + const selector = \`.\${SideNavigationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SideNavigationWrapper); + }; + + ElementWrapper.prototype.findSlider = function(selector) { + const rootSelector = \`.\${SliderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); + }; + + ElementWrapper.prototype.findAllSliders = function(selector) { + return this.findAllComponents(SliderWrapper, selector); + }; + + ElementWrapper.prototype.findSliderByTestId = function(testId) { + const selector = \`.\${SliderWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SliderWrapper); + }; + + ElementWrapper.prototype.findSpaceBetween = function(selector) { + const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); + }; + + ElementWrapper.prototype.findAllSpaceBetweens = function(selector) { + return this.findAllComponents(SpaceBetweenWrapper, selector); + }; + + ElementWrapper.prototype.findSpaceBetweenByTestId = function(testId) { + const selector = \`.\${SpaceBetweenWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SpaceBetweenWrapper); + }; + + ElementWrapper.prototype.findSpinner = function(selector) { + const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); + }; + + ElementWrapper.prototype.findAllSpinners = function(selector) { + return this.findAllComponents(SpinnerWrapper, selector); + }; + + ElementWrapper.prototype.findSpinnerByTestId = function(testId) { + const selector = \`.\${SpinnerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SpinnerWrapper); + }; + + ElementWrapper.prototype.findSplitPanel = function(selector) { + const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); + }; + + ElementWrapper.prototype.findAllSplitPanels = function(selector) { + return this.findAllComponents(SplitPanelWrapper, selector); + }; + + ElementWrapper.prototype.findSplitPanelByTestId = function(testId) { + const selector = \`.\${SplitPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SplitPanelWrapper); + }; + + ElementWrapper.prototype.findStatusIndicator = function(selector) { + const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); + }; + + ElementWrapper.prototype.findAllStatusIndicators = function(selector) { + return this.findAllComponents(StatusIndicatorWrapper, selector); + }; + + ElementWrapper.prototype.findStatusIndicatorByTestId = function(testId) { + const selector = \`.\${StatusIndicatorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, StatusIndicatorWrapper); + }; + + ElementWrapper.prototype.findSteps = function(selector) { + const rootSelector = \`.\${StepsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); + }; + + ElementWrapper.prototype.findAllSteps = function(selector) { + return this.findAllComponents(StepsWrapper, selector); + }; + + ElementWrapper.prototype.findStepsByTestId = function(testId) { + const selector = \`.\${StepsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, StepsWrapper); + }; + + ElementWrapper.prototype.findTable = function(selector) { + const rootSelector = \`.\${TableWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); + }; + + ElementWrapper.prototype.findAllTables = function(selector) { + return this.findAllComponents(TableWrapper, selector); + }; + + ElementWrapper.prototype.findTableByTestId = function(testId) { + const selector = \`.\${TableWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TableWrapper); + }; + + ElementWrapper.prototype.findTabs = function(selector) { + const rootSelector = \`.\${TabsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); + }; + + ElementWrapper.prototype.findAllTabs = function(selector) { + return this.findAllComponents(TabsWrapper, selector); + }; + + ElementWrapper.prototype.findTabsByTestId = function(testId) { + const selector = \`.\${TabsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TabsWrapper); + }; + + ElementWrapper.prototype.findTagEditor = function(selector) { + const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); + }; + + ElementWrapper.prototype.findAllTagEditors = function(selector) { + return this.findAllComponents(TagEditorWrapper, selector); + }; + + ElementWrapper.prototype.findTagEditorByTestId = function(testId) { + const selector = \`.\${TagEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TagEditorWrapper); + }; + + ElementWrapper.prototype.findTextContent = function(selector) { + const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); + }; + + ElementWrapper.prototype.findAllTextContents = function(selector) { + return this.findAllComponents(TextContentWrapper, selector); + }; + + ElementWrapper.prototype.findTextContentByTestId = function(testId) { + const selector = \`.\${TextContentWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextContentWrapper); + }; + + ElementWrapper.prototype.findTextFilter = function(selector) { + const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); + }; + + ElementWrapper.prototype.findAllTextFilters = function(selector) { + return this.findAllComponents(TextFilterWrapper, selector); + }; + + ElementWrapper.prototype.findTextFilterByTestId = function(testId) { + const selector = \`.\${TextFilterWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextFilterWrapper); + }; + + ElementWrapper.prototype.findTextarea = function(selector) { + const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); + }; + + ElementWrapper.prototype.findAllTextareas = function(selector) { + return this.findAllComponents(TextareaWrapper, selector); + }; + + ElementWrapper.prototype.findTextareaByTestId = function(testId) { + const selector = \`.\${TextareaWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextareaWrapper); + }; + + ElementWrapper.prototype.findTiles = function(selector) { + const rootSelector = \`.\${TilesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); + }; + + ElementWrapper.prototype.findAllTiles = function(selector) { + return this.findAllComponents(TilesWrapper, selector); + }; + + ElementWrapper.prototype.findTilesByTestId = function(testId) { + const selector = \`.\${TilesWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TilesWrapper); + }; + + ElementWrapper.prototype.findTimeInput = function(selector) { + const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); + }; + + ElementWrapper.prototype.findAllTimeInputs = function(selector) { + return this.findAllComponents(TimeInputWrapper, selector); + }; + + ElementWrapper.prototype.findTimeInputByTestId = function(testId) { + const selector = \`.\${TimeInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TimeInputWrapper); + }; + + ElementWrapper.prototype.findToggle = function(selector) { + const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); + }; + + ElementWrapper.prototype.findAllToggles = function(selector) { + return this.findAllComponents(ToggleWrapper, selector); + }; + + ElementWrapper.prototype.findToggleByTestId = function(testId) { + const selector = \`.\${ToggleWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ToggleWrapper); + }; + + ElementWrapper.prototype.findToggleButton = function(selector) { + const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); + }; + + ElementWrapper.prototype.findAllToggleButtons = function(selector) { + return this.findAllComponents(ToggleButtonWrapper, selector); + }; + + ElementWrapper.prototype.findToggleButtonByTestId = function(testId) { + const selector = \`.\${ToggleButtonWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ToggleButtonWrapper); + }; + + ElementWrapper.prototype.findTokenGroup = function(selector) { + const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); + }; + + ElementWrapper.prototype.findAllTokenGroups = function(selector) { + return this.findAllComponents(TokenGroupWrapper, selector); + }; + + ElementWrapper.prototype.findTokenGroupByTestId = function(testId) { + const selector = \`.\${TokenGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TokenGroupWrapper); + }; + + ElementWrapper.prototype.findTopNavigation = function(selector) { + const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); + }; + + ElementWrapper.prototype.findTutorialPanel = function(selector) { + const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); + }; + + ElementWrapper.prototype.findAllTutorialPanels = function(selector) { + return this.findAllComponents(TutorialPanelWrapper, selector); + }; + + ElementWrapper.prototype.findTutorialPanelByTestId = function(testId) { + const selector = \`.\${TutorialPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TutorialPanelWrapper); + }; + + ElementWrapper.prototype.findWizard = function(selector) { + const rootSelector = \`.\${WizardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); + }; + + ElementWrapper.prototype.findAllWizards = function(selector) { + return this.findAllComponents(WizardWrapper, selector); + }; + + ElementWrapper.prototype.findWizardByTestId = function(testId) { + const selector = \`.\${WizardWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, WizardWrapper); + }; +export default function wrapper(root: Element = document.body) { if (document && document.body && !document.body.contains(root)) { console.warn('[AwsUi] [test-utils] provided element is not part of the document body, interactions may work incorrectly')}; return new ElementWrapper(root); }" +`; + +exports[`Generate test utils ElementWrapper selectors ElementWrapper matches the snapshot 1`] = ` +"import { ElementWrapper } from '@cloudscape-design/test-utils-core/selectors'; +import { appendSelector } from '@cloudscape-design/test-utils-core/utils'; +export { ElementWrapper }; + + import AlertWrapper from './alert'; + export { AlertWrapper }; + + + import AnchorNavigationWrapper from './anchor-navigation'; + export { AnchorNavigationWrapper }; + + + import AnnotationWrapper from './annotation'; + export { AnnotationWrapper }; + + + import AppLayoutWrapper from './app-layout'; + export { AppLayoutWrapper }; + + + import AreaChartWrapper from './area-chart'; + export { AreaChartWrapper }; + + + import AttributeEditorWrapper from './attribute-editor'; + export { AttributeEditorWrapper }; + + + import AutosuggestWrapper from './autosuggest'; + export { AutosuggestWrapper }; + + + import BadgeWrapper from './badge'; + export { BadgeWrapper }; + + + import BarChartWrapper from './bar-chart'; + export { BarChartWrapper }; + + + import BoxWrapper from './box'; + export { BoxWrapper }; + + + import BreadcrumbGroupWrapper from './breadcrumb-group'; + export { BreadcrumbGroupWrapper }; + + + import ButtonWrapper from './button'; + export { ButtonWrapper }; + + + import ButtonDropdownWrapper from './button-dropdown'; + export { ButtonDropdownWrapper }; + + + import ButtonGroupWrapper from './button-group'; + export { ButtonGroupWrapper }; + + + import CalendarWrapper from './calendar'; + export { CalendarWrapper }; + + + import CardsWrapper from './cards'; + export { CardsWrapper }; + + + import CheckboxWrapper from './checkbox'; + export { CheckboxWrapper }; + + + import CodeEditorWrapper from './code-editor'; + export { CodeEditorWrapper }; + + + import CollectionPreferencesWrapper from './collection-preferences'; + export { CollectionPreferencesWrapper }; + + + import ColumnLayoutWrapper from './column-layout'; + export { ColumnLayoutWrapper }; + + + import ContainerWrapper from './container'; + export { ContainerWrapper }; + + + import ContentLayoutWrapper from './content-layout'; + export { ContentLayoutWrapper }; + + + import CopyToClipboardWrapper from './copy-to-clipboard'; + export { CopyToClipboardWrapper }; + + + import DateInputWrapper from './date-input'; + export { DateInputWrapper }; + + + import DatePickerWrapper from './date-picker'; + export { DatePickerWrapper }; + + + import DateRangePickerWrapper from './date-range-picker'; + export { DateRangePickerWrapper }; + + + import DrawerWrapper from './drawer'; + export { DrawerWrapper }; + + + import ExpandableSectionWrapper from './expandable-section'; + export { ExpandableSectionWrapper }; + + + import FileUploadWrapper from './file-upload'; + export { FileUploadWrapper }; + + + import FlashbarWrapper from './flashbar'; + export { FlashbarWrapper }; + + + import FormWrapper from './form'; + export { FormWrapper }; + + + import FormFieldWrapper from './form-field'; + export { FormFieldWrapper }; + + + import GridWrapper from './grid'; + export { GridWrapper }; + + + import HeaderWrapper from './header'; + export { HeaderWrapper }; + + + import HelpPanelWrapper from './help-panel'; + export { HelpPanelWrapper }; + + + import HotspotWrapper from './hotspot'; + export { HotspotWrapper }; + + + import IconWrapper from './icon'; + export { IconWrapper }; + + + import InputWrapper from './input'; + export { InputWrapper }; + + + import KeyValuePairsWrapper from './key-value-pairs'; + export { KeyValuePairsWrapper }; + + + import LineChartWrapper from './line-chart'; + export { LineChartWrapper }; + + + import LinkWrapper from './link'; + export { LinkWrapper }; + + + import LiveRegionWrapper from './live-region'; + export { LiveRegionWrapper }; + + + import MixedLineBarChartWrapper from './mixed-line-bar-chart'; + export { MixedLineBarChartWrapper }; + + + import ModalWrapper from './modal'; + export { ModalWrapper }; + + + import MultiselectWrapper from './multiselect'; + export { MultiselectWrapper }; + + + import PaginationWrapper from './pagination'; + export { PaginationWrapper }; + + + import PieChartWrapper from './pie-chart'; + export { PieChartWrapper }; + + + import PopoverWrapper from './popover'; + export { PopoverWrapper }; + + + import ProgressBarWrapper from './progress-bar'; + export { ProgressBarWrapper }; + + + import PromptInputWrapper from './prompt-input'; + export { PromptInputWrapper }; + + + import PropertyFilterWrapper from './property-filter'; + export { PropertyFilterWrapper }; + + + import RadioGroupWrapper from './radio-group'; + export { RadioGroupWrapper }; + + + import S3ResourceSelectorWrapper from './s3-resource-selector'; + export { S3ResourceSelectorWrapper }; + + + import SegmentedControlWrapper from './segmented-control'; + export { SegmentedControlWrapper }; + + + import SelectWrapper from './select'; + export { SelectWrapper }; + + + import SideNavigationWrapper from './side-navigation'; + export { SideNavigationWrapper }; + + + import SliderWrapper from './slider'; + export { SliderWrapper }; + + + import SpaceBetweenWrapper from './space-between'; + export { SpaceBetweenWrapper }; + + + import SpinnerWrapper from './spinner'; + export { SpinnerWrapper }; + + + import SplitPanelWrapper from './split-panel'; + export { SplitPanelWrapper }; + + + import StatusIndicatorWrapper from './status-indicator'; + export { StatusIndicatorWrapper }; + + + import StepsWrapper from './steps'; + export { StepsWrapper }; + + + import TableWrapper from './table'; + export { TableWrapper }; + + + import TabsWrapper from './tabs'; + export { TabsWrapper }; + + + import TagEditorWrapper from './tag-editor'; + export { TagEditorWrapper }; + + + import TextContentWrapper from './text-content'; + export { TextContentWrapper }; + + + import TextFilterWrapper from './text-filter'; + export { TextFilterWrapper }; + + + import TextareaWrapper from './textarea'; + export { TextareaWrapper }; + import TilesWrapper from './tiles'; export { TilesWrapper }; - import TimeInputWrapper from './time-input'; - export { TimeInputWrapper }; - + import TimeInputWrapper from './time-input'; + export { TimeInputWrapper }; + + + import ToggleWrapper from './toggle'; + export { ToggleWrapper }; + + + import ToggleButtonWrapper from './toggle-button'; + export { ToggleButtonWrapper }; + + + import TokenGroupWrapper from './token-group'; + export { TokenGroupWrapper }; + + + import TopNavigationWrapper from './top-navigation'; + export { TopNavigationWrapper }; + + + import TutorialPanelWrapper from './tutorial-panel'; + export { TutorialPanelWrapper }; + + + import WizardWrapper from './wizard'; + export { WizardWrapper }; + +declare module '@cloudscape-design/test-utils-core/dist/selectors' { + interface ElementWrapper { + + /** + * Returns a wrapper that matches the Alerts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Alerts. + * + * @param {string} [selector] CSS Selector + * @returns {AlertWrapper} + */ + findAlert(selector?: string): AlertWrapper; + + /** + * Returns a multi-element wrapper that matches Alerts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Alerts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAlerts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Alert with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AlertWrapper} + */ + findAlertByTestId(testId: string): AlertWrapper; + + /** + * Returns a wrapper that matches the AnchorNavigations with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches AnchorNavigations. + * + * @param {string} [selector] CSS Selector + * @returns {AnchorNavigationWrapper} + */ + findAnchorNavigation(selector?: string): AnchorNavigationWrapper; + + /** + * Returns a multi-element wrapper that matches AnchorNavigations with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches AnchorNavigations. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAnchorNavigations(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first AnchorNavigation with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AnchorNavigationWrapper} + */ + findAnchorNavigationByTestId(testId: string): AnchorNavigationWrapper; + + /** + * Returns a wrapper that matches the Annotations with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Annotations. + * + * @param {string} [selector] CSS Selector + * @returns {AnnotationWrapper} + */ + findAnnotation(selector?: string): AnnotationWrapper; + + /** + * Returns a multi-element wrapper that matches Annotations with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Annotations. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAnnotations(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Annotation with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AnnotationWrapper} + */ + findAnnotationByTestId(testId: string): AnnotationWrapper; + + /** + * Returns a wrapper that matches the AppLayouts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches AppLayouts. + * + * @param {string} [selector] CSS Selector + * @returns {AppLayoutWrapper} + */ + findAppLayout(selector?: string): AppLayoutWrapper; + + /** + * Returns a wrapper that matches the AreaCharts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches AreaCharts. + * + * @param {string} [selector] CSS Selector + * @returns {AreaChartWrapper} + */ + findAreaChart(selector?: string): AreaChartWrapper; + + /** + * Returns a multi-element wrapper that matches AreaCharts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches AreaCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAreaCharts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first AreaChart with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AreaChartWrapper} + */ + findAreaChartByTestId(testId: string): AreaChartWrapper; + + /** + * Returns a wrapper that matches the AttributeEditors with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches AttributeEditors. + * + * @param {string} [selector] CSS Selector + * @returns {AttributeEditorWrapper} + */ + findAttributeEditor(selector?: string): AttributeEditorWrapper; + + /** + * Returns a multi-element wrapper that matches AttributeEditors with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches AttributeEditors. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAttributeEditors(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first AttributeEditor with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AttributeEditorWrapper} + */ + findAttributeEditorByTestId(testId: string): AttributeEditorWrapper; + + /** + * Returns a wrapper that matches the Autosuggests with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Autosuggests. + * + * @param {string} [selector] CSS Selector + * @returns {AutosuggestWrapper} + */ + findAutosuggest(selector?: string): AutosuggestWrapper; + + /** + * Returns a multi-element wrapper that matches Autosuggests with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Autosuggests. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllAutosuggests(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Autosuggest with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {AutosuggestWrapper} + */ + findAutosuggestByTestId(testId: string): AutosuggestWrapper; + + /** + * Returns a wrapper that matches the Badges with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Badges. + * + * @param {string} [selector] CSS Selector + * @returns {BadgeWrapper} + */ + findBadge(selector?: string): BadgeWrapper; + + /** + * Returns a multi-element wrapper that matches Badges with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Badges. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllBadges(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Badge with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {BadgeWrapper} + */ + findBadgeByTestId(testId: string): BadgeWrapper; + + /** + * Returns a wrapper that matches the BarCharts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches BarCharts. + * + * @param {string} [selector] CSS Selector + * @returns {BarChartWrapper} + */ + findBarChart(selector?: string): BarChartWrapper; + + /** + * Returns a multi-element wrapper that matches BarCharts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches BarCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllBarCharts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first BarChart with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {BarChartWrapper} + */ + findBarChartByTestId(testId: string): BarChartWrapper; + + /** + * Returns a wrapper that matches the Boxes with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Boxes. + * + * @param {string} [selector] CSS Selector + * @returns {BoxWrapper} + */ + findBox(selector?: string): BoxWrapper; + + /** + * Returns a multi-element wrapper that matches Boxes with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Boxes. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllBoxes(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Box with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {BoxWrapper} + */ + findBoxByTestId(testId: string): BoxWrapper; + + /** + * Returns a wrapper that matches the BreadcrumbGroups with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches BreadcrumbGroups. + * + * @param {string} [selector] CSS Selector + * @returns {BreadcrumbGroupWrapper} + */ + findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper; + + /** + * Returns a multi-element wrapper that matches BreadcrumbGroups with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches BreadcrumbGroups. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllBreadcrumbGroups(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first BreadcrumbGroup with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {BreadcrumbGroupWrapper} + */ + findBreadcrumbGroupByTestId(testId: string): BreadcrumbGroupWrapper; + + /** + * Returns a wrapper that matches the Buttons with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Buttons. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonWrapper} + */ + findButton(selector?: string): ButtonWrapper; + + /** + * Returns a multi-element wrapper that matches Buttons with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Buttons. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllButtons(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Button with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ButtonWrapper} + */ + findButtonByTestId(testId: string): ButtonWrapper; + + /** + * Returns a wrapper that matches the ButtonDropdowns with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ButtonDropdowns. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonDropdownWrapper} + */ + findButtonDropdown(selector?: string): ButtonDropdownWrapper; + + /** + * Returns a multi-element wrapper that matches ButtonDropdowns with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ButtonDropdowns. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllButtonDropdowns(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ButtonDropdown with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ButtonDropdownWrapper} + */ + findButtonDropdownByTestId(testId: string): ButtonDropdownWrapper; + + /** + * Returns a wrapper that matches the ButtonGroups with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ButtonGroups. + * + * @param {string} [selector] CSS Selector + * @returns {ButtonGroupWrapper} + */ + findButtonGroup(selector?: string): ButtonGroupWrapper; + + /** + * Returns a multi-element wrapper that matches ButtonGroups with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ButtonGroups. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllButtonGroups(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ButtonGroup with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ButtonGroupWrapper} + */ + findButtonGroupByTestId(testId: string): ButtonGroupWrapper; + + /** + * Returns a wrapper that matches the Calendars with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Calendars. + * + * @param {string} [selector] CSS Selector + * @returns {CalendarWrapper} + */ + findCalendar(selector?: string): CalendarWrapper; + + /** + * Returns a multi-element wrapper that matches Calendars with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Calendars. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCalendars(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Calendar with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CalendarWrapper} + */ + findCalendarByTestId(testId: string): CalendarWrapper; + + /** + * Returns a wrapper that matches the Cards with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Cards. + * + * @param {string} [selector] CSS Selector + * @returns {CardsWrapper} + */ + findCards(selector?: string): CardsWrapper; + + /** + * Returns a multi-element wrapper that matches Cards with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Cards. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCards(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Cards with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CardsWrapper} + */ + findCardsByTestId(testId: string): CardsWrapper; + + /** + * Returns a wrapper that matches the Checkboxes with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Checkboxes. + * + * @param {string} [selector] CSS Selector + * @returns {CheckboxWrapper} + */ + findCheckbox(selector?: string): CheckboxWrapper; + + /** + * Returns a multi-element wrapper that matches Checkboxes with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Checkboxes. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCheckboxes(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Checkbox with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CheckboxWrapper} + */ + findCheckboxByTestId(testId: string): CheckboxWrapper; + + /** + * Returns a wrapper that matches the CodeEditors with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches CodeEditors. + * + * @param {string} [selector] CSS Selector + * @returns {CodeEditorWrapper} + */ + findCodeEditor(selector?: string): CodeEditorWrapper; + + /** + * Returns a multi-element wrapper that matches CodeEditors with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches CodeEditors. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCodeEditors(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first CodeEditor with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CodeEditorWrapper} + */ + findCodeEditorByTestId(testId: string): CodeEditorWrapper; + + /** + * Returns a wrapper that matches the CollectionPreferences with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches CollectionPreferences. + * + * @param {string} [selector] CSS Selector + * @returns {CollectionPreferencesWrapper} + */ + findCollectionPreferences(selector?: string): CollectionPreferencesWrapper; + + /** + * Returns a multi-element wrapper that matches CollectionPreferences with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches CollectionPreferences. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCollectionPreferences(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first CollectionPreferences with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CollectionPreferencesWrapper} + */ + findCollectionPreferencesByTestId(testId: string): CollectionPreferencesWrapper; + + /** + * Returns a wrapper that matches the ColumnLayouts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ColumnLayouts. + * + * @param {string} [selector] CSS Selector + * @returns {ColumnLayoutWrapper} + */ + findColumnLayout(selector?: string): ColumnLayoutWrapper; + + /** + * Returns a multi-element wrapper that matches ColumnLayouts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ColumnLayouts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllColumnLayouts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ColumnLayout with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ColumnLayoutWrapper} + */ + findColumnLayoutByTestId(testId: string): ColumnLayoutWrapper; + + /** + * Returns a wrapper that matches the Containers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Containers. + * + * @param {string} [selector] CSS Selector + * @returns {ContainerWrapper} + */ + findContainer(selector?: string): ContainerWrapper; + + /** + * Returns a multi-element wrapper that matches Containers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Containers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllContainers(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Container with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ContainerWrapper} + */ + findContainerByTestId(testId: string): ContainerWrapper; + + /** + * Returns a wrapper that matches the ContentLayouts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ContentLayouts. + * + * @param {string} [selector] CSS Selector + * @returns {ContentLayoutWrapper} + */ + findContentLayout(selector?: string): ContentLayoutWrapper; + + /** + * Returns a multi-element wrapper that matches ContentLayouts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ContentLayouts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllContentLayouts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ContentLayout with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ContentLayoutWrapper} + */ + findContentLayoutByTestId(testId: string): ContentLayoutWrapper; + + /** + * Returns a wrapper that matches the CopyToClipboards with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches CopyToClipboards. + * + * @param {string} [selector] CSS Selector + * @returns {CopyToClipboardWrapper} + */ + findCopyToClipboard(selector?: string): CopyToClipboardWrapper; + + /** + * Returns a multi-element wrapper that matches CopyToClipboards with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches CopyToClipboards. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllCopyToClipboards(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first CopyToClipboard with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {CopyToClipboardWrapper} + */ + findCopyToClipboardByTestId(testId: string): CopyToClipboardWrapper; + + /** + * Returns a wrapper that matches the DateInputs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches DateInputs. + * + * @param {string} [selector] CSS Selector + * @returns {DateInputWrapper} + */ + findDateInput(selector?: string): DateInputWrapper; + + /** + * Returns a multi-element wrapper that matches DateInputs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches DateInputs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllDateInputs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first DateInput with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {DateInputWrapper} + */ + findDateInputByTestId(testId: string): DateInputWrapper; + + /** + * Returns a wrapper that matches the DatePickers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches DatePickers. + * + * @param {string} [selector] CSS Selector + * @returns {DatePickerWrapper} + */ + findDatePicker(selector?: string): DatePickerWrapper; + + /** + * Returns a multi-element wrapper that matches DatePickers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches DatePickers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllDatePickers(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first DatePicker with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {DatePickerWrapper} + */ + findDatePickerByTestId(testId: string): DatePickerWrapper; + + /** + * Returns a wrapper that matches the DateRangePickers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches DateRangePickers. + * + * @param {string} [selector] CSS Selector + * @returns {DateRangePickerWrapper} + */ + findDateRangePicker(selector?: string): DateRangePickerWrapper; + + /** + * Returns a multi-element wrapper that matches DateRangePickers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches DateRangePickers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllDateRangePickers(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first DateRangePicker with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {DateRangePickerWrapper} + */ + findDateRangePickerByTestId(testId: string): DateRangePickerWrapper; + + /** + * Returns a wrapper that matches the Drawers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Drawers. + * + * @param {string} [selector] CSS Selector + * @returns {DrawerWrapper} + */ + findDrawer(selector?: string): DrawerWrapper; + + /** + * Returns a multi-element wrapper that matches Drawers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Drawers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllDrawers(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Drawer with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {DrawerWrapper} + */ + findDrawerByTestId(testId: string): DrawerWrapper; + + /** + * Returns a wrapper that matches the ExpandableSections with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ExpandableSections. + * + * @param {string} [selector] CSS Selector + * @returns {ExpandableSectionWrapper} + */ + findExpandableSection(selector?: string): ExpandableSectionWrapper; + + /** + * Returns a multi-element wrapper that matches ExpandableSections with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ExpandableSections. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllExpandableSections(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ExpandableSection with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ExpandableSectionWrapper} + */ + findExpandableSectionByTestId(testId: string): ExpandableSectionWrapper; + + /** + * Returns a wrapper that matches the FileUploads with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches FileUploads. + * + * @param {string} [selector] CSS Selector + * @returns {FileUploadWrapper} + */ + findFileUpload(selector?: string): FileUploadWrapper; + + /** + * Returns a multi-element wrapper that matches FileUploads with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches FileUploads. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllFileUploads(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first FileUpload with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {FileUploadWrapper} + */ + findFileUploadByTestId(testId: string): FileUploadWrapper; + + /** + * Returns a wrapper that matches the Flashbars with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Flashbars. + * + * @param {string} [selector] CSS Selector + * @returns {FlashbarWrapper} + */ + findFlashbar(selector?: string): FlashbarWrapper; + + /** + * Returns a multi-element wrapper that matches Flashbars with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Flashbars. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllFlashbars(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Flashbar with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {FlashbarWrapper} + */ + findFlashbarByTestId(testId: string): FlashbarWrapper; + + /** + * Returns a wrapper that matches the Forms with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Forms. + * + * @param {string} [selector] CSS Selector + * @returns {FormWrapper} + */ + findForm(selector?: string): FormWrapper; + + /** + * Returns a multi-element wrapper that matches Forms with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Forms. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllForms(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Form with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {FormWrapper} + */ + findFormByTestId(testId: string): FormWrapper; + + /** + * Returns a wrapper that matches the FormFields with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches FormFields. + * + * @param {string} [selector] CSS Selector + * @returns {FormFieldWrapper} + */ + findFormField(selector?: string): FormFieldWrapper; + + /** + * Returns a multi-element wrapper that matches FormFields with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches FormFields. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllFormFields(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first FormField with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {FormFieldWrapper} + */ + findFormFieldByTestId(testId: string): FormFieldWrapper; + + /** + * Returns a wrapper that matches the Grids with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Grids. + * + * @param {string} [selector] CSS Selector + * @returns {GridWrapper} + */ + findGrid(selector?: string): GridWrapper; + + /** + * Returns a multi-element wrapper that matches Grids with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Grids. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllGrids(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Grid with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {GridWrapper} + */ + findGridByTestId(testId: string): GridWrapper; + + /** + * Returns a wrapper that matches the Headers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Headers. + * + * @param {string} [selector] CSS Selector + * @returns {HeaderWrapper} + */ + findHeader(selector?: string): HeaderWrapper; + + /** + * Returns a multi-element wrapper that matches Headers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Headers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllHeaders(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Header with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {HeaderWrapper} + */ + findHeaderByTestId(testId: string): HeaderWrapper; + + /** + * Returns a wrapper that matches the HelpPanels with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches HelpPanels. + * + * @param {string} [selector] CSS Selector + * @returns {HelpPanelWrapper} + */ + findHelpPanel(selector?: string): HelpPanelWrapper; + + /** + * Returns a multi-element wrapper that matches HelpPanels with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches HelpPanels. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllHelpPanels(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first HelpPanel with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {HelpPanelWrapper} + */ + findHelpPanelByTestId(testId: string): HelpPanelWrapper; + + /** + * Returns a wrapper that matches the Hotspots with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Hotspots. + * + * @param {string} [selector] CSS Selector + * @returns {HotspotWrapper} + */ + findHotspot(selector?: string): HotspotWrapper; + + /** + * Returns a multi-element wrapper that matches Hotspots with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Hotspots. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllHotspots(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Hotspot with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {HotspotWrapper} + */ + findHotspotByTestId(testId: string): HotspotWrapper; + + /** + * Returns a wrapper that matches the Icons with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Icons. + * + * @param {string} [selector] CSS Selector + * @returns {IconWrapper} + */ + findIcon(selector?: string): IconWrapper; + + /** + * Returns a multi-element wrapper that matches Icons with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Icons. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllIcons(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Icon with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {IconWrapper} + */ + findIconByTestId(testId: string): IconWrapper; + + /** + * Returns a wrapper that matches the Inputs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Inputs. + * + * @param {string} [selector] CSS Selector + * @returns {InputWrapper} + */ + findInput(selector?: string): InputWrapper; + + /** + * Returns a multi-element wrapper that matches Inputs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Inputs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllInputs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Input with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {InputWrapper} + */ + findInputByTestId(testId: string): InputWrapper; + + /** + * Returns a wrapper that matches the KeyValuePairs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches KeyValuePairs. + * + * @param {string} [selector] CSS Selector + * @returns {KeyValuePairsWrapper} + */ + findKeyValuePairs(selector?: string): KeyValuePairsWrapper; + + /** + * Returns a multi-element wrapper that matches KeyValuePairs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches KeyValuePairs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllKeyValuePairs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first KeyValuePairs with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {KeyValuePairsWrapper} + */ + findKeyValuePairsByTestId(testId: string): KeyValuePairsWrapper; + + /** + * Returns a wrapper that matches the LineCharts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches LineCharts. + * + * @param {string} [selector] CSS Selector + * @returns {LineChartWrapper} + */ + findLineChart(selector?: string): LineChartWrapper; + + /** + * Returns a multi-element wrapper that matches LineCharts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches LineCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllLineCharts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first LineChart with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {LineChartWrapper} + */ + findLineChartByTestId(testId: string): LineChartWrapper; + + /** + * Returns a wrapper that matches the Links with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Links. + * + * @param {string} [selector] CSS Selector + * @returns {LinkWrapper} + */ + findLink(selector?: string): LinkWrapper; + + /** + * Returns a multi-element wrapper that matches Links with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Links. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllLinks(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Link with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {LinkWrapper} + */ + findLinkByTestId(testId: string): LinkWrapper; + + /** + * Returns a wrapper that matches the LiveRegions with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches LiveRegions. + * + * @param {string} [selector] CSS Selector + * @returns {LiveRegionWrapper} + */ + findLiveRegion(selector?: string): LiveRegionWrapper; + + /** + * Returns a multi-element wrapper that matches LiveRegions with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches LiveRegions. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllLiveRegions(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first LiveRegion with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {LiveRegionWrapper} + */ + findLiveRegionByTestId(testId: string): LiveRegionWrapper; + + /** + * Returns a wrapper that matches the MixedLineBarCharts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches MixedLineBarCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MixedLineBarChartWrapper} + */ + findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper; + + /** + * Returns a multi-element wrapper that matches MixedLineBarCharts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches MixedLineBarCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllMixedLineBarCharts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first MixedLineBarChart with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {MixedLineBarChartWrapper} + */ + findMixedLineBarChartByTestId(testId: string): MixedLineBarChartWrapper; + + /** + * Returns a wrapper that matches the Modals with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Modals. + * + * @param {string} [selector] CSS Selector + * @returns {ModalWrapper} + */ + findModal(selector?: string): ModalWrapper; + + /** + * Returns a multi-element wrapper that matches Modals with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Modals. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllModals(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Modal with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ModalWrapper} + */ + findModalByTestId(testId: string): ModalWrapper; + + /** + * Returns a wrapper that matches the Multiselects with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Multiselects. + * + * @param {string} [selector] CSS Selector + * @returns {MultiselectWrapper} + */ + findMultiselect(selector?: string): MultiselectWrapper; + + /** + * Returns a multi-element wrapper that matches Multiselects with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Multiselects. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllMultiselects(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Multiselect with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {MultiselectWrapper} + */ + findMultiselectByTestId(testId: string): MultiselectWrapper; + + /** + * Returns a wrapper that matches the Paginations with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Paginations. + * + * @param {string} [selector] CSS Selector + * @returns {PaginationWrapper} + */ + findPagination(selector?: string): PaginationWrapper; + + /** + * Returns a multi-element wrapper that matches Paginations with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Paginations. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllPaginations(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Pagination with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {PaginationWrapper} + */ + findPaginationByTestId(testId: string): PaginationWrapper; + + /** + * Returns a wrapper that matches the PieCharts with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches PieCharts. + * + * @param {string} [selector] CSS Selector + * @returns {PieChartWrapper} + */ + findPieChart(selector?: string): PieChartWrapper; + + /** + * Returns a multi-element wrapper that matches PieCharts with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches PieCharts. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllPieCharts(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first PieChart with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {PieChartWrapper} + */ + findPieChartByTestId(testId: string): PieChartWrapper; + + /** + * Returns a wrapper that matches the Popovers with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Popovers. + * + * @param {string} [selector] CSS Selector + * @returns {PopoverWrapper} + */ + findPopover(selector?: string): PopoverWrapper; + + /** + * Returns a multi-element wrapper that matches Popovers with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Popovers. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllPopovers(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Popover with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {PopoverWrapper} + */ + findPopoverByTestId(testId: string): PopoverWrapper; + + /** + * Returns a wrapper that matches the ProgressBars with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ProgressBars. + * + * @param {string} [selector] CSS Selector + * @returns {ProgressBarWrapper} + */ + findProgressBar(selector?: string): ProgressBarWrapper; + + /** + * Returns a multi-element wrapper that matches ProgressBars with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ProgressBars. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllProgressBars(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ProgressBar with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ProgressBarWrapper} + */ + findProgressBarByTestId(testId: string): ProgressBarWrapper; + + /** + * Returns a wrapper that matches the PromptInputs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches PromptInputs. + * + * @param {string} [selector] CSS Selector + * @returns {PromptInputWrapper} + */ + findPromptInput(selector?: string): PromptInputWrapper; + + /** + * Returns a multi-element wrapper that matches PromptInputs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches PromptInputs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllPromptInputs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first PromptInput with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {PromptInputWrapper} + */ + findPromptInputByTestId(testId: string): PromptInputWrapper; + + /** + * Returns a wrapper that matches the PropertyFilters with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches PropertyFilters. + * + * @param {string} [selector] CSS Selector + * @returns {PropertyFilterWrapper} + */ + findPropertyFilter(selector?: string): PropertyFilterWrapper; + + /** + * Returns a multi-element wrapper that matches PropertyFilters with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches PropertyFilters. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllPropertyFilters(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first PropertyFilter with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {PropertyFilterWrapper} + */ + findPropertyFilterByTestId(testId: string): PropertyFilterWrapper; + + /** + * Returns a wrapper that matches the RadioGroups with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches RadioGroups. + * + * @param {string} [selector] CSS Selector + * @returns {RadioGroupWrapper} + */ + findRadioGroup(selector?: string): RadioGroupWrapper; + + /** + * Returns a multi-element wrapper that matches RadioGroups with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches RadioGroups. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllRadioGroups(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first RadioGroup with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {RadioGroupWrapper} + */ + findRadioGroupByTestId(testId: string): RadioGroupWrapper; + + /** + * Returns a wrapper that matches the S3ResourceSelectors with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches S3ResourceSelectors. + * + * @param {string} [selector] CSS Selector + * @returns {S3ResourceSelectorWrapper} + */ + findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper; + + /** + * Returns a multi-element wrapper that matches S3ResourceSelectors with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches S3ResourceSelectors. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllS3ResourceSelectors(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first S3ResourceSelector with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {S3ResourceSelectorWrapper} + */ + findS3ResourceSelectorByTestId(testId: string): S3ResourceSelectorWrapper; + + /** + * Returns a wrapper that matches the SegmentedControls with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches SegmentedControls. + * + * @param {string} [selector] CSS Selector + * @returns {SegmentedControlWrapper} + */ + findSegmentedControl(selector?: string): SegmentedControlWrapper; + + /** + * Returns a multi-element wrapper that matches SegmentedControls with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches SegmentedControls. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSegmentedControls(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first SegmentedControl with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SegmentedControlWrapper} + */ + findSegmentedControlByTestId(testId: string): SegmentedControlWrapper; + + /** + * Returns a wrapper that matches the Selects with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Selects. + * + * @param {string} [selector] CSS Selector + * @returns {SelectWrapper} + */ + findSelect(selector?: string): SelectWrapper; + + /** + * Returns a multi-element wrapper that matches Selects with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Selects. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSelects(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Select with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SelectWrapper} + */ + findSelectByTestId(testId: string): SelectWrapper; + + /** + * Returns a wrapper that matches the SideNavigations with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches SideNavigations. + * + * @param {string} [selector] CSS Selector + * @returns {SideNavigationWrapper} + */ + findSideNavigation(selector?: string): SideNavigationWrapper; + + /** + * Returns a multi-element wrapper that matches SideNavigations with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches SideNavigations. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSideNavigations(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first SideNavigation with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SideNavigationWrapper} + */ + findSideNavigationByTestId(testId: string): SideNavigationWrapper; + + /** + * Returns a wrapper that matches the Sliders with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Sliders. + * + * @param {string} [selector] CSS Selector + * @returns {SliderWrapper} + */ + findSlider(selector?: string): SliderWrapper; + + /** + * Returns a multi-element wrapper that matches Sliders with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Sliders. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSliders(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Slider with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SliderWrapper} + */ + findSliderByTestId(testId: string): SliderWrapper; + + /** + * Returns a wrapper that matches the SpaceBetweens with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches SpaceBetweens. + * + * @param {string} [selector] CSS Selector + * @returns {SpaceBetweenWrapper} + */ + findSpaceBetween(selector?: string): SpaceBetweenWrapper; + + /** + * Returns a multi-element wrapper that matches SpaceBetweens with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches SpaceBetweens. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSpaceBetweens(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first SpaceBetween with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SpaceBetweenWrapper} + */ + findSpaceBetweenByTestId(testId: string): SpaceBetweenWrapper; + + /** + * Returns a wrapper that matches the Spinners with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Spinners. + * + * @param {string} [selector] CSS Selector + * @returns {SpinnerWrapper} + */ + findSpinner(selector?: string): SpinnerWrapper; + + /** + * Returns a multi-element wrapper that matches Spinners with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Spinners. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSpinners(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Spinner with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SpinnerWrapper} + */ + findSpinnerByTestId(testId: string): SpinnerWrapper; + + /** + * Returns a wrapper that matches the SplitPanels with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches SplitPanels. + * + * @param {string} [selector] CSS Selector + * @returns {SplitPanelWrapper} + */ + findSplitPanel(selector?: string): SplitPanelWrapper; + + /** + * Returns a multi-element wrapper that matches SplitPanels with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches SplitPanels. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSplitPanels(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first SplitPanel with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {SplitPanelWrapper} + */ + findSplitPanelByTestId(testId: string): SplitPanelWrapper; + + /** + * Returns a wrapper that matches the StatusIndicators with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches StatusIndicators. + * + * @param {string} [selector] CSS Selector + * @returns {StatusIndicatorWrapper} + */ + findStatusIndicator(selector?: string): StatusIndicatorWrapper; + + /** + * Returns a multi-element wrapper that matches StatusIndicators with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches StatusIndicators. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllStatusIndicators(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first StatusIndicator with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {StatusIndicatorWrapper} + */ + findStatusIndicatorByTestId(testId: string): StatusIndicatorWrapper; + + /** + * Returns a wrapper that matches the Steps with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Steps. + * + * @param {string} [selector] CSS Selector + * @returns {StepsWrapper} + */ + findSteps(selector?: string): StepsWrapper; + + /** + * Returns a multi-element wrapper that matches Steps with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Steps. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllSteps(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Steps with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {StepsWrapper} + */ + findStepsByTestId(testId: string): StepsWrapper; + + /** + * Returns a wrapper that matches the Tables with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Tables. + * + * @param {string} [selector] CSS Selector + * @returns {TableWrapper} + */ + findTable(selector?: string): TableWrapper; + + /** + * Returns a multi-element wrapper that matches Tables with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Tables. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTables(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Table with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TableWrapper} + */ + findTableByTestId(testId: string): TableWrapper; + + /** + * Returns a wrapper that matches the Tabs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Tabs. + * + * @param {string} [selector] CSS Selector + * @returns {TabsWrapper} + */ + findTabs(selector?: string): TabsWrapper; + + /** + * Returns a multi-element wrapper that matches Tabs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Tabs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTabs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Tabs with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TabsWrapper} + */ + findTabsByTestId(testId: string): TabsWrapper; + + /** + * Returns a wrapper that matches the TagEditors with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TagEditors. + * + * @param {string} [selector] CSS Selector + * @returns {TagEditorWrapper} + */ + findTagEditor(selector?: string): TagEditorWrapper; + + /** + * Returns a multi-element wrapper that matches TagEditors with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TagEditors. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTagEditors(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TagEditor with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TagEditorWrapper} + */ + findTagEditorByTestId(testId: string): TagEditorWrapper; + + /** + * Returns a wrapper that matches the TextContents with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TextContents. + * + * @param {string} [selector] CSS Selector + * @returns {TextContentWrapper} + */ + findTextContent(selector?: string): TextContentWrapper; + + /** + * Returns a multi-element wrapper that matches TextContents with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TextContents. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTextContents(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TextContent with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TextContentWrapper} + */ + findTextContentByTestId(testId: string): TextContentWrapper; + + /** + * Returns a wrapper that matches the TextFilters with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TextFilters. + * + * @param {string} [selector] CSS Selector + * @returns {TextFilterWrapper} + */ + findTextFilter(selector?: string): TextFilterWrapper; + + /** + * Returns a multi-element wrapper that matches TextFilters with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TextFilters. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTextFilters(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TextFilter with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TextFilterWrapper} + */ + findTextFilterByTestId(testId: string): TextFilterWrapper; + + /** + * Returns a wrapper that matches the Textareas with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Textareas. + * + * @param {string} [selector] CSS Selector + * @returns {TextareaWrapper} + */ + findTextarea(selector?: string): TextareaWrapper; + + /** + * Returns a multi-element wrapper that matches Textareas with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Textareas. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTextareas(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Textarea with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TextareaWrapper} + */ + findTextareaByTestId(testId: string): TextareaWrapper; + + /** + * Returns a wrapper that matches the Tiles with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Tiles. + * + * @param {string} [selector] CSS Selector + * @returns {TilesWrapper} + */ + findTiles(selector?: string): TilesWrapper; + + /** + * Returns a multi-element wrapper that matches Tiles with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Tiles. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTiles(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Tiles with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TilesWrapper} + */ + findTilesByTestId(testId: string): TilesWrapper; + + /** + * Returns a wrapper that matches the TimeInputs with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TimeInputs. + * + * @param {string} [selector] CSS Selector + * @returns {TimeInputWrapper} + */ + findTimeInput(selector?: string): TimeInputWrapper; + + /** + * Returns a multi-element wrapper that matches TimeInputs with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TimeInputs. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTimeInputs(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TimeInput with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TimeInputWrapper} + */ + findTimeInputByTestId(testId: string): TimeInputWrapper; + + /** + * Returns a wrapper that matches the Toggles with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Toggles. + * + * @param {string} [selector] CSS Selector + * @returns {ToggleWrapper} + */ + findToggle(selector?: string): ToggleWrapper; + + /** + * Returns a multi-element wrapper that matches Toggles with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Toggles. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllToggles(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Toggle with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ToggleWrapper} + */ + findToggleByTestId(testId: string): ToggleWrapper; + + /** + * Returns a wrapper that matches the ToggleButtons with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches ToggleButtons. + * + * @param {string} [selector] CSS Selector + * @returns {ToggleButtonWrapper} + */ + findToggleButton(selector?: string): ToggleButtonWrapper; + + /** + * Returns a multi-element wrapper that matches ToggleButtons with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches ToggleButtons. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllToggleButtons(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first ToggleButton with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {ToggleButtonWrapper} + */ + findToggleButtonByTestId(testId: string): ToggleButtonWrapper; + + /** + * Returns a wrapper that matches the TokenGroups with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TokenGroups. + * + * @param {string} [selector] CSS Selector + * @returns {TokenGroupWrapper} + */ + findTokenGroup(selector?: string): TokenGroupWrapper; + + /** + * Returns a multi-element wrapper that matches TokenGroups with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TokenGroups. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTokenGroups(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TokenGroup with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TokenGroupWrapper} + */ + findTokenGroupByTestId(testId: string): TokenGroupWrapper; + + /** + * Returns a wrapper that matches the TopNavigations with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TopNavigations. + * + * @param {string} [selector] CSS Selector + * @returns {TopNavigationWrapper} + */ + findTopNavigation(selector?: string): TopNavigationWrapper; + + /** + * Returns a wrapper that matches the TutorialPanels with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches TutorialPanels. + * + * @param {string} [selector] CSS Selector + * @returns {TutorialPanelWrapper} + */ + findTutorialPanel(selector?: string): TutorialPanelWrapper; + + /** + * Returns a multi-element wrapper that matches TutorialPanels with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches TutorialPanels. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllTutorialPanels(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first TutorialPanel with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {TutorialPanelWrapper} + */ + findTutorialPanelByTestId(testId: string): TutorialPanelWrapper; + + /** + * Returns a wrapper that matches the Wizards with the specified CSS selector. + * If no CSS selector is specified, returns a wrapper that matches Wizards. + * + * @param {string} [selector] CSS Selector + * @returns {WizardWrapper} + */ + findWizard(selector?: string): WizardWrapper; + + /** + * Returns a multi-element wrapper that matches Wizards with the specified CSS selector. + * If no CSS selector is specified, returns a multi-element wrapper that matches Wizards. + * + * @param {string} [selector] CSS Selector + * @returns {MultiElementWrapper} + */ + findAllWizards(selector?: string): MultiElementWrapper; + /** + * Returns a wrapper that matches the first Wizard with the specified test ID. + * Looks for the \`data-testid\` attribute assigned to the component. + * + * @param {string} testId + * @returns {WizardWrapper} + */ + findWizardByTestId(testId: string): WizardWrapper; + } + } + + ElementWrapper.prototype.findAlert = function(selector) { + const rootSelector = \`.\${AlertWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); + }; + + ElementWrapper.prototype.findAllAlerts = function(selector) { + return this.findAllComponents(AlertWrapper, selector); + }; + + ElementWrapper.prototype.findAlertByTestId = function(testId) { + const selector = \`.\${AlertWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AlertWrapper); + }; + + ElementWrapper.prototype.findAnchorNavigation = function(selector) { + const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); + }; + + ElementWrapper.prototype.findAllAnchorNavigations = function(selector) { + return this.findAllComponents(AnchorNavigationWrapper, selector); + }; + + ElementWrapper.prototype.findAnchorNavigationByTestId = function(testId) { + const selector = \`.\${AnchorNavigationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AnchorNavigationWrapper); + }; + + ElementWrapper.prototype.findAnnotation = function(selector) { + const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); + }; + + ElementWrapper.prototype.findAllAnnotations = function(selector) { + return this.findAllComponents(AnnotationWrapper, selector); + }; + + ElementWrapper.prototype.findAnnotationByTestId = function(testId) { + const selector = \`.\${AnnotationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AnnotationWrapper); + }; + + ElementWrapper.prototype.findAppLayout = function(selector) { + const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); + }; + + ElementWrapper.prototype.findAreaChart = function(selector) { + const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); + }; + + ElementWrapper.prototype.findAllAreaCharts = function(selector) { + return this.findAllComponents(AreaChartWrapper, selector); + }; + + ElementWrapper.prototype.findAreaChartByTestId = function(testId) { + const selector = \`.\${AreaChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AreaChartWrapper); + }; + + ElementWrapper.prototype.findAttributeEditor = function(selector) { + const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); + }; + + ElementWrapper.prototype.findAllAttributeEditors = function(selector) { + return this.findAllComponents(AttributeEditorWrapper, selector); + }; + + ElementWrapper.prototype.findAttributeEditorByTestId = function(testId) { + const selector = \`.\${AttributeEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AttributeEditorWrapper); + }; + + ElementWrapper.prototype.findAutosuggest = function(selector) { + const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); + }; + + ElementWrapper.prototype.findAllAutosuggests = function(selector) { + return this.findAllComponents(AutosuggestWrapper, selector); + }; + + ElementWrapper.prototype.findAutosuggestByTestId = function(testId) { + const selector = \`.\${AutosuggestWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, AutosuggestWrapper); + }; + + ElementWrapper.prototype.findBadge = function(selector) { + const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); + }; + + ElementWrapper.prototype.findAllBadges = function(selector) { + return this.findAllComponents(BadgeWrapper, selector); + }; + + ElementWrapper.prototype.findBadgeByTestId = function(testId) { + const selector = \`.\${BadgeWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BadgeWrapper); + }; + + ElementWrapper.prototype.findBarChart = function(selector) { + const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); + }; + + ElementWrapper.prototype.findAllBarCharts = function(selector) { + return this.findAllComponents(BarChartWrapper, selector); + }; + + ElementWrapper.prototype.findBarChartByTestId = function(testId) { + const selector = \`.\${BarChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BarChartWrapper); + }; + + ElementWrapper.prototype.findBox = function(selector) { + const rootSelector = \`.\${BoxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); + }; + + ElementWrapper.prototype.findAllBoxes = function(selector) { + return this.findAllComponents(BoxWrapper, selector); + }; + + ElementWrapper.prototype.findBoxByTestId = function(testId) { + const selector = \`.\${BoxWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BoxWrapper); + }; + + ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { + const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); + }; + + ElementWrapper.prototype.findAllBreadcrumbGroups = function(selector) { + return this.findAllComponents(BreadcrumbGroupWrapper, selector); + }; + + ElementWrapper.prototype.findBreadcrumbGroupByTestId = function(testId) { + const selector = \`.\${BreadcrumbGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, BreadcrumbGroupWrapper); + }; + + ElementWrapper.prototype.findButton = function(selector) { + const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); + }; + + ElementWrapper.prototype.findAllButtons = function(selector) { + return this.findAllComponents(ButtonWrapper, selector); + }; + + ElementWrapper.prototype.findButtonByTestId = function(testId) { + const selector = \`.\${ButtonWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonWrapper); + }; + + ElementWrapper.prototype.findButtonDropdown = function(selector) { + const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); + }; + + ElementWrapper.prototype.findAllButtonDropdowns = function(selector) { + return this.findAllComponents(ButtonDropdownWrapper, selector); + }; + + ElementWrapper.prototype.findButtonDropdownByTestId = function(testId) { + const selector = \`.\${ButtonDropdownWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonDropdownWrapper); + }; + + ElementWrapper.prototype.findButtonGroup = function(selector) { + const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); + }; + + ElementWrapper.prototype.findAllButtonGroups = function(selector) { + return this.findAllComponents(ButtonGroupWrapper, selector); + }; + + ElementWrapper.prototype.findButtonGroupByTestId = function(testId) { + const selector = \`.\${ButtonGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ButtonGroupWrapper); + }; + + ElementWrapper.prototype.findCalendar = function(selector) { + const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); + }; + + ElementWrapper.prototype.findAllCalendars = function(selector) { + return this.findAllComponents(CalendarWrapper, selector); + }; + + ElementWrapper.prototype.findCalendarByTestId = function(testId) { + const selector = \`.\${CalendarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CalendarWrapper); + }; + + ElementWrapper.prototype.findCards = function(selector) { + const rootSelector = \`.\${CardsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); + }; + + ElementWrapper.prototype.findAllCards = function(selector) { + return this.findAllComponents(CardsWrapper, selector); + }; + + ElementWrapper.prototype.findCardsByTestId = function(testId) { + const selector = \`.\${CardsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CardsWrapper); + }; + + ElementWrapper.prototype.findCheckbox = function(selector) { + const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); + }; + + ElementWrapper.prototype.findAllCheckboxes = function(selector) { + return this.findAllComponents(CheckboxWrapper, selector); + }; + + ElementWrapper.prototype.findCheckboxByTestId = function(testId) { + const selector = \`.\${CheckboxWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CheckboxWrapper); + }; + + ElementWrapper.prototype.findCodeEditor = function(selector) { + const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); + }; + + ElementWrapper.prototype.findAllCodeEditors = function(selector) { + return this.findAllComponents(CodeEditorWrapper, selector); + }; + + ElementWrapper.prototype.findCodeEditorByTestId = function(testId) { + const selector = \`.\${CodeEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CodeEditorWrapper); + }; + + ElementWrapper.prototype.findCollectionPreferences = function(selector) { + const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); + }; + + ElementWrapper.prototype.findAllCollectionPreferences = function(selector) { + return this.findAllComponents(CollectionPreferencesWrapper, selector); + }; + + ElementWrapper.prototype.findCollectionPreferencesByTestId = function(testId) { + const selector = \`.\${CollectionPreferencesWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CollectionPreferencesWrapper); + }; + + ElementWrapper.prototype.findColumnLayout = function(selector) { + const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); + }; + + ElementWrapper.prototype.findAllColumnLayouts = function(selector) { + return this.findAllComponents(ColumnLayoutWrapper, selector); + }; + + ElementWrapper.prototype.findColumnLayoutByTestId = function(testId) { + const selector = \`.\${ColumnLayoutWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ColumnLayoutWrapper); + }; + + ElementWrapper.prototype.findContainer = function(selector) { + const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); + }; + + ElementWrapper.prototype.findAllContainers = function(selector) { + return this.findAllComponents(ContainerWrapper, selector); + }; + + ElementWrapper.prototype.findContainerByTestId = function(testId) { + const selector = \`.\${ContainerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ContainerWrapper); + }; + + ElementWrapper.prototype.findContentLayout = function(selector) { + const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); + }; + + ElementWrapper.prototype.findAllContentLayouts = function(selector) { + return this.findAllComponents(ContentLayoutWrapper, selector); + }; + + ElementWrapper.prototype.findContentLayoutByTestId = function(testId) { + const selector = \`.\${ContentLayoutWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ContentLayoutWrapper); + }; + + ElementWrapper.prototype.findCopyToClipboard = function(selector) { + const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); + }; + + ElementWrapper.prototype.findAllCopyToClipboards = function(selector) { + return this.findAllComponents(CopyToClipboardWrapper, selector); + }; + + ElementWrapper.prototype.findCopyToClipboardByTestId = function(testId) { + const selector = \`.\${CopyToClipboardWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, CopyToClipboardWrapper); + }; + + ElementWrapper.prototype.findDateInput = function(selector) { + const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); + }; + + ElementWrapper.prototype.findAllDateInputs = function(selector) { + return this.findAllComponents(DateInputWrapper, selector); + }; + + ElementWrapper.prototype.findDateInputByTestId = function(testId) { + const selector = \`.\${DateInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DateInputWrapper); + }; + + ElementWrapper.prototype.findDatePicker = function(selector) { + const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); + }; + + ElementWrapper.prototype.findAllDatePickers = function(selector) { + return this.findAllComponents(DatePickerWrapper, selector); + }; + + ElementWrapper.prototype.findDatePickerByTestId = function(testId) { + const selector = \`.\${DatePickerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DatePickerWrapper); + }; + + ElementWrapper.prototype.findDateRangePicker = function(selector) { + const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); + }; + + ElementWrapper.prototype.findAllDateRangePickers = function(selector) { + return this.findAllComponents(DateRangePickerWrapper, selector); + }; + + ElementWrapper.prototype.findDateRangePickerByTestId = function(testId) { + const selector = \`.\${DateRangePickerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DateRangePickerWrapper); + }; + + ElementWrapper.prototype.findDrawer = function(selector) { + const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); + }; + + ElementWrapper.prototype.findAllDrawers = function(selector) { + return this.findAllComponents(DrawerWrapper, selector); + }; + + ElementWrapper.prototype.findDrawerByTestId = function(testId) { + const selector = \`.\${DrawerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, DrawerWrapper); + }; + + ElementWrapper.prototype.findExpandableSection = function(selector) { + const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); + }; + + ElementWrapper.prototype.findAllExpandableSections = function(selector) { + return this.findAllComponents(ExpandableSectionWrapper, selector); + }; - import ToggleWrapper from './toggle'; - export { ToggleWrapper }; - + ElementWrapper.prototype.findExpandableSectionByTestId = function(testId) { + const selector = \`.\${ExpandableSectionWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ExpandableSectionWrapper); + }; - import ToggleButtonWrapper from './toggle-button'; - export { ToggleButtonWrapper }; - + ElementWrapper.prototype.findFileUpload = function(selector) { + const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); + }; - import TokenGroupWrapper from './token-group'; - export { TokenGroupWrapper }; - + ElementWrapper.prototype.findAllFileUploads = function(selector) { + return this.findAllComponents(FileUploadWrapper, selector); + }; - import TopNavigationWrapper from './top-navigation'; - export { TopNavigationWrapper }; - + ElementWrapper.prototype.findFileUploadByTestId = function(testId) { + const selector = \`.\${FileUploadWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FileUploadWrapper); + }; - import TutorialPanelWrapper from './tutorial-panel'; - export { TutorialPanelWrapper }; - + ElementWrapper.prototype.findFlashbar = function(selector) { + const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); + }; - import WizardWrapper from './wizard'; - export { WizardWrapper }; - -declare module '@cloudscape-design/test-utils-core/dist/selectors' { - interface ElementWrapper { - findAlert(selector?: string): AlertWrapper; -findAnchorNavigation(selector?: string): AnchorNavigationWrapper; -findAnnotation(selector?: string): AnnotationWrapper; -findAppLayout(selector?: string): AppLayoutWrapper; -findAreaChart(selector?: string): AreaChartWrapper; -findAttributeEditor(selector?: string): AttributeEditorWrapper; -findAutosuggest(selector?: string): AutosuggestWrapper; -findBadge(selector?: string): BadgeWrapper; -findBarChart(selector?: string): BarChartWrapper; -findBox(selector?: string): BoxWrapper; -findBreadcrumbGroup(selector?: string): BreadcrumbGroupWrapper; -findButton(selector?: string): ButtonWrapper; -findButtonDropdown(selector?: string): ButtonDropdownWrapper; -findButtonGroup(selector?: string): ButtonGroupWrapper; -findCalendar(selector?: string): CalendarWrapper; -findCards(selector?: string): CardsWrapper; -findCheckbox(selector?: string): CheckboxWrapper; -findCodeEditor(selector?: string): CodeEditorWrapper; -findCollectionPreferences(selector?: string): CollectionPreferencesWrapper; -findColumnLayout(selector?: string): ColumnLayoutWrapper; -findContainer(selector?: string): ContainerWrapper; -findContentLayout(selector?: string): ContentLayoutWrapper; -findCopyToClipboard(selector?: string): CopyToClipboardWrapper; -findDateInput(selector?: string): DateInputWrapper; -findDatePicker(selector?: string): DatePickerWrapper; -findDateRangePicker(selector?: string): DateRangePickerWrapper; -findDrawer(selector?: string): DrawerWrapper; -findExpandableSection(selector?: string): ExpandableSectionWrapper; -findFileUpload(selector?: string): FileUploadWrapper; -findFlashbar(selector?: string): FlashbarWrapper; -findForm(selector?: string): FormWrapper; -findFormField(selector?: string): FormFieldWrapper; -findGrid(selector?: string): GridWrapper; -findHeader(selector?: string): HeaderWrapper; -findHelpPanel(selector?: string): HelpPanelWrapper; -findHotspot(selector?: string): HotspotWrapper; -findIcon(selector?: string): IconWrapper; -findInput(selector?: string): InputWrapper; -findKeyValuePairs(selector?: string): KeyValuePairsWrapper; -findLineChart(selector?: string): LineChartWrapper; -findLink(selector?: string): LinkWrapper; -findLiveRegion(selector?: string): LiveRegionWrapper; -findMixedLineBarChart(selector?: string): MixedLineBarChartWrapper; -findModal(selector?: string): ModalWrapper; -findMultiselect(selector?: string): MultiselectWrapper; -findPagination(selector?: string): PaginationWrapper; -findPieChart(selector?: string): PieChartWrapper; -findPopover(selector?: string): PopoverWrapper; -findProgressBar(selector?: string): ProgressBarWrapper; -findPromptInput(selector?: string): PromptInputWrapper; -findPropertyFilter(selector?: string): PropertyFilterWrapper; -findRadioGroup(selector?: string): RadioGroupWrapper; -findS3ResourceSelector(selector?: string): S3ResourceSelectorWrapper; -findSegmentedControl(selector?: string): SegmentedControlWrapper; -findSelect(selector?: string): SelectWrapper; -findSideNavigation(selector?: string): SideNavigationWrapper; -findSlider(selector?: string): SliderWrapper; -findSpaceBetween(selector?: string): SpaceBetweenWrapper; -findSpinner(selector?: string): SpinnerWrapper; -findSplitPanel(selector?: string): SplitPanelWrapper; -findStatusIndicator(selector?: string): StatusIndicatorWrapper; -findSteps(selector?: string): StepsWrapper; -findTable(selector?: string): TableWrapper; -findTabs(selector?: string): TabsWrapper; -findTagEditor(selector?: string): TagEditorWrapper; -findTextContent(selector?: string): TextContentWrapper; -findTextFilter(selector?: string): TextFilterWrapper; -findTextarea(selector?: string): TextareaWrapper; -findTiles(selector?: string): TilesWrapper; -findTimeInput(selector?: string): TimeInputWrapper; -findToggle(selector?: string): ToggleWrapper; -findToggleButton(selector?: string): ToggleButtonWrapper; -findTokenGroup(selector?: string): TokenGroupWrapper; -findTopNavigation(selector?: string): TopNavigationWrapper; -findTutorialPanel(selector?: string): TutorialPanelWrapper; -findWizard(selector?: string): WizardWrapper; - } - } -ElementWrapper.prototype.findAlert = function(selector) { - const rootSelector = \`.\${AlertWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AlertWrapper); - }; -ElementWrapper.prototype.findAnchorNavigation = function(selector) { - const rootSelector = \`.\${AnchorNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnchorNavigationWrapper); - }; -ElementWrapper.prototype.findAnnotation = function(selector) { - const rootSelector = \`.\${AnnotationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AnnotationWrapper); - }; -ElementWrapper.prototype.findAppLayout = function(selector) { - const rootSelector = \`.\${AppLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AppLayoutWrapper); - }; -ElementWrapper.prototype.findAreaChart = function(selector) { - const rootSelector = \`.\${AreaChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AreaChartWrapper); - }; -ElementWrapper.prototype.findAttributeEditor = function(selector) { - const rootSelector = \`.\${AttributeEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AttributeEditorWrapper); - }; -ElementWrapper.prototype.findAutosuggest = function(selector) { - const rootSelector = \`.\${AutosuggestWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AutosuggestWrapper); - }; -ElementWrapper.prototype.findBadge = function(selector) { - const rootSelector = \`.\${BadgeWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BadgeWrapper); - }; -ElementWrapper.prototype.findBarChart = function(selector) { - const rootSelector = \`.\${BarChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BarChartWrapper); - }; -ElementWrapper.prototype.findBox = function(selector) { - const rootSelector = \`.\${BoxWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BoxWrapper); - }; -ElementWrapper.prototype.findBreadcrumbGroup = function(selector) { - const rootSelector = \`.\${BreadcrumbGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, BreadcrumbGroupWrapper); - }; -ElementWrapper.prototype.findButton = function(selector) { - const rootSelector = \`.\${ButtonWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonWrapper); - }; -ElementWrapper.prototype.findButtonDropdown = function(selector) { - const rootSelector = \`.\${ButtonDropdownWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonDropdownWrapper); - }; -ElementWrapper.prototype.findButtonGroup = function(selector) { - const rootSelector = \`.\${ButtonGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ButtonGroupWrapper); - }; -ElementWrapper.prototype.findCalendar = function(selector) { - const rootSelector = \`.\${CalendarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CalendarWrapper); - }; -ElementWrapper.prototype.findCards = function(selector) { - const rootSelector = \`.\${CardsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CardsWrapper); - }; -ElementWrapper.prototype.findCheckbox = function(selector) { - const rootSelector = \`.\${CheckboxWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CheckboxWrapper); - }; -ElementWrapper.prototype.findCodeEditor = function(selector) { - const rootSelector = \`.\${CodeEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CodeEditorWrapper); - }; -ElementWrapper.prototype.findCollectionPreferences = function(selector) { - const rootSelector = \`.\${CollectionPreferencesWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CollectionPreferencesWrapper); - }; -ElementWrapper.prototype.findColumnLayout = function(selector) { - const rootSelector = \`.\${ColumnLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ColumnLayoutWrapper); - }; -ElementWrapper.prototype.findContainer = function(selector) { - const rootSelector = \`.\${ContainerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContainerWrapper); - }; -ElementWrapper.prototype.findContentLayout = function(selector) { - const rootSelector = \`.\${ContentLayoutWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ContentLayoutWrapper); - }; -ElementWrapper.prototype.findCopyToClipboard = function(selector) { - const rootSelector = \`.\${CopyToClipboardWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, CopyToClipboardWrapper); - }; -ElementWrapper.prototype.findDateInput = function(selector) { - const rootSelector = \`.\${DateInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateInputWrapper); - }; -ElementWrapper.prototype.findDatePicker = function(selector) { - const rootSelector = \`.\${DatePickerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DatePickerWrapper); - }; -ElementWrapper.prototype.findDateRangePicker = function(selector) { - const rootSelector = \`.\${DateRangePickerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DateRangePickerWrapper); - }; -ElementWrapper.prototype.findDrawer = function(selector) { - const rootSelector = \`.\${DrawerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, DrawerWrapper); - }; -ElementWrapper.prototype.findExpandableSection = function(selector) { - const rootSelector = \`.\${ExpandableSectionWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ExpandableSectionWrapper); - }; -ElementWrapper.prototype.findFileUpload = function(selector) { - const rootSelector = \`.\${FileUploadWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FileUploadWrapper); - }; -ElementWrapper.prototype.findFlashbar = function(selector) { - const rootSelector = \`.\${FlashbarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FlashbarWrapper); - }; -ElementWrapper.prototype.findForm = function(selector) { - const rootSelector = \`.\${FormWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); - }; -ElementWrapper.prototype.findFormField = function(selector) { - const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); - }; -ElementWrapper.prototype.findGrid = function(selector) { - const rootSelector = \`.\${GridWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); - }; -ElementWrapper.prototype.findHeader = function(selector) { - const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); - }; -ElementWrapper.prototype.findHelpPanel = function(selector) { - const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); - }; -ElementWrapper.prototype.findHotspot = function(selector) { - const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); - }; -ElementWrapper.prototype.findIcon = function(selector) { - const rootSelector = \`.\${IconWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); - }; -ElementWrapper.prototype.findInput = function(selector) { - const rootSelector = \`.\${InputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); - }; -ElementWrapper.prototype.findKeyValuePairs = function(selector) { - const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); - }; -ElementWrapper.prototype.findLineChart = function(selector) { - const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); - }; -ElementWrapper.prototype.findLink = function(selector) { - const rootSelector = \`.\${LinkWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); - }; -ElementWrapper.prototype.findLiveRegion = function(selector) { - const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); - }; -ElementWrapper.prototype.findMixedLineBarChart = function(selector) { - const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); - }; -ElementWrapper.prototype.findModal = function(selector) { - const rootSelector = \`.\${ModalWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); - }; -ElementWrapper.prototype.findMultiselect = function(selector) { - const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); - }; -ElementWrapper.prototype.findPagination = function(selector) { - const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); - }; -ElementWrapper.prototype.findPieChart = function(selector) { - const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); - }; -ElementWrapper.prototype.findPopover = function(selector) { - const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); - }; -ElementWrapper.prototype.findProgressBar = function(selector) { - const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); - }; -ElementWrapper.prototype.findPromptInput = function(selector) { - const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); - }; -ElementWrapper.prototype.findPropertyFilter = function(selector) { - const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); - }; -ElementWrapper.prototype.findRadioGroup = function(selector) { - const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); - }; -ElementWrapper.prototype.findS3ResourceSelector = function(selector) { - const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); - }; -ElementWrapper.prototype.findSegmentedControl = function(selector) { - const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); - }; -ElementWrapper.prototype.findSelect = function(selector) { - const rootSelector = \`.\${SelectWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); - }; -ElementWrapper.prototype.findSideNavigation = function(selector) { - const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); - }; -ElementWrapper.prototype.findSlider = function(selector) { - const rootSelector = \`.\${SliderWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); - }; -ElementWrapper.prototype.findSpaceBetween = function(selector) { - const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); - }; -ElementWrapper.prototype.findSpinner = function(selector) { - const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); - }; -ElementWrapper.prototype.findSplitPanel = function(selector) { - const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); - }; -ElementWrapper.prototype.findStatusIndicator = function(selector) { - const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); - }; -ElementWrapper.prototype.findSteps = function(selector) { - const rootSelector = \`.\${StepsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); - }; -ElementWrapper.prototype.findTable = function(selector) { - const rootSelector = \`.\${TableWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); - }; -ElementWrapper.prototype.findTabs = function(selector) { - const rootSelector = \`.\${TabsWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); - }; -ElementWrapper.prototype.findTagEditor = function(selector) { - const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); - }; -ElementWrapper.prototype.findTextContent = function(selector) { - const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); - }; -ElementWrapper.prototype.findTextFilter = function(selector) { - const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); - }; -ElementWrapper.prototype.findTextarea = function(selector) { - const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); - }; -ElementWrapper.prototype.findTiles = function(selector) { - const rootSelector = \`.\${TilesWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); - }; -ElementWrapper.prototype.findTimeInput = function(selector) { - const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); - }; -ElementWrapper.prototype.findToggle = function(selector) { - const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); - }; -ElementWrapper.prototype.findToggleButton = function(selector) { - const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); - }; -ElementWrapper.prototype.findTokenGroup = function(selector) { - const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); - }; -ElementWrapper.prototype.findTopNavigation = function(selector) { - const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); - }; -ElementWrapper.prototype.findTutorialPanel = function(selector) { - const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); - }; -ElementWrapper.prototype.findWizard = function(selector) { - const rootSelector = \`.\${WizardWrapper.rootSelector}\`; - // casting to 'any' is needed to avoid this issue with generics - // https://github.com/microsoft/TypeScript/issues/29132 - return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); + ElementWrapper.prototype.findAllFlashbars = function(selector) { + return this.findAllComponents(FlashbarWrapper, selector); + }; + + ElementWrapper.prototype.findFlashbarByTestId = function(testId) { + const selector = \`.\${FlashbarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FlashbarWrapper); + }; + + ElementWrapper.prototype.findForm = function(selector) { + const rootSelector = \`.\${FormWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormWrapper); + }; + + ElementWrapper.prototype.findAllForms = function(selector) { + return this.findAllComponents(FormWrapper, selector); + }; + + ElementWrapper.prototype.findFormByTestId = function(testId) { + const selector = \`.\${FormWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FormWrapper); + }; + + ElementWrapper.prototype.findFormField = function(selector) { + const rootSelector = \`.\${FormFieldWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, FormFieldWrapper); + }; + + ElementWrapper.prototype.findAllFormFields = function(selector) { + return this.findAllComponents(FormFieldWrapper, selector); + }; + + ElementWrapper.prototype.findFormFieldByTestId = function(testId) { + const selector = \`.\${FormFieldWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, FormFieldWrapper); + }; + + ElementWrapper.prototype.findGrid = function(selector) { + const rootSelector = \`.\${GridWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, GridWrapper); + }; + + ElementWrapper.prototype.findAllGrids = function(selector) { + return this.findAllComponents(GridWrapper, selector); + }; + + ElementWrapper.prototype.findGridByTestId = function(testId) { + const selector = \`.\${GridWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, GridWrapper); + }; + + ElementWrapper.prototype.findHeader = function(selector) { + const rootSelector = \`.\${HeaderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HeaderWrapper); + }; + + ElementWrapper.prototype.findAllHeaders = function(selector) { + return this.findAllComponents(HeaderWrapper, selector); + }; + + ElementWrapper.prototype.findHeaderByTestId = function(testId) { + const selector = \`.\${HeaderWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HeaderWrapper); + }; + + ElementWrapper.prototype.findHelpPanel = function(selector) { + const rootSelector = \`.\${HelpPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HelpPanelWrapper); + }; + + ElementWrapper.prototype.findAllHelpPanels = function(selector) { + return this.findAllComponents(HelpPanelWrapper, selector); + }; + + ElementWrapper.prototype.findHelpPanelByTestId = function(testId) { + const selector = \`.\${HelpPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HelpPanelWrapper); + }; + + ElementWrapper.prototype.findHotspot = function(selector) { + const rootSelector = \`.\${HotspotWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, HotspotWrapper); + }; + + ElementWrapper.prototype.findAllHotspots = function(selector) { + return this.findAllComponents(HotspotWrapper, selector); + }; + + ElementWrapper.prototype.findHotspotByTestId = function(testId) { + const selector = \`.\${HotspotWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, HotspotWrapper); + }; + + ElementWrapper.prototype.findIcon = function(selector) { + const rootSelector = \`.\${IconWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, IconWrapper); + }; + + ElementWrapper.prototype.findAllIcons = function(selector) { + return this.findAllComponents(IconWrapper, selector); + }; + + ElementWrapper.prototype.findIconByTestId = function(testId) { + const selector = \`.\${IconWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, IconWrapper); + }; + + ElementWrapper.prototype.findInput = function(selector) { + const rootSelector = \`.\${InputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, InputWrapper); + }; + + ElementWrapper.prototype.findAllInputs = function(selector) { + return this.findAllComponents(InputWrapper, selector); + }; + + ElementWrapper.prototype.findInputByTestId = function(testId) { + const selector = \`.\${InputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, InputWrapper); + }; + + ElementWrapper.prototype.findKeyValuePairs = function(selector) { + const rootSelector = \`.\${KeyValuePairsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, KeyValuePairsWrapper); + }; + + ElementWrapper.prototype.findAllKeyValuePairs = function(selector) { + return this.findAllComponents(KeyValuePairsWrapper, selector); + }; + + ElementWrapper.prototype.findKeyValuePairsByTestId = function(testId) { + const selector = \`.\${KeyValuePairsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, KeyValuePairsWrapper); + }; + + ElementWrapper.prototype.findLineChart = function(selector) { + const rootSelector = \`.\${LineChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LineChartWrapper); + }; + + ElementWrapper.prototype.findAllLineCharts = function(selector) { + return this.findAllComponents(LineChartWrapper, selector); + }; + + ElementWrapper.prototype.findLineChartByTestId = function(testId) { + const selector = \`.\${LineChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LineChartWrapper); + }; + + ElementWrapper.prototype.findLink = function(selector) { + const rootSelector = \`.\${LinkWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LinkWrapper); + }; + + ElementWrapper.prototype.findAllLinks = function(selector) { + return this.findAllComponents(LinkWrapper, selector); + }; + + ElementWrapper.prototype.findLinkByTestId = function(testId) { + const selector = \`.\${LinkWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LinkWrapper); + }; + + ElementWrapper.prototype.findLiveRegion = function(selector) { + const rootSelector = \`.\${LiveRegionWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LiveRegionWrapper); + }; + + ElementWrapper.prototype.findAllLiveRegions = function(selector) { + return this.findAllComponents(LiveRegionWrapper, selector); + }; + + ElementWrapper.prototype.findLiveRegionByTestId = function(testId) { + const selector = \`.\${LiveRegionWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, LiveRegionWrapper); + }; + + ElementWrapper.prototype.findMixedLineBarChart = function(selector) { + const rootSelector = \`.\${MixedLineBarChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MixedLineBarChartWrapper); + }; + + ElementWrapper.prototype.findAllMixedLineBarCharts = function(selector) { + return this.findAllComponents(MixedLineBarChartWrapper, selector); + }; + + ElementWrapper.prototype.findMixedLineBarChartByTestId = function(testId) { + const selector = \`.\${MixedLineBarChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, MixedLineBarChartWrapper); + }; + + ElementWrapper.prototype.findModal = function(selector) { + const rootSelector = \`.\${ModalWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ModalWrapper); + }; + + ElementWrapper.prototype.findAllModals = function(selector) { + return this.findAllComponents(ModalWrapper, selector); + }; + + ElementWrapper.prototype.findModalByTestId = function(testId) { + const selector = \`.\${ModalWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ModalWrapper); + }; + + ElementWrapper.prototype.findMultiselect = function(selector) { + const rootSelector = \`.\${MultiselectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, MultiselectWrapper); + }; + + ElementWrapper.prototype.findAllMultiselects = function(selector) { + return this.findAllComponents(MultiselectWrapper, selector); + }; + + ElementWrapper.prototype.findMultiselectByTestId = function(testId) { + const selector = \`.\${MultiselectWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, MultiselectWrapper); + }; + + ElementWrapper.prototype.findPagination = function(selector) { + const rootSelector = \`.\${PaginationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PaginationWrapper); + }; + + ElementWrapper.prototype.findAllPaginations = function(selector) { + return this.findAllComponents(PaginationWrapper, selector); + }; + + ElementWrapper.prototype.findPaginationByTestId = function(testId) { + const selector = \`.\${PaginationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PaginationWrapper); + }; + + ElementWrapper.prototype.findPieChart = function(selector) { + const rootSelector = \`.\${PieChartWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PieChartWrapper); + }; + + ElementWrapper.prototype.findAllPieCharts = function(selector) { + return this.findAllComponents(PieChartWrapper, selector); + }; + + ElementWrapper.prototype.findPieChartByTestId = function(testId) { + const selector = \`.\${PieChartWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PieChartWrapper); + }; + + ElementWrapper.prototype.findPopover = function(selector) { + const rootSelector = \`.\${PopoverWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PopoverWrapper); + }; + + ElementWrapper.prototype.findAllPopovers = function(selector) { + return this.findAllComponents(PopoverWrapper, selector); + }; + + ElementWrapper.prototype.findPopoverByTestId = function(testId) { + const selector = \`.\${PopoverWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PopoverWrapper); + }; + + ElementWrapper.prototype.findProgressBar = function(selector) { + const rootSelector = \`.\${ProgressBarWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ProgressBarWrapper); + }; + + ElementWrapper.prototype.findAllProgressBars = function(selector) { + return this.findAllComponents(ProgressBarWrapper, selector); + }; + + ElementWrapper.prototype.findProgressBarByTestId = function(testId) { + const selector = \`.\${ProgressBarWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ProgressBarWrapper); + }; + + ElementWrapper.prototype.findPromptInput = function(selector) { + const rootSelector = \`.\${PromptInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PromptInputWrapper); + }; + + ElementWrapper.prototype.findAllPromptInputs = function(selector) { + return this.findAllComponents(PromptInputWrapper, selector); + }; + + ElementWrapper.prototype.findPromptInputByTestId = function(testId) { + const selector = \`.\${PromptInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PromptInputWrapper); + }; + + ElementWrapper.prototype.findPropertyFilter = function(selector) { + const rootSelector = \`.\${PropertyFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, PropertyFilterWrapper); + }; + + ElementWrapper.prototype.findAllPropertyFilters = function(selector) { + return this.findAllComponents(PropertyFilterWrapper, selector); + }; + + ElementWrapper.prototype.findPropertyFilterByTestId = function(testId) { + const selector = \`.\${PropertyFilterWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, PropertyFilterWrapper); + }; + + ElementWrapper.prototype.findRadioGroup = function(selector) { + const rootSelector = \`.\${RadioGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, RadioGroupWrapper); + }; + + ElementWrapper.prototype.findAllRadioGroups = function(selector) { + return this.findAllComponents(RadioGroupWrapper, selector); + }; + + ElementWrapper.prototype.findRadioGroupByTestId = function(testId) { + const selector = \`.\${RadioGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, RadioGroupWrapper); + }; + + ElementWrapper.prototype.findS3ResourceSelector = function(selector) { + const rootSelector = \`.\${S3ResourceSelectorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, S3ResourceSelectorWrapper); + }; + + ElementWrapper.prototype.findAllS3ResourceSelectors = function(selector) { + return this.findAllComponents(S3ResourceSelectorWrapper, selector); + }; + + ElementWrapper.prototype.findS3ResourceSelectorByTestId = function(testId) { + const selector = \`.\${S3ResourceSelectorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, S3ResourceSelectorWrapper); + }; + + ElementWrapper.prototype.findSegmentedControl = function(selector) { + const rootSelector = \`.\${SegmentedControlWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SegmentedControlWrapper); + }; + + ElementWrapper.prototype.findAllSegmentedControls = function(selector) { + return this.findAllComponents(SegmentedControlWrapper, selector); + }; + + ElementWrapper.prototype.findSegmentedControlByTestId = function(testId) { + const selector = \`.\${SegmentedControlWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SegmentedControlWrapper); + }; + + ElementWrapper.prototype.findSelect = function(selector) { + const rootSelector = \`.\${SelectWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SelectWrapper); + }; + + ElementWrapper.prototype.findAllSelects = function(selector) { + return this.findAllComponents(SelectWrapper, selector); + }; + + ElementWrapper.prototype.findSelectByTestId = function(testId) { + const selector = \`.\${SelectWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SelectWrapper); + }; + + ElementWrapper.prototype.findSideNavigation = function(selector) { + const rootSelector = \`.\${SideNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SideNavigationWrapper); + }; + + ElementWrapper.prototype.findAllSideNavigations = function(selector) { + return this.findAllComponents(SideNavigationWrapper, selector); + }; + + ElementWrapper.prototype.findSideNavigationByTestId = function(testId) { + const selector = \`.\${SideNavigationWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SideNavigationWrapper); + }; + + ElementWrapper.prototype.findSlider = function(selector) { + const rootSelector = \`.\${SliderWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SliderWrapper); + }; + + ElementWrapper.prototype.findAllSliders = function(selector) { + return this.findAllComponents(SliderWrapper, selector); + }; + + ElementWrapper.prototype.findSliderByTestId = function(testId) { + const selector = \`.\${SliderWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SliderWrapper); + }; + + ElementWrapper.prototype.findSpaceBetween = function(selector) { + const rootSelector = \`.\${SpaceBetweenWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpaceBetweenWrapper); + }; + + ElementWrapper.prototype.findAllSpaceBetweens = function(selector) { + return this.findAllComponents(SpaceBetweenWrapper, selector); + }; + + ElementWrapper.prototype.findSpaceBetweenByTestId = function(testId) { + const selector = \`.\${SpaceBetweenWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SpaceBetweenWrapper); + }; + + ElementWrapper.prototype.findSpinner = function(selector) { + const rootSelector = \`.\${SpinnerWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SpinnerWrapper); + }; + + ElementWrapper.prototype.findAllSpinners = function(selector) { + return this.findAllComponents(SpinnerWrapper, selector); + }; + + ElementWrapper.prototype.findSpinnerByTestId = function(testId) { + const selector = \`.\${SpinnerWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SpinnerWrapper); + }; + + ElementWrapper.prototype.findSplitPanel = function(selector) { + const rootSelector = \`.\${SplitPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SplitPanelWrapper); + }; + + ElementWrapper.prototype.findAllSplitPanels = function(selector) { + return this.findAllComponents(SplitPanelWrapper, selector); + }; + + ElementWrapper.prototype.findSplitPanelByTestId = function(testId) { + const selector = \`.\${SplitPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, SplitPanelWrapper); + }; + + ElementWrapper.prototype.findStatusIndicator = function(selector) { + const rootSelector = \`.\${StatusIndicatorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StatusIndicatorWrapper); + }; + + ElementWrapper.prototype.findAllStatusIndicators = function(selector) { + return this.findAllComponents(StatusIndicatorWrapper, selector); + }; + + ElementWrapper.prototype.findStatusIndicatorByTestId = function(testId) { + const selector = \`.\${StatusIndicatorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, StatusIndicatorWrapper); + }; + + ElementWrapper.prototype.findSteps = function(selector) { + const rootSelector = \`.\${StepsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, StepsWrapper); + }; + + ElementWrapper.prototype.findAllSteps = function(selector) { + return this.findAllComponents(StepsWrapper, selector); + }; + + ElementWrapper.prototype.findStepsByTestId = function(testId) { + const selector = \`.\${StepsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, StepsWrapper); + }; + + ElementWrapper.prototype.findTable = function(selector) { + const rootSelector = \`.\${TableWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TableWrapper); + }; + + ElementWrapper.prototype.findAllTables = function(selector) { + return this.findAllComponents(TableWrapper, selector); + }; + + ElementWrapper.prototype.findTableByTestId = function(testId) { + const selector = \`.\${TableWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TableWrapper); + }; + + ElementWrapper.prototype.findTabs = function(selector) { + const rootSelector = \`.\${TabsWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TabsWrapper); + }; + + ElementWrapper.prototype.findAllTabs = function(selector) { + return this.findAllComponents(TabsWrapper, selector); + }; + + ElementWrapper.prototype.findTabsByTestId = function(testId) { + const selector = \`.\${TabsWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TabsWrapper); + }; + + ElementWrapper.prototype.findTagEditor = function(selector) { + const rootSelector = \`.\${TagEditorWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TagEditorWrapper); + }; + + ElementWrapper.prototype.findAllTagEditors = function(selector) { + return this.findAllComponents(TagEditorWrapper, selector); + }; + + ElementWrapper.prototype.findTagEditorByTestId = function(testId) { + const selector = \`.\${TagEditorWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TagEditorWrapper); + }; + + ElementWrapper.prototype.findTextContent = function(selector) { + const rootSelector = \`.\${TextContentWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextContentWrapper); + }; + + ElementWrapper.prototype.findAllTextContents = function(selector) { + return this.findAllComponents(TextContentWrapper, selector); + }; + + ElementWrapper.prototype.findTextContentByTestId = function(testId) { + const selector = \`.\${TextContentWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextContentWrapper); + }; + + ElementWrapper.prototype.findTextFilter = function(selector) { + const rootSelector = \`.\${TextFilterWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextFilterWrapper); + }; + + ElementWrapper.prototype.findAllTextFilters = function(selector) { + return this.findAllComponents(TextFilterWrapper, selector); + }; + + ElementWrapper.prototype.findTextFilterByTestId = function(testId) { + const selector = \`.\${TextFilterWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextFilterWrapper); + }; + + ElementWrapper.prototype.findTextarea = function(selector) { + const rootSelector = \`.\${TextareaWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TextareaWrapper); + }; + + ElementWrapper.prototype.findAllTextareas = function(selector) { + return this.findAllComponents(TextareaWrapper, selector); + }; + + ElementWrapper.prototype.findTextareaByTestId = function(testId) { + const selector = \`.\${TextareaWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TextareaWrapper); + }; + + ElementWrapper.prototype.findTiles = function(selector) { + const rootSelector = \`.\${TilesWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TilesWrapper); + }; + + ElementWrapper.prototype.findAllTiles = function(selector) { + return this.findAllComponents(TilesWrapper, selector); + }; + + ElementWrapper.prototype.findTilesByTestId = function(testId) { + const selector = \`.\${TilesWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TilesWrapper); + }; + + ElementWrapper.prototype.findTimeInput = function(selector) { + const rootSelector = \`.\${TimeInputWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TimeInputWrapper); + }; + + ElementWrapper.prototype.findAllTimeInputs = function(selector) { + return this.findAllComponents(TimeInputWrapper, selector); + }; + + ElementWrapper.prototype.findTimeInputByTestId = function(testId) { + const selector = \`.\${TimeInputWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TimeInputWrapper); + }; + + ElementWrapper.prototype.findToggle = function(selector) { + const rootSelector = \`.\${ToggleWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleWrapper); + }; + + ElementWrapper.prototype.findAllToggles = function(selector) { + return this.findAllComponents(ToggleWrapper, selector); + }; + + ElementWrapper.prototype.findToggleByTestId = function(testId) { + const selector = \`.\${ToggleWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ToggleWrapper); + }; + + ElementWrapper.prototype.findToggleButton = function(selector) { + const rootSelector = \`.\${ToggleButtonWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ToggleButtonWrapper); + }; + + ElementWrapper.prototype.findAllToggleButtons = function(selector) { + return this.findAllComponents(ToggleButtonWrapper, selector); + }; + + ElementWrapper.prototype.findToggleButtonByTestId = function(testId) { + const selector = \`.\${ToggleButtonWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, ToggleButtonWrapper); + }; + + ElementWrapper.prototype.findTokenGroup = function(selector) { + const rootSelector = \`.\${TokenGroupWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TokenGroupWrapper); + }; + + ElementWrapper.prototype.findAllTokenGroups = function(selector) { + return this.findAllComponents(TokenGroupWrapper, selector); + }; + + ElementWrapper.prototype.findTokenGroupByTestId = function(testId) { + const selector = \`.\${TokenGroupWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TokenGroupWrapper); + }; + + ElementWrapper.prototype.findTopNavigation = function(selector) { + const rootSelector = \`.\${TopNavigationWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TopNavigationWrapper); + }; + + ElementWrapper.prototype.findTutorialPanel = function(selector) { + const rootSelector = \`.\${TutorialPanelWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, TutorialPanelWrapper); + }; + + ElementWrapper.prototype.findAllTutorialPanels = function(selector) { + return this.findAllComponents(TutorialPanelWrapper, selector); + }; + + ElementWrapper.prototype.findTutorialPanelByTestId = function(testId) { + const selector = \`.\${TutorialPanelWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, TutorialPanelWrapper); + }; + + ElementWrapper.prototype.findWizard = function(selector) { + const rootSelector = \`.\${WizardWrapper.rootSelector}\`; + // casting to 'any' is needed to avoid this issue with generics + // https://github.com/microsoft/TypeScript/issues/29132 + return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, WizardWrapper); + }; + + ElementWrapper.prototype.findAllWizards = function(selector) { + return this.findAllComponents(WizardWrapper, selector); + }; + + ElementWrapper.prototype.findWizardByTestId = function(testId) { + const selector = \`.\${WizardWrapper.rootSelector}[data-testid="\${CSS.escape(testId)}"]\`; + return this.findComponent(selector, WizardWrapper); }; export default function wrapper(root: string = 'body') { return new ElementWrapper(root); }" `; From 5b056ba93e34f1cd966a83e0c035b24b8107ec14 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Thu, 14 Nov 2024 12:43:08 +0100 Subject: [PATCH 10/12] feat: Adds test id to cards (#2976) --- src/cards/__tests__/cards.test.tsx | 124 +++++++++++++++++++++++++++-- src/cards/index.tsx | 10 ++- src/cards/interfaces.tsx | 18 +++++ src/test-utils/dom/cards/index.ts | 27 +++++++ 4 files changed, 171 insertions(+), 8 deletions(-) diff --git a/src/cards/__tests__/cards.test.tsx b/src/cards/__tests__/cards.test.tsx index cb52a5102c..5d8b4bae0b 100644 --- a/src/cards/__tests__/cards.test.tsx +++ b/src/cards/__tests__/cards.test.tsx @@ -27,6 +27,7 @@ function findFooterPagination(wrapper: CardsWrapper): PaginationWrapper | null { const cardDefinition: CardsProps.CardDefinition = { header: item => `Header ${item.name}`, + testId: item => `card-${item.id}`, sections: [ { id: 'description', @@ -59,14 +60,19 @@ describe('Cards', () => { // index is 0-based const getCard = (index: number) => wrapper.findItems()[index]; - const getCardHeader = (index: number) => getCard(index)?.findCardHeader()?.getElement(); + const getCardByTestId = (testId: string) => wrapper.findItemByTestId(testId)!; + + const getCardHeader = (index: number) => wrapper.findItems()[index]?.findCardHeader()?.getElement(); // index is 0-based - const getCardsSections = (index: number) => getCard(index).findSections(); + const getCardsSections = (index: number) => wrapper.findItems()[index].findSections(); // cardIndex and sectionIndex are 0-based const getCardSection = (cardIndex: number, sectionIndex: number) => getCardsSections(cardIndex)[sectionIndex]; + const getCardSectionByTestId = (cardIndex: number, sectionTestId: string) => + getCard(cardIndex)!.findSectionByTestId(sectionTestId)!; + const getCardSectionHeader = (cardIndex: number, sectionIndex: number) => getCardSection(cardIndex, sectionIndex)?.findSectionHeader()?.getElement(); @@ -85,8 +91,7 @@ describe('Cards', () => { wrapper = renderCards( cardDefinition={cardDefinition} items={defaultItems} selectionType="single" /> ).wrapper; - - const cardsOrderedList = getCard(0).getElement().parentElement; + const cardsOrderedList = getCardByTestId('card-1').getElement().parentElement; expect(cardsOrderedList).toHaveAttribute('role', 'group'); }); @@ -142,6 +147,7 @@ describe('Cards', () => { sections: [ { content: item => item.name, + testId: item => `card-${item.id}-content-section`, }, ], }} @@ -151,7 +157,8 @@ describe('Cards', () => { defaultItems.forEach((item, idx) => { expect(getCardsSections(idx)).toHaveLength(1); - expect(getCardSection(idx, 0).findSectionHeader()).toBe(null); + const sectionTestId = `card-${idx + 1}-content-section`; + expect(getCardSectionByTestId(idx, sectionTestId).findSectionHeader()).toBe(null); expect(getCardSectionContent(idx, 0)).toHaveTextContent(item.name); }); }); @@ -176,6 +183,36 @@ describe('Cards', () => { expect(getCardSection(idx, 0)?.findContent()).toBe(null); }); }); + + it('assigns test id attributes to the cards and sections', () => { + const { wrapper } = renderCards( + + cardDefinition={{ + testId: item => `${item.name}-${item.id}`, + sections: [ + { + testId: item => `${item.name}-${item.id}-id-section`, + header: 'id', + }, + { + testId: item => `${item.name}-${item.id}-name-section`, + header: 'name', + }, + ], + }} + items={defaultItems} + /> + ); + + const itemTestIds = wrapper.findItems().map(item => item.getElement()!.getAttribute('data-testid')); + expect(itemTestIds).toEqual(['Apples-1', 'Oranges-2', 'Bananas-3']); + + const secondItemSectionTestIds = wrapper + .findItems()[1] + .findSections() + .map(section => section.getElement()!.getAttribute('data-testid')); + expect(secondItemSectionTestIds).toEqual(['Oranges-2-id-section', 'Oranges-2-name-section']); + }); }); describe('header region', () => { @@ -308,10 +345,85 @@ describe('Cards', () => { cardDefinition={cardDefinition} selectionType="multi" items={defaultItems} /> )); - expect(getCard(0).findSelectionArea()!.getElement()).toHaveAttribute( + expect(getCardByTestId('card-1').findSelectionArea()!.getElement()).toHaveAttribute( 'aria-label', expect.stringContaining('Custom label') ); }); }); + + describe('test utils', () => { + it('findItemByTestId returns the card by test id', () => { + const { wrapper } = renderCards( + + cardDefinition={{ + testId: item => `card-${item.id}`, + sections: [ + { + content: item => item.name, + }, + ], + }} + items={defaultItems} + /> + ); + + expect(wrapper.findItemByTestId('card-2')!.getElement()).toHaveTextContent('Orange'); + }); + + it('findItemByTestId returns the card even if test id contains quotes', () => { + const { wrapper } = renderCards( + + cardDefinition={{ + testId: item => `card-"${item.id}"`, + }} + items={defaultItems} + /> + ); + + expect(wrapper.findItemByTestId('card-"2"')).toBeTruthy(); + }); + + it('findSectionByTestId returns the section by test id', () => { + const { wrapper } = renderCards( + + cardDefinition={{ + sections: [ + { + content: item => `Item ID: ${item.id}`, + testId: item => `card-${item.id}-id`, + }, + { + content: item => `Item Name: ${item.name}`, + testId: item => `card-${item.id}-name`, + }, + ], + }} + items={defaultItems} + /> + ); + + const firstItem = wrapper.findItems()[0]!; + expect(firstItem.findSectionByTestId('card-1-id')!.getElement()).toHaveTextContent('Item ID: 1'); + expect(firstItem.findSectionByTestId('card-1-name')!.getElement()).toHaveTextContent('Item Name: Apples'); + }); + + it('findSectionByTestId returns the section even if test id contains quotes', () => { + const { wrapper } = renderCards( + + cardDefinition={{ + sections: [ + { + testId: item => `card-section-"${item.id}"`, + }, + ], + }} + items={defaultItems} + /> + ); + + const firstItem = wrapper.findItems()[0]!; + expect(firstItem.findSectionByTestId('card-section-"1"')).toBeTruthy(); + }); + }); }); diff --git a/src/cards/index.tsx b/src/cards/index.tsx index 5dbecb0433..67cbcdd923 100644 --- a/src/cards/index.tsx +++ b/src/cards/index.tsx @@ -271,6 +271,7 @@ const CardsList = ({ [styles['card-selected']]: selectable && isItemSelected(item), })} key={getItemKey(trackBy, item, index)} + data-testid={cardDefinition.testId?.(item)} onFocus={onFocus} {...(focusMarkers && focusMarkers.item)} role={listItemRole} @@ -301,8 +302,13 @@ const CardsList = ({
    )}
    - {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => ( -
    + {visibleSectionsDefinition.map(({ width = 100, header, content, id, testId }, index) => ( +
    {header ?
    {header}
    : ''} {content ?
    {content(item)}
    : ''}
    diff --git a/src/cards/interfaces.tsx b/src/cards/interfaces.tsx index 25b0066f3f..eb786fb2c0 100644 --- a/src/cards/interfaces.tsx +++ b/src/cards/interfaces.tsx @@ -223,6 +223,15 @@ export namespace CardsProps { export interface CardDefinition { header?(item: T): React.ReactNode; sections?: ReadonlyArray>; + + /** + * Returns the test ID for each card item. + * Returned value is assigned to the `data-testid` attribute of the card's root element. + * + * @param {T} item Single item from the specified `items` array. + * @returns {string} Test id to be assigned to the corresponding card. + */ + testId?(item: T): string; } export interface SectionDefinition { @@ -230,6 +239,15 @@ export namespace CardsProps { header?: React.ReactNode; content?(item: T): React.ReactNode; width?: number; + + /** + * Returns the test ID for each section item. + * Returned value is assigned to the `data-testid` attribute of the section's root element. + * + * @param {T} item Single item from the specified `items` array. + * @returns {string} Test id to be assigned to the corresponding section. + */ + testId?(item: T): string; } export interface CardsLayout { diff --git a/src/test-utils/dom/cards/index.ts b/src/test-utils/dom/cards/index.ts index 71b1afcb0b..3afc8b0936 100644 --- a/src/test-utils/dom/cards/index.ts +++ b/src/test-utils/dom/cards/index.ts @@ -1,6 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom'; +import { escapeSelector } from '@cloudscape-design/test-utils-core/utils'; import CollectionPreferencesWrapper from '../collection-preferences'; import ContainerWrapper from '../container'; @@ -30,6 +31,19 @@ export class CardWrapper extends ComponentWrapper { return this.findAllByClassName(styles.section).map(c => new CardSectionWrapper(c.getElement())); } + /** + * Returns the wrapper of the first card section that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `sections.testId` prop. + * If no matching card section is found, returns `null`. + * + * @param {string} testId + * @returns {CardSectionWrapper | null} + */ + findSectionByTestId(testId: string): CardSectionWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent(`.${styles.section}[data-testid="${escapedTestId}"]`, CardSectionWrapper); + } + findCardHeader(): ElementWrapper | null { return this.findByClassName(styles['card-header-inner']); } @@ -48,6 +62,19 @@ export default class CardsWrapper extends ComponentWrapper { return this.findAllByClassName(styles.card).map(c => new CardWrapper(c.getElement())); } + /** + * Returns the wrapper of the first card that matches the specified test ID. + * Looks for the `data-testid` attribute that is assigned via `cardDefinition.testId` prop. + * If no matching card is found, returns `null`. + * + * @param {string} testId + * @returns {CardWrapper | null} + */ + findItemByTestId(testId: string): CardWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent(`.${styles.card}[data-testid="${escapedTestId}"]`, CardWrapper); + } + findSelectedItems(): Array { return this.findAllByClassName(styles['card-selected']).map(c => new CardWrapper(c.getElement())); } From 860d4fefff2730f2186a74ac22cacd150406f08d Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Fri, 15 Nov 2024 11:43:52 +0100 Subject: [PATCH 11/12] feat: Adds test id to side navigation (#2972) --- .../complex-side-navigation.test.tsx | 75 +++++++++++- .../__tests__/side-navigation.test.tsx | 108 ++++++++++++++++-- src/side-navigation/interfaces.tsx | 36 ++++++ src/side-navigation/parts.tsx | 12 +- src/test-utils/dom/side-navigation/index.ts | 30 +++++ 5 files changed, 243 insertions(+), 18 deletions(-) diff --git a/src/side-navigation/__tests__/complex-side-navigation.test.tsx b/src/side-navigation/__tests__/complex-side-navigation.test.tsx index a6dc9f73a4..851bd7b196 100644 --- a/src/side-navigation/__tests__/complex-side-navigation.test.tsx +++ b/src/side-navigation/__tests__/complex-side-navigation.test.tsx @@ -22,18 +22,26 @@ it('Side navigation with all possible items', async () => { type: 'link', text: 'Page 1', href: '#/page1', + // this test id deliberately contains double quotes + // to test the selector escaping + testId: '"link-page-1"', info: 1, }, { type: 'divider', + testId: 'divider-1', }, { type: 'section', text: 'Section 1', + testId: 'section-1', items: [ { type: 'link', text: 'Page 2', + // this test id deliberately contains double quotes + // to test the selector escaping + testId: '"link-page-2"', href: '#/page2', info: ( @@ -47,48 +55,57 @@ it('Side navigation with all possible items', async () => { href: '#/page3', external: true, externalIconAriaLabel: 'Opens in a new tab', + testId: 'link-page-3', }, { type: 'divider' }, { type: 'link', text: 'Page 4', href: '#/page4', + testId: 'link-page-4', }, { type: 'link', text: 'Page 5', href: '#/page5', + testId: 'link-page-5', }, ], }, - { type: 'divider' }, + { type: 'divider', testId: 'divider-2' }, { type: 'section-group', + testId: 'section-group-1', title: 'Section group 1', items: [ { type: 'link', text: 'Page 6', href: '#/page6', + testId: 'link-page-6', }, { type: 'link', text: 'Page 7', href: '#/page7', + testId: 'link-page-7', }, { type: 'section', text: 'Section 2', + testId: 'section-2', items: [ { type: 'link', text: 'Page 8', href: '#/page8', + testId: 'link-page-8', }, { type: 'link', text: 'Page 9', href: '#/page9', + testId: 'link-page-9', }, ], }, @@ -97,67 +114,85 @@ it('Side navigation with all possible items', async () => { text: 'Expandable link group', href: '#/exp-link-group', defaultExpanded: true, + testId: 'expandable-link-group-1', items: [ { type: 'link', text: 'Page 10', href: '#/page10', + testId: 'link-page-10', }, { type: 'link', text: 'Page 11', href: '#/page11', + testId: 'link-page-11', + }, + { + type: 'divider', + testId: 'divider-3', }, - { type: 'divider' }, { type: 'link', text: 'Page 12', href: '#/page12', + testId: 'link-page-12', }, { type: 'link', text: 'Page 13', href: '#/page13', + testId: 'link-page-13', }, ], }, ], }, - { type: 'divider' }, + { + type: 'divider', + testId: 'divider-4', + }, { type: 'section-group', title: 'Section group 2', + testId: 'section-group-2', items: [ { type: 'link', text: 'Page 14', href: '#/page14', + testId: 'link-page-14', }, { type: 'link-group', text: 'Link group', href: '#/link-group', + testId: 'link-group-1', items: [ { type: 'link', text: 'Page 15', href: '#/page15', + testId: 'link-page-15', }, { type: 'link', text: 'Page 16', href: '#/page16', + testId: 'link-page-16', }, - { type: 'divider' }, + { type: 'divider', testId: 'divider-5' }, { type: 'link', text: 'Page 17', href: '#/page17', + testId: 'link-page-17', }, { type: 'link', text: 'Page 18', href: '#/page18', + testId: 'link-page-18', }, ], }, @@ -176,8 +211,10 @@ it('Side navigation with all possible items', async () => { }); expect(wrapper.findItemByIndex(1)!.findLink()!.getElement()).toHaveTextContent('Page 1'); + expect(wrapper.findItemByTestId('"link-page-1"')!.findLink()!.getElement()).toHaveTextContent('Page 1'); expect(wrapper.findItemByIndex(2)!.findDivider()).toBeTruthy(); + expect(wrapper.findItemByTestId('divider-1')).toBeTruthy(); // Section 1 with 1 divider expect(wrapper.findItemByIndex(3)!.findSectionTitle()!.getElement()).toHaveTextContent('Section 1'); @@ -185,11 +222,19 @@ it('Side navigation with all possible items', async () => { expect(wrapper.findItemByIndex(3)!.findItemByIndex(3)!.findDivider()).toBeTruthy(); expect(wrapper.findItemByIndex(3)!.findItemByIndex(4)!.findLink()!.getElement()).toHaveTextContent('Page 4'); + // Using test ids + expect(wrapper.findItemByTestId('section-1')!.getElement()).toHaveTextContent('Section 1'); + expect(wrapper.findItemByTestId('section-1')!.findItemByTestId('"link-page-2"')!.getElement()).toHaveTextContent( + 'Page 2' + ); + expect(wrapper.findItemByTestId('"link-page-2"')!.getElement()).toHaveTextContent('Page 2'); + expect(wrapper.findItemByIndex(4)!.findDivider()).toBeTruthy(); // Section group 1 expect(wrapper.findItemByIndex(5)!.findSectionGroupTitle()!.getElement()).toHaveTextContent('Section group 1'); expect(wrapper.findItemByIndex(5)!.findItemByIndex(1)!.findLink()!.getElement()).toHaveTextContent('Page 6'); + // Section 2 inside Section group 1 expect(wrapper.findItemByIndex(5)!.findItemByIndex(3)!.findSectionTitle()!.getElement()).toHaveTextContent( 'Section 2' @@ -197,6 +242,18 @@ it('Side navigation with all possible items', async () => { expect( wrapper.findItemByIndex(5)!.findItemByIndex(3)!.findItemByIndex(1)!.findLink()!.getElement() ).toHaveTextContent('Page 8'); + + // Using test ids + expect(wrapper.findItemByTestId('section-group-1')!.getElement()).toHaveTextContent('Section group 1'); + expect(wrapper.findItemByTestId('link-page-8')!.getElement()).toHaveTextContent('Page 8'); + expect( + wrapper + .findItemByTestId('section-group-1')! + .findItemByTestId('section-2')! + .findItemByTestId('link-page-8')! + .getElement() + ).toHaveTextContent('Page 8'); + // Expandable link group inside Section group 1 expect(wrapper.findItemByIndex(5)!.findItemByIndex(4)!.findExpandableLinkGroup()).toBeTruthy(); expect( @@ -213,6 +270,16 @@ it('Side navigation with all possible items', async () => { expect(wrapper.findItemByIndex(6)!.findDivider()).toBeTruthy(); + // Using test ids + expect( + wrapper + .findItemByTestId('section-group-1')! + .findItemByTestId('expandable-link-group-1')! + .findItemByTestId('link-page-10')! + .getElement() + ).toHaveTextContent('Page 10'); + expect(wrapper.findItemByTestId('link-page-10')!.getElement()).toHaveTextContent('Page 10'); + // Section group 2 expect(wrapper.findItemByIndex(7)!.findSectionGroupTitle()!.getElement()).toHaveTextContent('Section group 2'); expect(wrapper.findItemByIndex(7)!.findItemByIndex(2)!.findLink()!.getElement()).toHaveTextContent('Link group'); diff --git a/src/side-navigation/__tests__/side-navigation.test.tsx b/src/side-navigation/__tests__/side-navigation.test.tsx index 6cc404d26c..f8322ecfa4 100644 --- a/src/side-navigation/__tests__/side-navigation.test.tsx +++ b/src/side-navigation/__tests__/side-navigation.test.tsx @@ -40,14 +40,6 @@ describe('SideNavigation', () => { expect(wrapper.findItemByIndex(2)?.findLink()?.getElement()).toHaveTextContent('Page 2'); }); - it('renders dividers', () => { - const wrapper = renderSideNavigation({ - items: [{ type: 'divider' }], - }); - - expect(wrapper.findItemByIndex(1)?.findDivider()).toBeTruthy(); - }); - it('re-renders different section types correctly', () => { const { wrapper, rerender } = renderUpdatableSideNavigation({ items: [ @@ -191,6 +183,31 @@ describe('SideNavigation', () => { }); }); + describe('Divider', () => { + it('renders dividers', () => { + const wrapper = renderSideNavigation({ + items: [{ type: 'divider' }], + }); + + expect(wrapper.findItemByIndex(1)?.findDivider()).toBeTruthy(); + }); + + it('assigns test ids to the dividers', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'divider', testId: 'divider-1-test-id' }, + { type: 'divider', testId: 'divider-2-test-id' }, + ], + }); + + const firstDivider = wrapper.findItemByIndex(1)!.getElement(); + const secondDivider = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstDivider).toHaveAttribute('data-testid', 'divider-1-test-id'); + expect(secondDivider).toHaveAttribute('data-testid', 'divider-2-test-id'); + }); + }); + describe('Section Group', () => { it('has specified title', () => { const wrapper = renderSideNavigation({ items: [{ type: 'section-group', title: 'Section Group', items: [] }] }); @@ -202,6 +219,21 @@ describe('SideNavigation', () => { expect(wrapper.findItemByIndex(1)?.findSectionGroup()!.getElement()!.children[0]!.tagName).toBe('H3'); expect(wrapper.find('h3')!.getElement()).toHaveTextContent('Section Group'); }); + + it('assigns test ids to the section groups', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'section-group', title: 'Section Group', testId: 'section-group-1-test-id', items: [] }, + { type: 'section-group', title: 'Section Group', testId: 'section-group-2-test-id', items: [] }, + ], + }); + + const firstGroup = wrapper.findItemByIndex(1)!.getElement(); + const secondGroup = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstGroup).toHaveAttribute('data-testid', 'section-group-1-test-id'); + expect(secondGroup).toHaveAttribute('data-testid', 'section-group-2-test-id'); + }); }); describe('Link', () => { @@ -293,6 +325,21 @@ describe('SideNavigation', () => { expect(wrapper.findItemByIndex(1)?.findLink()?.getElement()).toHaveTextContent('Page 1'); }); + + it('assigns test ids to the links', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'link', href: 'http://link/1', text: 'Page 1', testId: 'link-1-test-id' }, + { type: 'link', href: 'http://link/2', text: 'Page 2', testId: 'link-2-test-id' }, + ], + }); + + const firstLink = wrapper.findItemByIndex(1)!.getElement(); + const secondLink = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstLink).toHaveAttribute('data-testid', 'link-1-test-id'); + expect(secondLink).toHaveAttribute('data-testid', 'link-2-test-id'); + }); }); describe('Section', () => { @@ -602,6 +649,21 @@ describe('SideNavigation', () => { expect(onChange).toHaveBeenCalledTimes(2); }); }); + + it('assigns test ids to the sections', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'section', text: 'Page 1', testId: 'link-1-test-id', items: [] }, + { type: 'section', text: 'Page 2', testId: 'link-2-test-id', items: [] }, + ], + }); + + const firstSection = wrapper.findItemByIndex(1)!.getElement(); + const secondSection = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstSection).toHaveAttribute('data-testid', 'link-1-test-id'); + expect(secondSection).toHaveAttribute('data-testid', 'link-2-test-id'); + }); }); describe('LinkGroup', () => { @@ -670,6 +732,21 @@ describe('SideNavigation', () => { 'Additional info' ); }); + + it('assigns test ids to the link group', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'link-group', text: 'Page 1', href: 'http://link/1', testId: 'link-1-test-id', items: [] }, + { type: 'link-group', text: 'Page 2', href: 'http://link/2', testId: 'link-2-test-id', items: [] }, + ], + }); + + const firstLinkGroup = wrapper.findItemByIndex(1)!.getElement(); + const secondLinkGroup = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstLinkGroup).toHaveAttribute('data-testid', 'link-1-test-id'); + expect(secondLinkGroup).toHaveAttribute('data-testid', 'link-2-test-id'); + }); }); describe('Expandable Link Group', () => { @@ -990,6 +1067,21 @@ describe('SideNavigation', () => { expect(wrapper.findItemByIndex(2)?.findLink()?.getElement()).toHaveAttribute('aria-expanded', 'false'); }); + it('assigns test ids to the expandable links', () => { + const wrapper = renderSideNavigation({ + items: [ + { type: 'expandable-link-group', href: 'http://link/1', text: 'Page 1', testId: 'link-1-test-id', items: [] }, + { type: 'expandable-link-group', href: 'http://link/2', text: 'Page 2', testId: 'link-2-test-id', items: [] }, + ], + }); + + const firstLink = wrapper.findItemByIndex(1)!.getElement(); + const secondLink = wrapper.findItemByIndex(2)!.getElement(); + + expect(firstLink).toHaveAttribute('data-testid', 'link-1-test-id'); + expect(secondLink).toHaveAttribute('data-testid', 'link-2-test-id'); + }); + describe('when clicking on the title link', () => { it('gets expanded', () => { const wrapper = renderSideNavigation({ diff --git a/src/side-navigation/interfaces.tsx b/src/side-navigation/interfaces.tsx index c3241d9bc5..7bc52f8b73 100644 --- a/src/side-navigation/interfaces.tsx +++ b/src/side-navigation/interfaces.tsx @@ -139,6 +139,12 @@ export namespace SideNavigationProps { export interface Divider { type: 'divider'; + + /** + * Test ID of the divider. + * Assigns this value to the `data-testid` attribute of the divider's root element. + */ + testId?: string; } export interface Link { @@ -148,6 +154,12 @@ export namespace SideNavigationProps { external?: boolean; externalIconAriaLabel?: string; info?: React.ReactNode; + + /** + * Test ID of the link. + * Assigns this value to the `data-testid` attribute of the link's root element. + */ + testId?: string; } export interface Section { @@ -155,12 +167,24 @@ export namespace SideNavigationProps { text: string; items: ReadonlyArray; defaultExpanded?: boolean; + + /** + * Test ID of the section item. + * Assigns this value to the `data-testid` attribute of the section's root element. + */ + testId?: string; } export interface SectionGroup { type: 'section-group'; title: string; items: ReadonlyArray
    ; + + /** + * Test ID of the section group. + * Assigns this value to the `data-testid` attribute of the section group's root element. + */ + testId?: string; } export interface LinkGroup { type: 'link-group'; @@ -168,6 +192,12 @@ export namespace SideNavigationProps { href: string; info?: React.ReactNode; items: ReadonlyArray; + + /** + * Test ID of the link group item. + * Assigns this value to the `data-testid` attribute of the link group's root element. + */ + testId?: string; } export interface ExpandableLinkGroup { @@ -176,6 +206,12 @@ export namespace SideNavigationProps { href: string; items: ReadonlyArray; defaultExpanded?: boolean; + + /** + * Test ID of the expandable link group item. + * Assigns this value to the `data-testid` attribute of the expandable link group's root element. + */ + testId?: string; } export type Item = Divider | Link | Section | LinkGroup | ExpandableLinkGroup | SectionGroup; diff --git a/src/side-navigation/parts.tsx b/src/side-navigation/parts.tsx index eade9211ce..fa7361d179 100644 --- a/src/side-navigation/parts.tsx +++ b/src/side-navigation/parts.tsx @@ -120,7 +120,7 @@ export function NavigationItemsList({ const dividerIndex = lists.length; lists[dividerIndex] = { element: ( -
    +
    ), @@ -135,7 +135,7 @@ export function NavigationItemsList({ case 'link': { lists[currentListIndex].items?.push({ element: ( -
  • +
  • +
  • +
  • +
  • +
  • { return this.findAll('li').map(wrapper => new SideNavigationItemWrapper(wrapper.getElement())); } From 720d0021fd1f52e2cfcc686bbf0615aeb52b8105 Mon Sep 17 00:00:00 2001 From: Amir Alami Date: Fri, 15 Nov 2024 11:44:28 +0100 Subject: [PATCH 12/12] feat: Adds test id to select items (#2961) --- .../__tests__/autosuggest.test.tsx | 53 +++++++++-- src/internal/components/option/index.tsx | 9 +- src/internal/components/option/interfaces.ts | 8 ++ .../__tests__/multiselect.test.tsx | 19 ++++ src/multiselect/__tests__/test-utils.test.tsx | 49 +++++++++- src/select/__tests__/common.ts | 7 +- src/select/__tests__/select.test.tsx | 11 +++ src/select/__tests__/test-utils.test.tsx | 91 ++++++++++++++++++- src/test-utils/dom/autosuggest/index.ts | 16 ++++ src/test-utils/dom/internal/dropdown-host.ts | 31 +++++++ 10 files changed, 277 insertions(+), 17 deletions(-) diff --git a/src/autosuggest/__tests__/autosuggest.test.tsx b/src/autosuggest/__tests__/autosuggest.test.tsx index ce2d0fb3d9..df8114f8d2 100644 --- a/src/autosuggest/__tests__/autosuggest.test.tsx +++ b/src/autosuggest/__tests__/autosuggest.test.tsx @@ -9,14 +9,15 @@ import { KeyCode } from '@cloudscape-design/test-utils-core/utils'; import '../../__a11y__/to-validate-a11y'; import Autosuggest, { AutosuggestProps } from '../../../lib/components/autosuggest'; import createWrapper from '../../../lib/components/test-utils/dom'; +import OptionWrapper from '../../../lib/components/test-utils/dom/internal/option'; import styles from '../../../lib/components/autosuggest/styles.css.js'; import itemStyles from '../../../lib/components/internal/components/selectable-item/styles.css.js'; import statusIconStyles from '../../../lib/components/status-indicator/styles.selectors.js'; const defaultOptions: AutosuggestProps.Options = [ - { value: '1', label: 'One' }, - { value: '2', lang: 'fr' }, + { value: '1', label: 'One', testId: 'option-1-test-id' }, + { value: '2', lang: 'fr', testId: 'option-2-test-id' }, ]; const groupOptions: AutosuggestProps.Options = [ { label: 'Group 1', options: [{ value: '1' }, { value: '2' }] }, @@ -140,6 +141,22 @@ test('should not close dropdown when no realted target in blur', () => { expect(wrapper.findDropdown().findOpenDropdown()).toBe(null); }); +test('assigns test-id to the option inside each item', () => { + const { wrapper } = renderAutosuggest(); + wrapper.findNativeInput().focus(); + const optionTestIds = wrapper + .findDropdown() + .findOptions() + .map(option => { + // findOption in autosuggest doesn't return the actual option, + // rather the selectable item around the option. + const optionWrapper = option.find(`.${OptionWrapper.rootSelector}`); + return optionWrapper!.getElement().getAttribute('data-testid'); + }); + + expect(optionTestIds).toEqual(['option-1-test-id', 'option-2-test-id']); +}); + describe('onSelect', () => { test('should select normal value', () => { const onChange = jest.fn(); @@ -517,11 +534,29 @@ describe('Ref', () => { }); }); -test('findOptionInGroup', () => { - const { container } = render( - {}} enteredTextLabel={() => 'Use value'} options={groupOptions} /> - ); - const wrapper = createWrapper(container).findAutosuggest()!; - wrapper.findNativeInput().focus(); - expect(wrapper.findDropdown().findOptionInGroup(1, 2)).toBeTruthy(); +describe('test utils', () => { + test('findOptionInGroup', () => { + const { wrapper } = renderAutosuggest(); + wrapper.findNativeInput().focus(); + + expect(wrapper.findDropdown().findOptionInGroup(1, 2)).toBeTruthy(); + }); + + test('findOptionByTestId returns the option by test id', () => { + const { wrapper } = renderAutosuggest(); + wrapper.findNativeInput().focus(); + const option = wrapper.findDropdown()!.findOptionByTestId('option-2-test-id')!.getElement(); + + expect(option).toHaveTextContent('2'); + }); + + test('findOptionByTestId returns the option by test id even if test id contains double quotes', () => { + const { wrapper } = renderAutosuggest( + + ); + wrapper.findNativeInput().focus(); + const option = wrapper.findDropdown()!.findOptionByTestId('"option-test-id"')!.getElement(); + + expect(option).toHaveTextContent('Test Option'); + }); }); diff --git a/src/internal/components/option/index.tsx b/src/internal/components/option/index.tsx index d65a17b8fe..0bd925e970 100644 --- a/src/internal/components/option/index.tsx +++ b/src/internal/components/option/index.tsx @@ -79,7 +79,14 @@ const Option = ({ : undefined; return ( - + {icon} diff --git a/src/internal/components/option/interfaces.ts b/src/internal/components/option/interfaces.ts index 2373b2b76d..4fd8d2bc4d 100644 --- a/src/internal/components/option/interfaces.ts +++ b/src/internal/components/option/interfaces.ts @@ -19,6 +19,14 @@ export interface BaseOption { iconName?: IconProps.Name; iconUrl?: string; iconSvg?: React.ReactNode; + + /** + * Test ID of the option item. + * Assigns this value to the `data-testid` attribute of the option's root element. + * + * Note: In autosuggest component, test id is not applied to the option groups. + */ + testId?: string; } export interface OptionDefinition extends BaseOption { diff --git a/src/multiselect/__tests__/multiselect.test.tsx b/src/multiselect/__tests__/multiselect.test.tsx index 00962a04df..f115c8ba35 100644 --- a/src/multiselect/__tests__/multiselect.test.tsx +++ b/src/multiselect/__tests__/multiselect.test.tsx @@ -816,3 +816,22 @@ test('group options can have description, label tag, tags, disabled reason', () expect(groupOption.findTags()![1].getElement().textContent).toBe('Tag 2'); expect(groupOption.findDisabledReason()!.getElement().textContent).toBe('Disabled reason'); }); + +test('assigns test-id to the options', () => { + const { wrapper } = renderMultiselect( + + ); + wrapper.openDropdown(); + const optionTestIds = wrapper + .findDropdown() + .findOptions() + .map(option => option.getElement().getAttribute('data-testid')); + + expect(optionTestIds).toEqual(['option-1-test-id', 'option-2-test-id']); +}); diff --git a/src/multiselect/__tests__/test-utils.test.tsx b/src/multiselect/__tests__/test-utils.test.tsx index 45e1cf4b8e..80ddb7f668 100644 --- a/src/multiselect/__tests__/test-utils.test.tsx +++ b/src/multiselect/__tests__/test-utils.test.tsx @@ -9,15 +9,22 @@ import createWrapper from '../../../lib/components/test-utils/dom'; import { MultiselectProps } from '../interfaces'; const options: MultiselectProps.Options = [ - { label: 'First option', value: '1' }, + { + label: 'First option', + value: '1', + testId: 'option-1-test-id', + }, { label: 'First group', + testId: 'group-test-id', options: [ { + testId: 'option-2-test-id', label: 'Second option', value: '2', }, { + testId: 'option-3-test-id', label: 'Third option', value: '3', }, @@ -54,6 +61,7 @@ describe('test utils', () => { expect(groups[0].getElement()).toHaveTextContent('First group'); expect(groups[1].getElement()).toHaveTextContent('Second group'); }); + describe('findGroup', () => { test('returns a group by 1-based index', () => { const { wrapper } = renderMultiselect(); @@ -63,4 +71,43 @@ describe('test utils', () => { expect(dropdown.findGroup(2)!.getElement()).toHaveTextContent('Second group'); }); }); + + describe('findGroupByTestId', () => { + test('returns the group by test id', () => { + const { wrapper } = renderMultiselect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + + expect(dropdown.findGroupByTestId('group-test-id')!.getElement()).toHaveTextContent('First group'); + }); + + test('does not return non-group options even if test id matches', () => { + const { wrapper } = renderMultiselect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + + expect(dropdown.findGroupByTestId('option-2-test-id')).toBeNull(); + }); + }); + + describe('findOptionByTestId', () => { + test('returns the option by test id', () => { + const { wrapper } = renderMultiselect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + const topLevelOption = dropdown.findOptionByTestId('option-1-test-id')!.getElement(); + const subLevelOption = dropdown.findOptionByTestId('option-2-test-id')!.getElement(); + + expect(topLevelOption).toHaveTextContent('First option'); + expect(subLevelOption).toHaveTextContent('Second option'); + }); + + test('does not return the group even if the test id matches', () => { + const { wrapper } = renderMultiselect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + + expect(dropdown.findOptionByTestId('group-test-id')).not.toBeTruthy(); + }); + }); }); diff --git a/src/select/__tests__/common.ts b/src/select/__tests__/common.ts index c8e75058b7..e4abbaca79 100644 --- a/src/select/__tests__/common.ts +++ b/src/select/__tests__/common.ts @@ -5,19 +5,22 @@ import { SelectProps } from '../../../lib/components/select'; export const VALUE_WITH_SPECIAL_CHARS = 'Option 4, test"2'; export const defaultOptions: SelectProps.Options = [ - { label: 'First', value: '1' }, - { label: 'Second', value: '2' }, + { label: 'First', value: '1', testId: 'option-1-test-id' }, + { label: 'Second', value: '2', testId: 'option-2-test-id' }, { label: 'Group', + testId: 'group-test-id', options: [ { label: 'Third', value: '3', lang: 'de', + testId: 'option-3-test-id', }, { label: 'Forth', value: VALUE_WITH_SPECIAL_CHARS, + testId: 'option-4-test-id', }, ], }, diff --git a/src/select/__tests__/select.test.tsx b/src/select/__tests__/select.test.tsx index 8b831969c9..aa17ce2e2a 100644 --- a/src/select/__tests__/select.test.tsx +++ b/src/select/__tests__/select.test.tsx @@ -97,6 +97,17 @@ describe.each([false, true])('expandToViewport=%s', expandToViewport => { ); }); + test('assigns test-id to the options', () => { + const { wrapper } = renderSelect(); + wrapper.openDropdown(); + const optionTestIds = wrapper + .findDropdown({ expandToViewport }) + .findOptions() + .map(option => option.getElement().getAttribute('data-testid')); + + expect(optionTestIds).toEqual(['option-1-test-id', 'option-2-test-id', 'option-3-test-id', 'option-4-test-id']); + }); + test('throws an error when attempting to select an option with closed dropdown', () => { const { wrapper } = renderSelect(); expect(() => wrapper.selectOption(1, { expandToViewport })).toThrow( diff --git a/src/select/__tests__/test-utils.test.tsx b/src/select/__tests__/test-utils.test.tsx index fcf4a6391a..086c587cd6 100644 --- a/src/select/__tests__/test-utils.test.tsx +++ b/src/select/__tests__/test-utils.test.tsx @@ -9,21 +9,31 @@ import createWrapper from '../../../lib/components/test-utils/dom'; import { SelectProps } from '../interfaces'; const options: SelectProps.Options = [ - { label: 'First option', value: '1' }, + { + label: 'First option', + value: '1', + testId: 'option-1-test-id', + }, { label: 'First group', + testId: 'option-2-test-id', options: [ { + testId: 'option-3-test-id', label: 'Second option', value: '2', }, { + testId: 'option-4-test-id', label: 'Third option', value: '3', }, ], }, - { label: 'Fourth option', value: '4' }, + { + label: 'Fourth option', + value: '4', + }, { label: 'Second group', options: [ @@ -39,8 +49,10 @@ const options: SelectProps.Options = [ }, ]; -function renderSelect() { - const { container } = render( null} /> + ); const wrapper = createWrapper(container).findSelect()!; return { container, wrapper }; } @@ -54,6 +66,7 @@ describe('test utils', () => { expect(groups[0].getElement()).toHaveTextContent('First group'); expect(groups[1].getElement()).toHaveTextContent('Second group'); }); + describe('findGroup', () => { test('returns a group by 1-based index', () => { const { wrapper } = renderSelect(); @@ -63,4 +76,74 @@ describe('test utils', () => { expect(dropdown.findGroup(2)!.getElement()).toHaveTextContent('Second group'); }); }); + + describe('findGroupByTestId', () => { + test('returns the group by test id', () => { + const { wrapper } = renderSelect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + expect(dropdown.findGroupByTestId('option-2-test-id')!.getElement()).toHaveTextContent('First group'); + }); + + test('returns the group by test id even if test id contains double quotes', () => { + const { wrapper } = renderSelect([ + { + label: 'Test Group', + value: '1', + testId: '"group-test-id"', + options: [], + }, + ]); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + expect(dropdown.findGroupByTestId('"group-test-id"')!.getElement()).toHaveTextContent('Test Group'); + }); + + test('does not return non-group options even if test id matches', () => { + const { wrapper } = renderSelect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + expect(dropdown.findGroupByTestId('option-3-test-id')).toBeNull(); + }); + }); + + describe('findOptionByTestId', () => { + test('returns the option by test id', () => { + const { wrapper } = renderSelect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + const topLevelOption = dropdown.findOptionByTestId('option-1-test-id')!.getElement(); + const subLevelOption = dropdown.findOptionByTestId('option-3-test-id')!.getElement(); + + expect(topLevelOption).toHaveTextContent('First option'); + expect(subLevelOption).toHaveTextContent('Second option'); + }); + + test('returns the group by test id even if test id contains double quotes', () => { + const { wrapper } = renderSelect([ + { + label: 'Test Option', + value: '1', + testId: '"option-test-id"', + }, + ]); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + + expect(dropdown.findOptionByTestId('"option-test-id"')!.getElement()).toHaveTextContent('Test Option'); + }); + + test('does not return the group item even if the test if matches', () => { + const { wrapper } = renderSelect(); + wrapper.openDropdown(); + const dropdown = wrapper.findDropdown()!; + const topLevelOption = dropdown.findOptionByTestId('option-1-test-id'); + const groupOption = dropdown.findOptionByTestId('group-test-id'); + const childOption = dropdown.findOptionByTestId('option-3-test-id'); + + expect(topLevelOption).toBeTruthy(); + expect(groupOption).toBeFalsy(); + expect(childOption).toBeTruthy(); + }); + }); }); diff --git a/src/test-utils/dom/autosuggest/index.ts b/src/test-utils/dom/autosuggest/index.ts index 408652ed67..93a7127650 100644 --- a/src/test-utils/dom/autosuggest/index.ts +++ b/src/test-utils/dom/autosuggest/index.ts @@ -35,6 +35,22 @@ export class AutosuggestDropdownWrapper extends ComponentWrapper { ); } + /** + * Returns the wrapper of the first option that matches the specified test ID. + * Looks for the `data-testid` attribute on the option element. + * If no matching option is found, returns `null`. + * + * @param {string} testId + * @returns {OptionWrapper | null} + */ + findOptionByTestId(testId: string): OptionWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent( + `.${selectableStyles['selectable-item']} .${OptionWrapper.rootSelector}[data-testid="${escapedTestId}"]`, + OptionWrapper + ); + } + /** * Returns an option from the autosuggest by it's value * diff --git a/src/test-utils/dom/internal/dropdown-host.ts b/src/test-utils/dom/internal/dropdown-host.ts index 8db70f4a5c..bc155594bf 100644 --- a/src/test-utils/dom/internal/dropdown-host.ts +++ b/src/test-utils/dom/internal/dropdown-host.ts @@ -166,6 +166,22 @@ export class DropdownContentWrapper extends ComponentWrapper { ); } + /** + * Returns the wrapper of the option that matches the specified test ID. + * Looks for the `data-testid` attribute on the option element. + * If no matching option is found, returns `null`. + * + * @param {string} testId + * @returns {OptionWrapper | null} + */ + findOptionByTestId(testId: string): OptionWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.findComponent( + `.${selectableStyles['selectable-item']}[data-test-index] .${OptionWrapper.rootSelector}[data-testid="${escapedTestId}"]`, + OptionWrapper + ); + } + findOptionByValue(value: string): OptionWrapper | null { const toReplace = escapeSelector(value); return this.findComponent(`.${OptionWrapper.rootSelector}[data-value="${toReplace}"]`, OptionWrapper); @@ -212,6 +228,21 @@ export class DropdownContentWrapper extends ComponentWrapper { return this.find(`.${selectableStyles['selectable-item']}[data-group-index="${index}"]`); } + /** + * Returns the wrapper of the group option that matches the specified test ID. + * Looks for the `data-testid` attribute on the group option element. + * If no matching group option is found, returns `null`. + * + * @param {string} testId + * @returns {ElementWrapper | null} + */ + findGroupByTestId(testId: string): ElementWrapper | null { + const escapedTestId = escapeSelector(testId); + return this.find( + `.${selectableStyles['selectable-item']}[data-group-index]:not([data-test-index]) [data-testid=${escapedTestId}]` + ); + } + /** * Returns all option groups in the dropdown. */