Skip to content

Commit

Permalink
update snapshot and add functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Aug 26, 2020
1 parent 37ecfc5 commit abdac76
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 43 deletions.

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 @@ -117,14 +117,16 @@ export class FeatureProperties extends React.Component {
items: this.state.actions.map((action) => {
const actionContext = this.props.getActionContext();
const iconType = action.getIconType ? action.getIconType(actionContext) : null;
const name = action.getDisplayName ? action.getDisplayName(actionContext) : action.id;
return {
name: action.getDisplayName ? action.getDisplayName(actionContext) : action.id,
name,
icon: iconType ? <EuiIcon type={iconType} /> : null,
onClick: async () => {
this.props.onCloseTooltip();
const filters = await tooltipProperty.getESFilters();
this.props.addFilters(filters, action.id);
},
['data-test-subj']: `mapFilterActionButton__${name}`,
};
}),
};
Expand Down Expand Up @@ -202,6 +204,7 @@ export class FeatureProperties extends React.Component {
aria-label={i18n.translate('xpack.maps.tooltip.viewActionsTitle', {
defaultMessage: 'View filter actions',
})}
data-test-subj="mapTooltipMoreActionsButton"
>
<EuiIcon type="arrowRight" />
</EuiButtonEmpty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,62 @@ export default function ({ getPageObjects, getService }) {
const filterBar = getService('filterBar');

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

await PageObjects.maps.lockTooltipAtPosition(200, -200);
});
}

describe('apply filter to current view', () => {
before(async () => {
await loadDashboardAndOpenTooltip();
});

it('should display create filter button when tooltip is locked', async () => {
const exists = await testSubjects.exists('mapTooltipCreateFilterButton');
expect(exists).to.be(true);
});

it('should create filters when create filter button is clicked', async () => {
await testSubjects.click('mapTooltipCreateFilterButton');
await testSubjects.click('applyFiltersPopoverButton');

// TODO: Fix me #64861
// const hasSourceFilter = await filterBar.hasFilter('name', 'charlie');
// expect(hasSourceFilter).to.be(true);

it('should display create filter button when tooltip is locked', async () => {
const exists = await testSubjects.exists('mapTooltipCreateFilterButton');
expect(exists).to.be(true);
const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
expect(hasJoinFilter).to.be(true);
});
});

it('should create filters when create filter button is clicked', async () => {
await testSubjects.click('mapTooltipCreateFilterButton');
await testSubjects.click('applyFiltersPopoverButton');
describe('panel actions', () => {
before(async () => {
await loadDashboardAndOpenTooltip();
});

it('should display more actions button when tooltip is locked', async () => {
const exists = await testSubjects.exists('mapTooltipMoreActionsButton');
expect(exists).to.be(true);
});

it('should trigger drilldown action when clicked', async () => {
await testSubjects.click('mapTooltipMoreActionsButton');
await testSubjects.click('mapFilterActionButton__drilldown1');

// TODO: Fix me #64861
// const hasSourceFilter = await filterBar.hasFilter('name', 'charlie');
// expect(hasSourceFilter).to.be(true);
// Assert on new dashboard with filter from action
await PageObjects.dashboard.waitForRenderComplete();
const panelCount = await PageObjects.dashboard.getPanelCount();
expect(panelCount).to.equal(2);

const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
expect(hasJoinFilter).to.be(true);
const hasJoinFilter = await filterBar.hasFilter('shape_name', 'charlie');
expect(hasJoinFilter).to.be(true);
});
});
});
}
6 changes: 3 additions & 3 deletions x-pack/test/functional/es_archives/maps/kibana/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@
"title" : "dash for tooltip filter action test",
"hits" : 0,
"description" : "Zoomed in so entire screen is covered by filter so click to open tooltip can not miss.",
"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\"}]",
"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\"}]",
"optionsJSON" : "{\"useMargins\":true,\"hidePanelTitles\":false}",
"version" : 1,
"timeRestore" : true,
Expand All @@ -1071,9 +1071,9 @@
}
],
"migrationVersion" : {
"dashboard" : "7.0.0"
"dashboard" : "7.3.0"
},
"updated_at" : "2019-06-14T14:09:25.039Z"
"updated_at" : "2020-08-26T14:32:27.854Z"
}
}
}
Expand Down

0 comments on commit abdac76

Please sign in to comment.