Skip to content

Commit

Permalink
[Performance] Add dashboard creation to journey (elastic#148818)
Browse files Browse the repository at this point in the history
## Summary

Add a new dashboard.

Blocked by elastic#148768

### Checklist

Delete any items that are not applicable to this PR.

- ~~[ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~~
- ~~[ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~~
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- ~~[ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~~
- ~~[ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~~
- ~~[ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~~
- ~~[ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~~
- ~~[ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~~


### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
thomasneirynck authored and wayneseymour committed Jan 19, 2023
1 parent 391db5b commit 9f177c0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/plugins/dashboard/public/dashboard_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function createDashboardListingFilterUrl(filter: string | undefined) {
export const DASHBOARD_LOADED_EVENT = 'dashboard_loaded';
export const SAVED_OBJECT_LOADED_TIME = 'saved_object_loaded_time';
export const SAVED_OBJECT_DELETE_TIME = 'saved_object_delete_time';
export const SAVED_OBJECT_POST_TIME = 'saved_object_post_time';
export const DASHBOARD_UI_METRIC_ID = 'dashboard';

// ------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import React from 'react';
import { batch } from 'react-redux';
import { showSaveModal } from '@kbn/saved-objects-plugin/public';

import { reportPerformanceMetricEvent } from '@kbn/ebt-tools';
import { DASHBOARD_SAVED_OBJECT_TYPE, SAVED_OBJECT_POST_TIME } from '../../../dashboard_constants';
import { DashboardSaveOptions, DashboardStateFromSaveModal } from '../../types';
import { DashboardSaveModal } from './overlays/save_modal';
import { DashboardContainer } from '../dashboard_container';
Expand Down Expand Up @@ -84,11 +86,20 @@ export function runSaveAs(this: DashboardContainer) {
...currentState,
...stateFromSaveModal,
};
const beforeAddTime = window.performance.now();
const saveResult = await saveDashboardStateToSavedObject({
currentState: stateToSave,
saveOptions,
lastSavedId,
});
const addDuration = window.performance.now() - beforeAddTime;
reportPerformanceMetricEvent(pluginServices.getServices().analytics, {
eventName: SAVED_OBJECT_POST_TIME,
duration: addDuration,
meta: {
saved_object_type: DASHBOARD_SAVED_OBJECT_TYPE,
},
});

stateFromSaveModal.lastSavedId = saveResult.id;
if (saveResult.id) {
Expand Down
15 changes: 14 additions & 1 deletion x-pack/performance/journeys/dashboard_listing_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const journey = new Journey({
await page.goto(kbnUrl.get(`/app/dashboards`));
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
})
.step('Search dashboards page', async ({ page, inputDelays }) => {
.step('Search dashboards', async ({ page, inputDelays }) => {
await page.type('[data-test-subj="tableListSearchBox"]', 'Web', {
delay: inputDelays.TYPING,
});
Expand All @@ -29,4 +29,17 @@ export const journey = new Journey({
await page.click('[data-test-subj="deleteSelectedItems"]');
await page.click('[data-test-subj="confirmModalConfirmButton"]');
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
})
.step('Add dashboard', async ({ page, inputDelays }) => {
await page.click('[data-test-subj="newItemButton"]');
await page.click('[data-test-subj="dashboardSaveMenuItem"]');
await page.type('[data-test-subj="savedObjectTitle"]', 'foobar dashboard', {
delay: inputDelays.TYPING,
});
await page.click('[data-test-subj="confirmSaveSavedObjectButton"]');
await page.locator('[data-test-subj="saveDashboardSuccess"]');
})
.step('Return to dashboard list', async ({ page, inputDelays }) => {
await page.click('[data-test-subj="breadcrumb dashboardListingBreadcrumb first"]');
await page.waitForSelector(`[data-test-subj="table-is-ready"]`);
});

0 comments on commit 9f177c0

Please sign in to comment.