Skip to content

Commit

Permalink
Add data test subject for discover cypress test (#8682)
Browse files Browse the repository at this point in the history
  • Loading branch information
abbyhu2000 authored Oct 23, 2024
1 parent 12d072d commit aa969e5
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8682.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add data test subject for discover cypress test ([#8682](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8682))
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const LanguageReference = (props: { body: ReactFragment }) => {
defaultMessage: `Language Reference`,
})}
onClick={() => setIsLanguageReferenceOpen(!isLanguageReferenceOpen)}
data-test-subj="languageReferenceButton"
/>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/public/ui/dataset_selector/configurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export const Configurator = ({
setDataset({ ...dataset, timeFieldName: value });
}}
hasNoInitialSelection
data-test-subj="advancedSelectorTimeFieldSelect"
/>
</EuiFormRow>
))}
Expand All @@ -205,6 +206,7 @@ export const Configurator = ({
}}
fill
disabled={submitDisabled}
data-test-subj="advancedSelectorConfirmButton"
>
<FormattedMessage
id="data.explorer.datasetSelector.advancedSelector.confirm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export const DatasetExplorer = ({
<FormattedMessage
id="data.explorer.datasetSelector.advancedSelector.cancel"
defaultMessage="Cancel"
data-test-subj="datasetSelectorCancel"
/>
</EuiButtonEmpty>
<EuiButton
Expand All @@ -237,6 +238,7 @@ export const DatasetExplorer = ({
iconType="arrowRight"
iconSide="right"
fill
data-test-subj="datasetSelectorNext"
>
<FormattedMessage
id="data.explorer.datasetSelector.advancedSelector.next"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export const DatasetSelector = ({
checked: id === selectedDatasetId ? 'on' : undefined,
key: id,
prepend: <EuiIcon type={datasetService.getType(type)!.meta.icon.type} />,
'data-test-subj': `datasetOption-${id}`,
});
});
return datasetOptions.length > 1 ? datasetOptions : [];
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 @@ -32,7 +32,7 @@ export const DefaultInput: React.FC<DefaultInputProps> = ({
provideCompletionItems,
}) => {
return (
<div className="defaultEditor">
<div className="defaultEditor" data-test-subj="osdQueryEditor__multiLine">
<div ref={headerRef} className="defaultEditor__header" />
<CodeEditor
height={100}
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/data/public/ui/query_editor/editors/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export const SingleLineInput: React.FC<SingleLineInputProps> = ({
}) => (
<div className="euiFormControlLayout euiFormControlLayout--compressed euiFormControlLayout--group osdQueryBar__wrap">
{prepend}
<div className="osdQuerEditor__singleLine euiFormControlLayout__childrenWrapper">
<div
className="osdQuerEditor__singleLine euiFormControlLayout__childrenWrapper"
data-test-subj="osdQueryEditor__singleLine"
>
<CodeEditor
height={20} // Adjusted to match lineHeight for a single line
languageId={languageId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const QueryLanguageSelector = (props: QueryLanguageSelectorProps) => {
onClick={onButtonClick}
className="languageSelector__button"
iconType="arrowDown"
data-test-subj="queryEditorLanguageSelector"
>
{selectedLanguage.label}
</EuiSmallButtonEmpty>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export default class QueryEditorUI extends Component<Props, State> {
<EuiText size="xs" color="subdued">
{`${this.state.lineCount} ${this.state.lineCount === 1 ? 'line' : 'lines'}`}
</EuiText>,
<EuiText size="xs" color="subdued">
<EuiText size="xs" color="subdued" data-test-subj="queryEditorFooterTimestamp">
{this.props.query.dataset?.timeFieldName || ''}
</EuiText>,
<QueryResult queryStatus={this.props.queryStatus!} />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const DiscoverNoIndexPatterns: React.FC = () => {
alignItems="center"
gutterSize="none"
className="discoverNoIndexPatterns-centerPanel"
data-test-subj="discoverNoIndexPatterns"
>
<EuiFlexItem grow={false}>
<EuiPanel paddingSize="l">
Expand Down

0 comments on commit aa969e5

Please sign in to comment.