Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing data-test-subj tags for data plugin #9051

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ export function QueryResult(props: { queryStatus: QueryStatus }) {
className="editor__footerItem"
color="danger"
>
<EuiText size="xs" color="danger" className="editor__footerItem">
<EuiText
size="xs"
color="danger"
className="editor__footerItem"
data-test-subj="editorfooterItem"
LDrago27 marked this conversation as resolved.
Show resolved Hide resolved
>
{i18n.translate('data.query.languageService.queryResults.error', {
defaultMessage: `Error`,
})}
Expand All @@ -146,6 +151,7 @@ export function QueryResult(props: { queryStatus: QueryStatus }) {
<div
style={{ width: '250px', maxHeight: '250px', overflowY: 'auto' }}
className="eui-textBreakWord"
data-test-subj="textBreakWord"
>
<EuiText size="s">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export function RecentQueriesTable({
rowProps={getRowProps}
cellProps={getCellProps}
className="recentQuery__table"
data-test-subj="recentQueryTable"
tableLayout="fixed"
compressed
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const Configurator = ({
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
<EuiForm className="datasetConfigurator">
<EuiForm className="datasetConfigurator" data-test-subj="datasetConfigurator">
<EuiFormRow
label={i18n.translate(
'data.explorer.datasetSelector.advancedSelector.configurator.datasetLabel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@
isFinal ? ' datasetExplorer__column--leaf' : ''
}`}
>
<EuiTitle size="xxs" className="datasetExplorer__columnTitle">
<EuiTitle
size="xxs"
className="datasetExplorer__columnTitle"
data-test-subj="datasetExplorerColumnTitle"
>
<h3>{current.columnHeader}</h3>
</EuiTitle>
{current.multiSelect ? (
Expand Down Expand Up @@ -210,6 +214,7 @@
})}
height="full"
className="datasetExplorer__selectable"
data-test-subj="datasetExplorerSelectable"
>
{(list, search) => (
<>
Expand Down Expand Up @@ -252,16 +257,29 @@
};

const EmptyColumn = () => (
<div className="datasetExplorer__column datasetExplorer__column--empty" />
<div

Check warning on line 260 in src/plugins/data/public/ui/dataset_selector/dataset_explorer.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/dataset_explorer.tsx#L260

Added line #L260 was not covered by tests
className="datasetExplorer__column datasetExplorer__column--empty"
data-test-subj="datasetExplorerEmptyColumn"
/>
);

const LoadingEmptyColumn = ({ isLoading }: { isLoading: boolean }) =>
isLoading ? (
<div className="datasetExplorer__column">
<EuiTitle size="xxs" className="datasetExplorer__columnTitle">
<div className="datasetExplorer__column" data-test-subj="datasetExplorerLoadingColumn">
<EuiTitle
size="xxs"
className="datasetExplorer__columnTitle"
data-test-subj="datasetExplorerLoadingColumnTitle"
>
<h3>...</h3>
</EuiTitle>
<EuiSelectable options={[]} singleSelection className="datasetExplorer__selectable" isLoading>
<EuiSelectable
options={[]}
singleSelection
className="datasetExplorer__selectable"
isLoading
data-test-subj="datasetExplorerSelectable"
>
{(list) => <>{list}</>}
</EuiSelectable>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ export const DatasetSelector = ({
iconSide="right"
onClick={togglePopover}
>
<EuiIcon type={datasetIcon} className="datasetSelector__icon" />
<EuiIcon
type={datasetIcon}
className="datasetSelector__icon"
data-test-subj="datasetSelectorIcon"
/>
{datasetTitle}
</RootComponent>
</EuiToolTip>
Expand All @@ -234,6 +238,7 @@ export const DatasetSelector = ({
>
<EuiSelectable
className="datasetSelector__selectable"
data-test-subj="datasetSelectorSelectable"
options={options}
singleSelection="always"
searchable={true}
Expand All @@ -252,7 +257,11 @@ export const DatasetSelector = ({
</>
)}
</EuiSelectable>
<EuiPopoverFooter paddingSize="none" className="datasetSelector__footer">
<EuiPopoverFooter
paddingSize="none"
className="datasetSelector__footer"
data-test-subj="datasetSelectorFooter"
>
<EuiButton
className="datasetSelector__advancedButton"
data-test-subj="datasetSelectorAdvancedButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const DatasetTable: React.FC<DatasetTableProps> = (props) => {
};

return (
<div className="datasetTable">
<div className="datasetTable" data-test-subj="datasetTable">
<EuiFieldSearch
fullWidth
inputRef={(node) => (searchRef.current = node)}
Expand All @@ -93,7 +93,7 @@ export const DatasetTable: React.FC<DatasetTableProps> = (props) => {
/>

{paginationToken && (
<div className="datasetTable__loadMore">
<div className="datasetTable__loadMore" data-test-subj="datasetTableLoadMore">
<EuiLink
onClick={() => onTableChange({ paginationToken, search: searchRef.current?.value })}
>
Expand Down
12 changes: 10 additions & 2 deletions src/plugins/data/public/ui/filter_bar/filter_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,15 @@ function FilterBarUI(props: Props) {
gutterSize="none"
alignItems="flexStart"
responsive={false}
data-test-subj="globalFilterGroup"
>
<EuiFlexItem className="globalFilterGroup__branch" grow={false}>
{useNewHeader ? (
<EuiText size="s" className="globalFilterGroup__filterPrefix">
<EuiText
size="s"
className="globalFilterGroup__filterPrefix"
data-test-subj="globalFilterGroupFilterPrefix"
>
{filterBarPrefixText}:
</EuiText>
) : (
Expand All @@ -205,7 +210,10 @@ function FilterBarUI(props: Props) {
/>
)}
</EuiFlexItem>
<EuiFlexItem className="globalFilterGroup__filterFlexItem">
<EuiFlexItem
className="globalFilterGroup__filterFlexItem"
data-test-subj="globalFilterGroupFilterFlexItem"
>
<EuiFlexGroup
className={classes}
wrap={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class FilterEditorUI extends Component<Props, State> {
</EuiFlexGroup>
</EuiPopoverTitle>

<div className="globalFilterItem__editorForm">
<div className="globalFilterItem__editorForm" data-test-subj="globalFilterItemEditor">
<EuiForm>
{this.renderIndexPatternInput()}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const DefaultInput: React.FC<DefaultInputProps> = ({
}) => {
return (
<div className="defaultEditor" data-test-subj="osdQueryEditor__multiLine">
<div ref={headerRef} className="defaultEditor__header" />
<div ref={headerRef} className="defaultEditor__header" data-test-subj="defaultEditorHeader" />
<CodeEditor
height={100}
languageId={languageId}
Expand Down Expand Up @@ -69,19 +69,21 @@ export const DefaultInput: React.FC<DefaultInputProps> = ({
}}
triggerSuggestOnFocus={true}
/>
<div className="defaultEditor__footer">
<div className="defaultEditor__footer" data-test-subj="defaultEditorFooter">
{footerItems && (
<EuiFlexGroup
direction="row"
alignItems="center"
gutterSize="none"
className="defaultEditor__footerRow"
data-test-subj="defaultEditorFooterRow"
>
{footerItems.start?.map((item, idx) => (
<EuiFlexItem
key={`defaultEditor__footerItem-start-${idx}`}
grow={false}
className="defaultEditor__footerItem"
data-test-subj="defaultEditorFooterStartItem"
>
{item}
</EuiFlexItem>
Expand All @@ -92,6 +94,7 @@ export const DefaultInput: React.FC<DefaultInputProps> = ({
key={`defaultEditor__footerItem-end-${idx}`}
grow={false}
className="defaultEditor__footerItem"
data-test-subj="defaultEditorFooterEndItem"
>
{item}
</EuiFlexItem>
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/data/public/ui/query_editor/editors/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export const SingleLineInput: React.FC<SingleLineInputProps> = ({
);

return (
<div className="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdQueryBar__wrap">
<div
className="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdQueryBar__wrap"
data-test-subj="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdQueryBar__wrap"
LDrago27 marked this conversation as resolved.
Show resolved Hide resolved
>
{prepend}
<div
className="osdQuerEditor__singleLine euiFormControlLayout__childrenWrapper"
Expand Down Expand Up @@ -150,7 +153,7 @@ export const SingleLineInput: React.FC<SingleLineInputProps> = ({
triggerSuggestOnFocus={true}
/>
{editorIsFocused && (
<div className="queryEditor__footer">
<div className="queryEditor__footer" data-test-subj="queryEditorFooter">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, I added this for the single line editor's footer. Could be a little more descriptive for this to avoid confusion with the other editors.

{footerItems && (
<Fragment>
{footerItems.start?.map((item) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const QueryLanguageSelector = (props: QueryLanguageSelectorProps) => {
<EuiContextMenuItem
key={language.label}
className="languageSelector__menuItem"
data-test-subj="languageSelector"
LDrago27 marked this conversation as resolved.
Show resolved Hide resolved
icon={language.label === selectedLanguage.label ? 'check' : 'empty'}
onClick={() => handleLanguageChange(language.value)}
>
Expand Down
35 changes: 28 additions & 7 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
},
footerItems: {
start: [
<EuiText size="xs" color="subdued" className="queryEditor__footerItem">
<EuiText
size="xs"
color="subdued"
className="queryEditor__footerItem"
data-test-subj="queryEditorFooterLineCount"
>
{`${lineCount} ${lineCount === 1 ? 'line' : 'lines'}`}
</EuiText>,
<EuiText
Expand All @@ -329,6 +334,7 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
size="xs"
onClick={toggleRecentQueries}
className="queryEditor__footerItem"
data-test-subj="queryEditorFooterToggleRecentQueriesButton"
>
<EuiText size="xs" color="subdued">
{'Recent queries'}
Expand Down Expand Up @@ -362,10 +368,20 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
prepend: props.prepend,
footerItems: {
start: [
<EuiText size="xs" color="subdued" className="queryEditor__footerItem">
<EuiText
size="xs"
color="subdued"
className="queryEditor__footerItem"
data-test-subj="queryEditorFooterLineCount"
>
{`${lineCount ?? 1} ${lineCount === 1 || !lineCount ? 'line' : 'lines'}`}
</EuiText>,
<EuiText size="xs" color="subdued" className="queryEditor__footerItem">
<EuiText
size="xs"
color="subdued"
className="queryEditor__footerItem"
data-test-subj="queryEditorFooterTimestamp"
>
{query.dataset?.timeFieldName || ''}
</EuiText>,
<QueryResult queryStatus={props.queryStatus!} />,
Expand All @@ -378,6 +394,7 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
size="xs"
onClick={toggleRecentQueries}
className="queryEditor__footerItem"
data-test-subj="queryEditorFooterToggleRecentQueriesButton"
flush="both"
>
<EuiText size="xs" color="subdued">
Expand Down Expand Up @@ -409,16 +426,20 @@ export const QueryEditorUI: React.FC<Props> = (props) => {
ref={bannerRef}
className={classNames('osdQueryEditor__banner', props.bannerClassName)}
/>
<div className="osdQueryEditor__topBar">
<div className="osdQueryEditor__input">
<div className="osdQueryEditor__topBar" data-test-subj="osdQueryEditorTopBar">
<div className="osdQueryEditor__input" data-test-subj="osdQueryEditorInput">
{isCollapsed
? languageEditor.TopBar.Collapsed()
: languageEditor.TopBar.Expanded && languageEditor.TopBar.Expanded()}
</div>
{languageSelector}
<div className="osdQueryEditor__querycontrols">
<div className="osdQueryEditor__querycontrols" data-test-subj="osdQueryEditorQuerycontrols">
LDrago27 marked this conversation as resolved.
Show resolved Hide resolved
<EuiFlexGroup responsive={false} gutterSize="s" alignItems="center">
<div ref={queryControlsContainer} className="osdQueryEditor__extensionQueryControls" />
<div
ref={queryControlsContainer}
className="osdQueryEditor__extensionQueryControls"
data-test-subj="osdQueryEditorExtensionQueryControls"
/>
{renderQueryControls(languageEditor.TopBar.Controls)}
{!languageEditor.TopBar.Expanded && renderToggleIcon()}
{props.savedQueryManagement}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
onSubmit={onInputSubmit}
persistedLog={persistedLog}
className="osdQueryEditor"
data-test-subj="osdQueryEditor"
LDrago27 marked this conversation as resolved.
Show resolved Hide resolved
dataTestSubj={props.dataTestSubj}
filterBar={props.filterBar}
savedQueryManagement={props.savedQueryManagement}
Expand Down Expand Up @@ -357,6 +358,7 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
dateFormat={uiSettings!.get('dateFormat')}
isAutoRefreshOnly={props.showAutoRefreshOnly}
className="osdQueryEditor__datePicker"
data-test-subj="osdQueryEditorDatePicker"
compressed={true}
/>
</EuiFlexItem>
Expand All @@ -369,7 +371,11 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {

const datePicker = (
<EuiFlexGroup justifyContent="flexEnd" gutterSize="none" responsive={false}>
<EuiFlexItem grow={false} className="osdQueryEditor--updateButtonWrapper">
<EuiFlexItem
grow={false}
className="osdQueryEditor--updateButtonWrapper"
data-test-subj="osdQueryEditorUpdateButton"
>
{renderUpdateButton()}
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) {
dateFormat={uiSettings!.get('dateFormat')}
isAutoRefreshOnly={props.showAutoRefreshOnly}
className="osdQueryBar__datePicker"
data-test-subj="osdQueryBarDatePicker"
compressed={true}
/>
</EuiFlexItem>
Expand Down Expand Up @@ -402,7 +403,7 @@ export default function QueryBarTopRow(props: QueryBarTopRowProps) {
>
{renderQueryInput()}
{renderSharingMetaFields()}
<EuiFlexItem grow={false} className="osdQueryBar--hideEmpty">
<EuiFlexItem grow={false} className="osdQueryBar--hideEmpty" data-test-subj="osdQueryBar">
{shouldUseDatePickerRef
? createPortal(renderUpdateButton(), props.datePickerRef!.current!)
: renderUpdateButton()}
Expand Down
Loading
Loading