Skip to content

Commit

Permalink
✅ Fix test ids for functional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 committed Apr 12, 2023
1 parent e742ac6 commit 0db73aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function LayerPanel({
value: samplingValue * 100,
},
}),
'data-test-subj': 'lnsChangeIndexPatternSamplingInfo',
}
: {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface TriggerLabelProps {
icon?: React.ReactElement;
iconValue?: string;
iconTooltipValue?: string;
'data-test-subj'?: string;
}

export type ChangeIndexPatternTriggerProps = ToolbarButtonProps &
Expand All @@ -24,7 +25,13 @@ export type ChangeIndexPatternTriggerProps = ToolbarButtonProps &
isDisabled?: boolean;
};

function TriggerLabel({ label, icon, iconValue, iconTooltipValue }: TriggerLabelProps) {
function TriggerLabel({
label,
icon,
iconValue,
iconTooltipValue,
'data-test-subj': dataTestSubj,
}: TriggerLabelProps) {
const { euiTheme } = useEuiTheme();
if (!icon) {
return <>{label}</>;
Expand All @@ -42,7 +49,7 @@ function TriggerLabel({ label, icon, iconValue, iconTooltipValue }: TriggerLabel
</EuiFlexItem>
<EuiFlexItem
grow={false}
data-test-subj="lnsChangeIndexPatternSamplingInfo"
data-test-subj={dataTestSubj}
css={css`
display: block;
*:hover &,
Expand Down Expand Up @@ -74,6 +81,7 @@ export function TriggerButton({
icon,
iconValue,
iconTooltipValue,
'data-test-subj': dataTestSubj,
...rest
}: ChangeIndexPatternTriggerProps & {
togglePopover: () => void;
Expand All @@ -99,6 +107,7 @@ export function TriggerButton({
icon={icon}
iconValue={iconValue}
iconTooltipValue={iconTooltipValue}
data-test-subj={dataTestSubj}
/>
</ToolbarButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function AnnotationLayerHeaderContent({
iconTooltipValue: i18n.translate('xpack.lens.layerPanel.ignoreGlobalFilters', {
defaultMessage: 'Ignore global filters',
}),
'data-test-subj': 'lnsChangeIndexPatternIgnoringFilters',
};
return (
<ChangeIndexPattern
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/functional/apps/lens/group1/layer_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// add annotation layer
await PageObjects.lens.createLayer('annotations');

expect(await testSubjects.exists('lnsChangeIndexPatternSamplingInfo')).to.be(true);
expect(await testSubjects.exists('lnsChangeIndexPatternIgnoringFilters')).to.be(true);

await PageObjects.lens.openLayerContextMenu(1);
await testSubjects.click('lnsLayerSettings');
// annotations settings have only ignore filters
await testSubjects.click('lnsXY-layerSettings-ignoreGlobalFilters');
// now close the panel and check the dataView picker has no icon
await testSubjects.click('lns-indexPattern-dimensionContainerBack');
expect(await testSubjects.exists('lnsChangeIndexPatternSamplingInfo')).to.be(false);
expect(await testSubjects.exists('lnsChangeIndexPatternIgnoringFilters')).to.be(false);
});

it('should add a new visualization layer and disable the sampling if max operation is chosen', async () => {
Expand Down

0 comments on commit 0db73aa

Please sign in to comment.