mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 19:13:14 -04:00
## Summary Pre-req for #182535. We're removing the linked to library and drilldown notifications as part of the panel hover actions redesign which gets rid of the title bar in edit mode. We want to prevent panels from having a title bar when titles are hidden and believe these notifications are no longer necessary. The only notification retained is the panel filter notification. <img width="421" alt="Screenshot 2024-08-20 at 6 34 16 AM" src="https://github.com/user-attachments/assets/9f954a6f-3a70-43c9-a3c3-28f92f1efba8"> <img width="269" alt="Screenshot 2024-08-20 at 6 37 18 AM" src="https://github.com/user-attachments/assets/b6c154d5-0b8c-4c8b-ac72-a190d03f8801"> I also did some cleanup and removed unused page objects from the vis, dashboard, and discover functional tests. ### 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 - [ ] [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 - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] 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) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
234 lines
8.1 KiB
TypeScript
234 lines
8.1 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import expect from '@kbn/expect';
|
|
|
|
import { FtrProviderContext } from '../ftr_provider_context';
|
|
|
|
export function CanvasPageProvider({ getService, getPageObjects }: FtrProviderContext) {
|
|
const log = getService('log');
|
|
const testSubjects = getService('testSubjects');
|
|
const find = getService('find');
|
|
const browser = getService('browser');
|
|
const { common } = getPageObjects(['common']);
|
|
|
|
return {
|
|
async goToListingPage() {
|
|
log.debug('CanvasPage.goToListingPage');
|
|
// disabling the current url check because canvas moved away from
|
|
// hash router and redirects from /app/canvas#/ to /app/canvas/
|
|
// but navigateToUrl includes hash in the url which causes test flakiness
|
|
await common.navigateToUrl('canvas', '', {
|
|
ensureCurrentUrl: false,
|
|
shouldUseHashForSubUrl: false,
|
|
});
|
|
await testSubjects.existOrFail('workpadListing');
|
|
},
|
|
|
|
async enterFullscreen() {
|
|
log.debug('CanvasPage.enterFullscreen');
|
|
const elem = await find.byCssSelector('[aria-label="View fullscreen"]', 20000);
|
|
await elem.click();
|
|
},
|
|
|
|
async exitFullscreen() {
|
|
log.debug('CanvasPage.exitFullscreen');
|
|
await browser.pressKeys(browser.keys.ESCAPE);
|
|
},
|
|
|
|
async openExpressionEditor() {
|
|
log.debug('CanvasPage.openExpressionEditor');
|
|
await testSubjects.click('canvasExpressionEditorButton');
|
|
},
|
|
|
|
async waitForWorkpadElements() {
|
|
log.debug('CanvasPage.waitForWorkpadElements');
|
|
await testSubjects.findAll('canvasWorkpadPage > canvasWorkpadPageElementContent');
|
|
},
|
|
|
|
/*
|
|
* Finds the first workpad in the loader (uses find, not findAll) and
|
|
* ensures the expected name is the actual name. Then it clicks the element
|
|
* to load the workpad. Resolves once the workpad is in the DOM
|
|
*/
|
|
async loadFirstWorkpad(workpadName: string) {
|
|
log.debug('CanvasPage.loadFirstWorkpad', workpadName);
|
|
await testSubjects.setValue('tableListSearchBox', workpadName);
|
|
const elem = await testSubjects.find('canvasWorkpadTableWorkpad');
|
|
const text = await elem.getVisibleText();
|
|
expect(text).to.be(workpadName);
|
|
await elem.click();
|
|
await testSubjects.existOrFail('canvasWorkpadPage');
|
|
},
|
|
|
|
async createNewWorkpad() {
|
|
log.debug('CanvasPage.createNewWorkpad');
|
|
await testSubjects.click('create-workpad-button');
|
|
},
|
|
|
|
async fillOutCustomElementForm(name: string, description: string) {
|
|
log.debug('CanvasPage.fillOutCustomElementForm', name);
|
|
// Fill out the custom element form and submit it
|
|
await testSubjects.setValue('canvasCustomElementForm-name', name, {
|
|
clearWithKeyboard: true,
|
|
});
|
|
await testSubjects.setValue('canvasCustomElementForm-description', description, {
|
|
clearWithKeyboard: true,
|
|
});
|
|
|
|
await testSubjects.click('canvasCustomElementForm-submit');
|
|
},
|
|
|
|
async expectCreateWorkpadButtonEnabled() {
|
|
log.debug('CanvasPage.expectCreateWorkpadButtonEnabled');
|
|
const button = await testSubjects.find('create-workpad-button', 20000);
|
|
const disabledAttr = await button.getAttribute('disabled');
|
|
expect(disabledAttr).to.be(null);
|
|
},
|
|
|
|
async expectCreateWorkpadButtonDisabled() {
|
|
log.debug('CanvasPage.expectCreateWorkpadButtonDisabled');
|
|
const button = await testSubjects.find('create-workpad-button', 20000);
|
|
const disabledAttr = await button.getAttribute('disabled');
|
|
expect(disabledAttr).to.be('true');
|
|
},
|
|
|
|
async openAddElementMenu() {
|
|
log.debug('CanvasPage.openAddElementsMenu');
|
|
await testSubjects.click('add-element-button');
|
|
},
|
|
|
|
async openAddChartMenu() {
|
|
log.debug('CanvasPage.openAddChartMenu');
|
|
await this.openAddElementMenu();
|
|
await testSubjects.click('canvasAddElementMenu__Chart');
|
|
},
|
|
|
|
async createNewDatatableElement() {
|
|
log.debug('CanvasPage.createNewDatatableElement');
|
|
await this.openAddChartMenu();
|
|
await testSubjects.click('canvasAddElementMenu__table');
|
|
},
|
|
|
|
async openSavedElementsModal() {
|
|
log.debug('CanvasPage.openSavedElementsModal');
|
|
await testSubjects.click('add-element-button');
|
|
await testSubjects.click('saved-elements-menu-option');
|
|
|
|
await common.sleep(1000); // give time for modal animation to complete
|
|
},
|
|
|
|
async closeSavedElementsModal() {
|
|
log.debug('CanvasPage.closeSavedElementsModal');
|
|
await testSubjects.click('saved-elements-modal-close-button');
|
|
},
|
|
|
|
async expectAddElementButton() {
|
|
log.debug('CanvasPage.expectAddElementButton');
|
|
await testSubjects.existOrFail('add-element-button');
|
|
},
|
|
|
|
async expectNoAddElementButton() {
|
|
log.debug('CanvasPage.expectNoAddElementButton');
|
|
// Ensure page is fully loaded first by waiting for the refresh button
|
|
const refreshPopoverExists = await testSubjects.exists('canvas-refresh-control', {
|
|
timeout: 20000,
|
|
});
|
|
expect(refreshPopoverExists).to.be(true);
|
|
|
|
await testSubjects.missingOrFail('add-element-button');
|
|
},
|
|
|
|
async getFiltersFromDebug(type: 'range' | 'term') {
|
|
log.debug(`CanvasPage.getFiltersFromDebug: ${type}`);
|
|
await testSubjects.existOrFail('canvasDebug__content');
|
|
|
|
const contentElem = await testSubjects.find('canvasDebug__content');
|
|
const content = await contentElem.getVisibleText();
|
|
|
|
const filters = JSON.parse(content);
|
|
|
|
return filters.filters.filter((f: any) => f.query[type]);
|
|
},
|
|
|
|
async clickAddFromLibrary() {
|
|
log.debug('CanvasPage.clickAddFromLibrary');
|
|
await testSubjects.click('canvas-add-from-library-button');
|
|
await testSubjects.existOrFail('dashboardAddPanel');
|
|
},
|
|
|
|
async setWorkpadName(name: string) {
|
|
log.debug('CanvasPage.setWorkpadName');
|
|
await testSubjects.setValue('canvas-workpad-name-text-field', name);
|
|
const lastBreadcrumb = await testSubjects.getVisibleText('breadcrumb last');
|
|
expect(lastBreadcrumb).to.eql(name);
|
|
},
|
|
|
|
async goToListingPageViaBreadcrumbs() {
|
|
log.debug('CanvasPage.goToListingPageViaBreadcrumbs');
|
|
await testSubjects.click('breadcrumb first');
|
|
},
|
|
|
|
async createNewVis(visType: string) {
|
|
log.debug('CanvasPage.createNewVisType', visType);
|
|
await testSubjects.click('canvasEditorMenuButton');
|
|
await testSubjects.click(`visType-${visType}`);
|
|
},
|
|
|
|
async getEmbeddableCount() {
|
|
log.debug('CanvasPage.getEmbeddableCount');
|
|
const panels = await testSubjects.findAll('embeddablePanel');
|
|
return panels.length;
|
|
},
|
|
|
|
async deleteSelectedElement() {
|
|
log.debug('CanvasPage.deleteSelectedElement');
|
|
await testSubjects.click('canvasWorkpadEditMenuButton');
|
|
await testSubjects.click('canvasEditMenuDeleteButton');
|
|
},
|
|
|
|
async openDatasourceTab() {
|
|
log.debug('CanvasPage.openDataTab');
|
|
await testSubjects.click('canvasSidebarDataTab');
|
|
},
|
|
|
|
async changeDatasourceTo(datasourceName: string) {
|
|
log.debug('CanvasPage.changeDatasourceTo');
|
|
await testSubjects.click('canvasChangeDatasourceButton');
|
|
await testSubjects.click(`canvasDatasourceCard__${datasourceName}`);
|
|
},
|
|
|
|
async saveDatasourceChanges() {
|
|
log.debug('CanvasPage.saveDatasourceChanges');
|
|
await testSubjects.click('canvasSaveDatasourceButton');
|
|
},
|
|
|
|
async goToPreviousPage() {
|
|
log.debug('CanvasPage.goToPreviousPage');
|
|
await testSubjects.click('previousPageButton');
|
|
},
|
|
|
|
async goToNextPage() {
|
|
log.debug('CanvasPage.goToNextPage');
|
|
await testSubjects.click('nextPageButton');
|
|
},
|
|
|
|
async togglePageManager() {
|
|
log.debug('CanvasPage.openPageManager');
|
|
await testSubjects.click('canvasPageManagerButton');
|
|
},
|
|
|
|
async addNewPage() {
|
|
log.debug('CanvasPage.addNewPage');
|
|
if (!(await testSubjects.exists('canvasAddPageButton'))) {
|
|
await this.togglePageManager();
|
|
}
|
|
await testSubjects.click('canvasAddPageButton');
|
|
await this.togglePageManager();
|
|
},
|
|
};
|
|
}
|