Skip to content

Commit abdac76

Browse files
committed
update snapshot and add functional test
1 parent 37ecfc5 commit abdac76

File tree

4 files changed

+79
-43
lines changed

4 files changed

+79
-43
lines changed

x-pack/plugins/maps/public/connected_components/map/features_tooltip/__snapshots__/feature_properties.test.js.snap

Lines changed: 28 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/maps/public/connected_components/map/features_tooltip/feature_properties.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,16 @@ export class FeatureProperties extends React.Component {
117117
items: this.state.actions.map((action) => {
118118
const actionContext = this.props.getActionContext();
119119
const iconType = action.getIconType ? action.getIconType(actionContext) : null;
120+
const name = action.getDisplayName ? action.getDisplayName(actionContext) : action.id;
120121
return {
121-
name: action.getDisplayName ? action.getDisplayName(actionContext) : action.id,
122+
name,
122123
icon: iconType ? <EuiIcon type={iconType} /> : null,
123124
onClick: async () => {
124125
this.props.onCloseTooltip();
125126
const filters = await tooltipProperty.getESFilters();
126127
this.props.addFilters(filters, action.id);
127128
},
129+
['data-test-subj']: `mapFilterActionButton__${name}`,
128130
};
129131
}),
130132
};
@@ -202,6 +204,7 @@ export class FeatureProperties extends React.Component {
202204
aria-label={i18n.translate('xpack.maps.tooltip.viewActionsTitle', {
203205
defaultMessage: 'View filter actions',
204206
})}
207+
data-test-subj="mapTooltipMoreActionsButton"
205208
>
206209
<EuiIcon type="arrowRight" />
207210
</EuiButtonEmpty>

x-pack/test/functional/apps/maps/embeddable/tooltip_filter_actions.js

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,62 @@ export default function ({ getPageObjects, getService }) {
1313
const filterBar = getService('filterBar');
1414

1515
describe('tooltip filter actions', () => {
16-
before(async () => {
16+
async function loadDashboardAndOpenTooltip() {
1717
await kibanaServer.uiSettings.replace({
1818
defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a',
1919
});
2020
await PageObjects.common.navigateToApp('dashboard');
21+
await PageObjects.dashboard.preserveCrossAppState();
2122
await PageObjects.dashboard.loadSavedDashboard('dash for tooltip filter action test');
2223

2324
await PageObjects.maps.lockTooltipAtPosition(200, -200);
24-
});
25+
}
26+
27+
describe('apply filter to current view', () => {
28+
before(async () => {
29+
await loadDashboardAndOpenTooltip();
30+
});
31+
32+
it('should display create filter button when tooltip is locked', async () => {
33+
const exists = await testSubjects.exists('mapTooltipCreateFilterButton');
34+
expect(exists).to.be(true);
35+
});
36+
37+
it('should create filters when create filter button is clicked', async () => {
38+
await testSubjects.click('mapTooltipCreateFilterButton');
39+
await testSubjects.click('applyFiltersPopoverButton');
40+
41+
// TODO: Fix me #64861
42+
// const hasSourceFilter = await filterBar.hasFilter('name', 'charlie');
43+
// expect(hasSourceFilter).to.be(true);
2544

26-
it('should display create filter button when tooltip is locked', async () => {
27-
const exists = await testSubjects.exists('mapTooltipCreateFilterButton');
28-
expect(exists).to.be(true);
45+
const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
46+
expect(hasJoinFilter).to.be(true);
47+
});
2948
});
3049

31-
it('should create filters when create filter button is clicked', async () => {
32-
await testSubjects.click('mapTooltipCreateFilterButton');
33-
await testSubjects.click('applyFiltersPopoverButton');
50+
describe('panel actions', () => {
51+
before(async () => {
52+
await loadDashboardAndOpenTooltip();
53+
});
54+
55+
it('should display more actions button when tooltip is locked', async () => {
56+
const exists = await testSubjects.exists('mapTooltipMoreActionsButton');
57+
expect(exists).to.be(true);
58+
});
59+
60+
it('should trigger drilldown action when clicked', async () => {
61+
await testSubjects.click('mapTooltipMoreActionsButton');
62+
await testSubjects.click('mapFilterActionButton__drilldown1');
3463

35-
// TODO: Fix me #64861
36-
// const hasSourceFilter = await filterBar.hasFilter('name', 'charlie');
37-
// expect(hasSourceFilter).to.be(true);
64+
// Assert on new dashboard with filter from action
65+
await PageObjects.dashboard.waitForRenderComplete();
66+
const panelCount = await PageObjects.dashboard.getPanelCount();
67+
expect(panelCount).to.equal(2);
3868

39-
const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
40-
expect(hasJoinFilter).to.be(true);
69+
const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
70+
expect(hasJoinFilter).to.be(true);
71+
});
4172
});
4273
});
4374
}

x-pack/test/functional/es_archives/maps/kibana/data.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@
10481048
"title" : "dash for tooltip filter action test",
10491049
"hits" : 0,
10501050
"description" : "Zoomed in so entire screen is covered by filter so click to open tooltip can not miss.",
1051-
"panelsJSON" : "[{\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":26,\"i\":\"1\"},\"version\":\"8.0.0\",\"panelIndex\":\"1\",\"embeddableConfig\":{\"mapCenter\":{\"lat\":-1.31919,\"lon\":59.53306,\"zoom\":9.67},\"isLayerTOCOpen\":false,\"openTOCDetails\":[\"n1t6f\"]},\"panelRefName\":\"panel_0\"}]",
1051+
"panelsJSON" : "[{\"version\":\"8.0.0\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":26,\"i\":\"1\"},\"panelIndex\":\"1\",\"embeddableConfig\":{\"mapCenter\":{\"lat\":-1.31919,\"lon\":59.53306,\"zoom\":9.67},\"isLayerTOCOpen\":false,\"openTOCDetails\":[\"n1t6f\"],\"hiddenLayers\":[],\"enhancements\":{\"dynamicActions\":{\"events\":[{\"eventId\":\"669a3521-1215-4228-9ced-77e2edf5ad17\",\"triggers\":[\"FILTER_TRIGGER\"],\"action\":{\"name\":\"drilldown1\",\"config\":{\"dashboardId\":\"19906970-2e40-11e9-85cb-6965aae20f13\",\"useCurrentFilters\":true,\"useCurrentDateRange\":true},\"factoryId\":\"DASHBOARD_TO_DASHBOARD_DRILLDOWN\"}}]}}},\"panelRefName\":\"panel_0\"}]",
10521052
"optionsJSON" : "{\"useMargins\":true,\"hidePanelTitles\":false}",
10531053
"version" : 1,
10541054
"timeRestore" : true,
@@ -1071,9 +1071,9 @@
10711071
}
10721072
],
10731073
"migrationVersion" : {
1074-
"dashboard" : "7.0.0"
1074+
"dashboard" : "7.3.0"
10751075
},
1076-
"updated_at" : "2019-06-14T14:09:25.039Z"
1076+
"updated_at" : "2020-08-26T14:32:27.854Z"
10771077
}
10781078
}
10791079
}

0 commit comments

Comments
 (0)