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 discover plugin #9049

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
const [isCollapsed, setIsCollapsed] = useState(false);

const hitsCounter = (
<div className="dscChart__hitsCounter">
<div className="dscChart__hitsCounter" data-test-subj="dscChartHitsCounter">

Check warning on line 75 in src/plugins/discover/public/application/components/chart/chart.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/components/chart/chart.tsx#L75

Added line #L75 was not covered by tests
<HitsCounter
hits={hits > 0 ? hits : 0}
showResetButton={showResetButton}
Expand All @@ -82,7 +82,7 @@
);

const timeChartHeader = (
<div className="dscChart__TimechartHeader">
<div className="dscChart__TimechartHeader" data-test-subj="dscChartTimechartHeader">

Check warning on line 85 in src/plugins/discover/public/application/components/chart/chart.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/components/chart/chart.tsx#L85

Added line #L85 was not covered by tests
<TimechartHeader
bucketInterval={bucketInterval}
dateFormat={config.get('dateFormat')}
Expand Down Expand Up @@ -112,7 +112,12 @@
);

const queryEnhancedHistogramHeader = (
<EuiFlexGroup direction="row" gutterSize="m" className="dscChart__chartheader">
<EuiFlexGroup

Check warning on line 115 in src/plugins/discover/public/application/components/chart/chart.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/components/chart/chart.tsx#L115

Added line #L115 was not covered by tests
direction="row"
gutterSize="m"
className="dscChart__chartheader"
data-test-subj="dscChartChartheader"
>
<EuiFlexItem grow={false}>{toggle}</EuiFlexItem>
<EuiFlexItem grow={false}>{hitsCounter}</EuiFlexItem>
<EuiFlexItem grow={true} style={{ justifyContent: 'flex-start' }}>
Expand All @@ -138,6 +143,7 @@
direction="column"
gutterSize="none"
className={isEnhancementsEnabled ? 'dscChart__wrapper' : ''}
data-test-subj="dscChartWrapper"
>
{isEnhancementsEnabled ? queryEnhancedHistogramHeader : histogramHeader}
{isTimeBased && chartData && showHistogram && (
Expand All @@ -147,6 +153,7 @@
defaultMessage: 'Histogram of found documents',
})}
className="dscTimechart"
data-test-subj="dscTimechart"
>
<div className="dscHistogram" data-test-subj="discoverChart">
<DiscoverHistogram
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class DiscoverHistogram extends Component<DiscoverHistogramProps, Discove
<EuiFlexGroup
alignItems="center"
className="dscHistogram__header--partial"
data-test-subj="dscHistogramHeader"
responsive={false}
gutterSize="xs"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function HitsCounter({ hits, showResetButton, onResetQuery }: HitsCounter
<EuiFlexGroup
gutterSize="s"
className="dscResultCount"
data-test-subj="dscResultCount"
responsive={false}
justifyContent="center"
alignItems="center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ describe('Testing fetchTableDataCell function', () => {
>
<EuiDescriptionListTitle
className="osdDescriptionListFieldTitle"
data-test-subj="osdDescriptionListFieldTitle"
ananzh marked this conversation as resolved.
Show resolved Hide resolved
>
order_date:
</EuiDescriptionListTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export function fetchSourceTypeDataCell(
<EuiDescriptionList type="inline" compressed className="source">
{keys.map((key, index) => (
<Fragment key={key}>
<EuiDescriptionListTitle className="osdDescriptionListFieldTitle">
<EuiDescriptionListTitle
className="osdDescriptionListFieldTitle"
data-test-subj="osdDescriptionListFieldTitle"
>
{key + ':'}
</EuiDescriptionListTitle>
<EuiDescriptionListDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export const Pagination = ({
sampleSize,
}: Props) => {
return (
<EuiFlexGroup className="osdDocTable_pagination" alignItems="center" justifyContent="flexEnd">
<EuiFlexGroup
className="osdDocTable_pagination"
alignItems="center"
justifyContent="flexEnd"
data-test-subj="osdDocTablePagination"
>
{endItem >= sampleSize && (
<EuiFlexItem grow={false}>
<EuiTextColor color="subdued">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ const TableCellUI = ({
<>
<span
className="osdDocTableCell__dataField"
data-test-subj="osdDocTableCellDataField"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: sanitizedCellValue }}
/>
<span className="osdDocTableCell__filter">
<span className="osdDocTableCell__filter" data-test-subj="osdDocTableCellFilter">
<EuiToolTip
content={i18n.translate('discover.filterForValue', {
defaultMessage: 'Filter for value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,17 @@ const TableRowUI = ({

const expandedTableRow = (
<tr key={'x' + row._id}>
<td className="osdDocTable__detailsParent" colSpan={columns.length + 1}>
<td
className="osdDocTable__detailsParent"
colSpan={columns.length + 1}
data-test-subj="osdDocTableDetailsParent"
>
<EuiFlexGroup gutterSize="m" alignItems="center">
<EuiFlexItem grow={false} className="osdDocTable__detailsIconContainer">
<EuiFlexItem
grow={false}
className="osdDocTable__detailsIconContainer"
data-test-subj="osdDocTableDetailsIconContainer"
>
<EuiIcon type="folderOpen" />
</EuiFlexItem>
<EuiFlexItem>
Expand Down

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 @@ -68,7 +68,7 @@ export function DocViewer(renderProps: DocViewRenderProps) {
}

return (
<div className="osdDocViewer">
<div className="osdDocViewer" data-test-subj="osdDocViewer">
<EuiTabbedContent tabs={tabs} size="s" />
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function ContextApp({
onChangeCount={onChangeCount}
type={SurrDocType.PREDECESSORS}
/>
<div className="dscDocsGrid">
<div className="dscDocsGrid" data-test-subj="dscDocsGrid">
<DataGridTable
aria-label={'ContextTable'}
columns={columns}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function SingleDocApp() {
}

return (
<div className="single doc view">
<div className="single doc view" data-test-subj="singleDocView">
<Doc
id={docId}
index={index}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export const SurroundingDocsView = ({ id, indexPattern }: SurroundingDocsViewPar
indexPatterns={[indexPattern]}
useDefaultBehaviors={true}
/>
<EuiPage className="discover.context.appPage">
<EuiPageContent paddingSize="s" className="dscDocsContent">
<EuiPage className="discover.context.appPage" data-test-subj="discoverAppPage">
<EuiPageContent paddingSize="s" className="dscDocsContent" data-test-subj="dscDocsContent">
{contextAppMemoized}
</EuiPageContent>
</EuiPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ import { FormattedMessage } from '@osd/i18n/react';

export function LoadingSpinner() {
return (
<EuiPanel hasBorder={false} hasShadow={false} color="transparent" className="discoverNoResults">
<EuiPanel
hasBorder={false}
hasShadow={false}
color="transparent"
className="discoverNoResults"
data-test-subj="discoverNoResults"
>
<EuiEmptyPrompt
icon={<EuiLoadingSpinner data-test-subj="loadingSpinner" size="xl" />}
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ export const DiscoverNoResults = ({ queryString, query, savedQuery, timeFieldNam
}
/>
{tabs.length && (
<div className="discoverNoResults-sampleContainer">
<div
className="discoverNoResults-sampleContainer"
data-test-subj="discoverNoResultsSampleContainer"
>
<EuiTabbedContent tabs={tabs} />
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ export const DiscoverField = ({
}

return (
<EuiFlexGroup gutterSize="s" alignItems="center" responsive={false} className="dscSidebarField">
<EuiFlexGroup
gutterSize="s"
alignItems="center"
responsive={false}
className="dscSidebarField"
data-test-subj="dscSidebarField"
>
<EuiFlexItem grow={false}>
<FieldIcon
type={field.type}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
return (
<>
<EuiFlexGroup justifyContent="spaceBetween" responsive={false} gutterSize="s">
<EuiFlexItem className="dscFieldDetails__barContainer" grow={1}>
<EuiFlexItem
className="dscFieldDetails__barContainer"
grow={1}
data-test-subj="dscFieldDetailsBarContainer"
>
<EuiFlexGroup justifyContent="spaceBetween" gutterSize="xs" responsive={false}>
<EuiFlexItem grow={1} className="eui-textTruncate">
<EuiText
Expand All @@ -85,6 +89,7 @@ export function DiscoverFieldBucket({ field, bucket, onAddFilter }: Props) {
}
size="xs"
className="eui-textTruncate"
data-test-subj="dscFieldDetailsText"
>
{bucket.display === '' ? emptyTxt : bucket.display}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function DiscoverFieldDataFrame({ onCreateIndexPattern, onNormalizeIndexP
onClick={onNormalizeIndexPattern}
size="xs"
className="dscSideBar_normalizeIndexPattern"
data-test-subj="dscSideBarNormalizeIndexPatternButton"
>
{i18n.translate('discover.fieldChooser.dataFrame.normalizeIndexPattern', {
defaultMessage: 'Normalize',
Expand All @@ -33,6 +34,7 @@ export function DiscoverFieldDataFrame({ onCreateIndexPattern, onNormalizeIndexP
onClick={onCreateIndexPattern}
size="xs"
className="dscSideBar_createIndexPattern"
data-test-subj="dscSideBarCreateIndexPatternButton"
>
{i18n.translate('discover.fieldChooser.dataFrame.createIndexPattern', {
defaultMessage: 'Create index pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ export function DiscoverFieldSearch({

if (isEnhancementsEnabledOverride) {
return (
<div className="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdDiscoverSideBar__wrap">
<div
className="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdDiscoverSideBar__wrap"
data-test-subj="osdDiscoverSideBarWrapper"
>
{compressedFieldSearch}
{fieldPopover}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const FieldList = ({
onClick={() => setExpanded(!expanded)}
size="xs"
className="dscSideBar_fieldGroup"
data-test-subj="dscSideBarFieldGroupButton"
aria-label={title}
isLoading={!!selectedIndexPattern.fieldsLoading}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function DocViewTable({
}

return (
<table className="table table-condensed osdDocViewerTable">
<table className="table table-condensed osdDocViewerTable" data-test-subj="osdDocViewerTable">
<tbody>
{Object.keys(flattened)
.sort()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function DocViewTableRow({
return (
<tr key={field} data-test-subj={`tableDocViewRow-${field}`}>
{typeof onFilter === 'function' && (
<td className="osdDocViewer__buttons">
<td className="osdDocViewer__buttons" data-test-subj="osdDocViewerButtons">
<DocViewTableRowBtnFilterAdd
disabled={!fieldMapping || !fieldMapping.filterable}
onClick={() => onFilter(fieldMapping, valueRaw, '+')}
Expand All @@ -100,7 +100,7 @@ export function DocViewTableRow({
/>
</td>
)}
<td className="osdDocViewer__field">
<td className="osdDocViewer__field" data-test-subj="osdDocViewerField">
<FieldName
fieldName={field}
fieldType={fieldType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history, optionalR
hasShadow={false}
paddingSize="s"
className="dscCanvas"
data-test-subj="dscCanvas"
borderRadius="l"
>
<TopNav
Expand Down Expand Up @@ -173,7 +174,12 @@ export default function DiscoverCanvas({ setHeaderActionMenu, history, optionalR
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</>
) : (
<EuiPanel hasShadow={false} paddingSize="none" className="dscCanvas_results">
<EuiPanel
hasShadow={false}
paddingSize="none"
className="dscCanvas_results"
data-test-subj="dscCanvasResults"
>
<MemoizedDiscoverChartContainer {...fetchState} />
<MemoizedDiscoverTable rows={rows} scrollToTop={scrollToTop} />
</EuiPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export function SearchEmbeddableComponent({ searchProps }: SearchEmbeddableProps
className="eui-xScrollWithShadows eui-yScrollWithShadows"
>
{discoverEmbeddableProps.hits !== 0 ? (
<EuiFlexItem style={{ minHeight: 0 }} className="osdDocTable__container">
<EuiFlexItem
style={{ minHeight: 0 }}
className="osdDocTable__container"
data-test-subj="osdDocTableContainer"
>
<DataGridTableMemoized {...discoverEmbeddableProps} />
</EuiFlexItem>
) : (
Expand Down
Loading