Skip to content
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ const FilterBadges = ({ condition }: { condition: FilterCondition }) => {

return (
<>
<BadgeItem text={field} />
<OperatorText operator={operatorText} subdued />
<BadgeItem text={value?.toString() ?? ''} />
<BadgeItem text={field} testSubj="streamsAppConditionDisplayField" />
<OperatorText operator={operatorText} subdued testSubj="streamsAppConditionDisplayOperator" />
<BadgeItem text={value?.toString() ?? ''} testSubj="streamsAppConditionDisplayValue" />
</>
);
};

const BadgeItem = ({ text }: { text: string }) => (
const BadgeItem = ({ text, testSubj }: { text: string; testSubj?: string }) => (
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">{text}</EuiBadge>
<EuiBadge color="hollow" data-test-subj={testSubj}>
{text}
</EuiBadge>
</EuiFlexItem>
);

Expand Down Expand Up @@ -200,10 +202,12 @@ const OperatorText = ({
operator,
bold,
subdued,
testSubj,
}: {
operator: string;
bold?: boolean;
subdued?: boolean;
testSubj?: string;
}) => {
const { euiTheme } = useEuiTheme();
return (
Expand All @@ -212,6 +216,7 @@ const OperatorText = ({
size="s"
color={subdued ? 'subdued' : 'default'}
style={{ fontWeight: bold ? euiTheme.font.weight.bold : euiTheme.font.weight.regular }}
data-test-subj={testSubj}
>
{operator}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ const FilterBtn = ({
},
});

const testSubj = mode === '+' ? 'streamsAppCellActionFilterFor' : 'streamsAppCellActionFilterOut';

return (
<Component
onClick={() => {
Expand All @@ -82,7 +84,7 @@ const FilterBtn = ({
iconType={iconType}
aria-label={buttonTitle}
title={buttonTitle}
data-test-subj="routingConditionFilterForButton"
data-test-subj={testSubj}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ export function IdleRoutingStreamEntry({
}
)}
>
<EuiBadge color="hollow" tabIndex={0}>{`+${childrenCount}`}</EuiBadge>
<EuiBadge
color="hollow"
tabIndex={0}
data-test-subj="streamsAppRoutingRuleChildCountBadge"
>{`+${childrenCount}`}</EuiBadge>
</EuiToolTip>
<VerticalRule />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ export function PreviewPanel() {

return (
<>
<EuiFlexItem grow={false} data-test-subj="routingPreviewPanel">
<EuiFlexItem grow={false} data-test-subj="streamsAppRoutingPreviewPanel">
<EuiFlexGroup justifyContent="spaceBetween" wrap>
<EuiFlexGroup component="span" gutterSize="s">
<EuiIcon type="inspect" />
<strong>
<strong data-test-subj="streamsAppRoutingPreviewPanelHeader">
{i18n.translate('xpack.streams.streamDetail.preview.header', {
defaultMessage: 'Data Preview',
})}
Expand All @@ -81,10 +81,11 @@ export function PreviewPanel() {

const EditingPanel = () => (
<EuiEmptyPrompt
data-test-subj="streamsAppRoutingPreviewEditingPanel"
icon={<AssetImage />}
titleSize="xxs"
title={
<h2>
<h2 data-test-subj="streamsAppRoutingPreviewEditingPanelTitle">
{i18n.translate('xpack.streams.streamDetail.preview.editPreviewMessage', {
defaultMessage: 'Preview is not available while editing or reordering streams',
})}
Expand All @@ -93,13 +94,13 @@ const EditingPanel = () => (
body={
<>
<EuiText size="xs">
<p>
<p data-test-subj="streamsAppRoutingPreviewEditingPanelBodyMessage">
{i18n.translate('xpack.streams.streamDetail.preview.editPreviewMessageBody', {
defaultMessage:
'Once you save your changes, the results of your conditions will appear here.',
})}
</p>
<p>
<p data-test-subj="streamsAppRoutingPreviewEditingPanelReorderingWarning">
{i18n.translate('xpack.streams.streamDetail.preview.editPreviewReorderingWarning', {
defaultMessage:
'Additionally, you will not be able to edit existing streams while reordering them, you should save or cancel your changes first.',
Expand Down Expand Up @@ -186,10 +187,11 @@ const SamplePreviewPanel = ({ enableActions }: { enableActions: boolean }) => {
} else if (!hasDocuments || !isProcessedCondition) {
content = (
<EuiEmptyPrompt
data-test-subj="streamsAppRoutingPreviewEmptyPrompt"
icon={<AssetImage type="noResults" />}
titleSize="xxs"
title={
<h2>
<h2 data-test-subj="streamsAppRoutingPreviewEmptyPromptTitle">
{i18n.translate('xpack.streams.streamDetail.preview.empty', {
defaultMessage: 'No documents to preview',
})}
Expand All @@ -199,7 +201,7 @@ const SamplePreviewPanel = ({ enableActions }: { enableActions: boolean }) => {
);
} else if (hasDocuments) {
content = (
<EuiFlexItem grow data-test-subj="routingPreviewPanelWithResults">
<EuiFlexItem grow data-test-subj="streamsAppRoutingPreviewPanelWithResults">
<RowSelectionContext.Provider value={rowSelectionContextValue}>
<MemoPreviewTable
documents={documents}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ export function StreamNameFormRow({
return (
<EuiFormRow
fullWidth
label={i18n.translate('xpack.streams.streamDetailRouting.name', {
defaultMessage: 'Stream name',
})}
label={
<span data-test-subj="streamsAppRoutingStreamNameLabel">
{i18n.translate('xpack.streams.streamDetailRouting.name', {
defaultMessage: 'Stream name',
})}
</span>
}
helpText={helpText}
describedByIds={[descriptionId]}
isInvalid={isInvalid || isDotPresent || !isLengthValid}
Expand All @@ -104,6 +108,7 @@ export function StreamNameFormRow({
inline-size: min(${prefix.length}ch, ${PREFIX_MAX_VISIBLE_CHARACTERS}ch);
`}
id={descriptionId}
data-test-subj="streamsAppRoutingStreamNamePrefix"
>
<EuiScreenReaderOnly>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class StreamsApp {
}

async expectPreviewPanelVisible() {
await expect(this.page.getByTestId('routingPreviewPanelWithResults')).toBeVisible();
await expect(this.page.getByTestId('streamsAppRoutingPreviewPanelWithResults')).toBeVisible();
}

async saveRuleOrder() {
Expand Down Expand Up @@ -754,6 +754,18 @@ export class StreamsApp {
await expect(this.page.getByTestId('droppable')).not.toHaveAttribute('class', /isDragging/);
}

async clickFilterForButton() {
const filterForButton = this.page.getByTestId('streamsAppCellActionFilterFor');
await expect(filterForButton).toBeVisible();
await filterForButton.click();
}

async clickFilterOutButton() {
const filterOutButton = this.page.getByTestId('streamsAppCellActionFilterOut');
await expect(filterOutButton).toBeVisible();
await filterOutButton.click();
}

/**
* Share utility methods
*/
Expand Down
Loading