mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Lens on Dashboard 7.12.1 Smoke Tests (#102667)
* added smoke tests for lens by value panels on dashboard
This commit is contained in:
parent
28162810ad
commit
3dc59a30aa
4 changed files with 125 additions and 29 deletions
|
@ -211,20 +211,44 @@ export class DashboardPanelActionsService extends FtrService {
|
|||
await this.testSubjects.click('confirmSaveSavedObjectButton');
|
||||
}
|
||||
|
||||
async expectExistsPanelAction(testSubject: string, title?: string) {
|
||||
this.log.debug('expectExistsPanelAction', testSubject);
|
||||
|
||||
const panelWrapper = title ? await this.getPanelHeading(title) : undefined;
|
||||
await this.openContextMenu(panelWrapper);
|
||||
|
||||
if (!(await this.testSubjects.exists(testSubject))) {
|
||||
if (await this.hasContextMenuMoreItem()) {
|
||||
await this.clickContextMenuMoreItem();
|
||||
}
|
||||
await this.testSubjects.existOrFail(testSubject);
|
||||
}
|
||||
await this.toggleContextMenu(panelWrapper);
|
||||
}
|
||||
|
||||
async expectExistsRemovePanelAction() {
|
||||
this.log.debug('expectExistsRemovePanelAction');
|
||||
await this.expectExistsPanelAction(REMOVE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsPanelAction(testSubject: string) {
|
||||
this.log.debug('expectExistsPanelAction', testSubject);
|
||||
await this.openContextMenu();
|
||||
if (await this.testSubjects.exists(CLONE_PANEL_DATA_TEST_SUBJ)) return;
|
||||
if (await this.hasContextMenuMoreItem()) {
|
||||
await this.clickContextMenuMoreItem();
|
||||
}
|
||||
await this.testSubjects.existOrFail(CLONE_PANEL_DATA_TEST_SUBJ);
|
||||
await this.toggleContextMenu();
|
||||
async expectExistsEditPanelAction(title?: string) {
|
||||
this.log.debug('expectExistsEditPanelAction');
|
||||
await this.expectExistsPanelAction(EDIT_PANEL_DATA_TEST_SUBJ, title);
|
||||
}
|
||||
|
||||
async expectExistsReplacePanelAction() {
|
||||
this.log.debug('expectExistsReplacePanelAction');
|
||||
await this.expectExistsPanelAction(REPLACE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsClonePanelAction() {
|
||||
this.log.debug('expectExistsClonePanelAction');
|
||||
await this.expectExistsPanelAction(CLONE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsToggleExpandAction() {
|
||||
this.log.debug('expectExistsToggleExpandAction');
|
||||
await this.expectExistsPanelAction(TOGGLE_EXPAND_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectMissingPanelAction(testSubject: string) {
|
||||
|
@ -238,21 +262,6 @@ export class DashboardPanelActionsService extends FtrService {
|
|||
await this.toggleContextMenu();
|
||||
}
|
||||
|
||||
async expectExistsEditPanelAction() {
|
||||
this.log.debug('expectExistsEditPanelAction');
|
||||
await this.expectExistsPanelAction(EDIT_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsReplacePanelAction() {
|
||||
this.log.debug('expectExistsReplacePanelAction');
|
||||
await this.expectExistsPanelAction(REPLACE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsClonePanelAction() {
|
||||
this.log.debug('expectExistsClonePanelAction');
|
||||
await this.expectExistsPanelAction(CLONE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectMissingEditPanelAction() {
|
||||
this.log.debug('expectMissingEditPanelAction');
|
||||
await this.expectMissingPanelAction(EDIT_PANEL_DATA_TEST_SUBJ);
|
||||
|
@ -273,11 +282,6 @@ export class DashboardPanelActionsService extends FtrService {
|
|||
await this.expectMissingPanelAction(REMOVE_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async expectExistsToggleExpandAction() {
|
||||
this.log.debug('expectExistsToggleExpandAction');
|
||||
await this.expectExistsPanelAction(TOGGLE_EXPAND_PANEL_DATA_TEST_SUBJ);
|
||||
}
|
||||
|
||||
async getPanelHeading(title: string) {
|
||||
return await this.testSubjects.find(`embeddablePanelHeading-${title.replace(/\s/g, '')}`);
|
||||
}
|
||||
|
|
|
@ -19,5 +19,7 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./_async_dashboard'));
|
||||
loadTestFile(require.resolve('./dashboard_lens_by_value'));
|
||||
loadTestFile(require.resolve('./dashboard_maps_by_value'));
|
||||
|
||||
loadTestFile(require.resolve('./migration_smoke_tests/lens_migration_smoke_test'));
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* This test is importing saved objects from 7.13.0 to 8.0 and the backported version
|
||||
* will import from 6.8.x to 7.x.x
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import path from 'path';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||
|
||||
const PageObjects = getPageObjects(['common', 'settings', 'header', 'savedObjects', 'dashboard']);
|
||||
|
||||
describe('Export import saved objects between versions', () => {
|
||||
before(async () => {
|
||||
await esArchiver.loadIfNeeded(
|
||||
'x-pack/test/functional/es_archives/getting_started/shakespeare'
|
||||
);
|
||||
await kibanaServer.uiSettings.replace({});
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaSavedObjects();
|
||||
await PageObjects.savedObjects.importFile(
|
||||
path.join(__dirname, 'exports', 'lens_dashboard_migration_test_7_12_1.ndjson')
|
||||
);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esArchiver.unload('x-pack/test/functional/es_archives/getting_started/shakespeare');
|
||||
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
|
||||
});
|
||||
|
||||
it('should be able to import dashboard with various Lens panels from 7.12.1', async () => {
|
||||
// this will catch cases where there is an error in the migrations.
|
||||
await PageObjects.savedObjects.checkImportSucceeded();
|
||||
await PageObjects.savedObjects.clickImportDone();
|
||||
});
|
||||
|
||||
it('should render all panels on the dashboard', async () => {
|
||||
await PageObjects.common.navigateToApp('dashboard');
|
||||
await PageObjects.dashboard.loadSavedDashboard('[7.12.1] Lens By Value Test Dashboard');
|
||||
|
||||
// dashboard should load properly
|
||||
await PageObjects.dashboard.expectOnDashboard('[7.12.1] Lens By Value Test Dashboard');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
|
||||
// There should be 0 error embeddables on the dashboard
|
||||
const errorEmbeddables = await testSubjects.findAll('embeddableStackError');
|
||||
expect(errorEmbeddables.length).to.be(0);
|
||||
});
|
||||
|
||||
it('should show the edit action for all panels', async () => {
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
|
||||
// All panels should be editable. This will catch cases where an error does not create an error embeddable.
|
||||
const panelTitles = await PageObjects.dashboard.getPanelTitles();
|
||||
for (const title of panelTitles) {
|
||||
await dashboardPanelActions.expectExistsEditPanelAction(title);
|
||||
}
|
||||
});
|
||||
|
||||
it('should retain all panel drilldowns from 7.12.1', async () => {
|
||||
// Both panels configured with drilldowns in 7.12.1 should still have drilldowns.
|
||||
const totalPanels = await PageObjects.dashboard.getPanelCount();
|
||||
let panelsWithDrilldowns = 0;
|
||||
for (let panelIndex = 0; panelIndex < totalPanels; panelIndex++) {
|
||||
if ((await PageObjects.dashboard.getPanelDrilldownCount(panelIndex)) === 1) {
|
||||
panelsWithDrilldowns++;
|
||||
}
|
||||
}
|
||||
expect(panelsWithDrilldowns).to.be(2);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue