mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Dashboard] Run Smoke tests in Serverless (#164992)
Add Dashboard functional test coverage to the Serverless ES project.
This commit is contained in:
parent
5ae86eefd7
commit
217c118caa
7 changed files with 203 additions and 24 deletions
|
@ -102,14 +102,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
});
|
||||
|
||||
it('does not show unsaved changes on new dashboard when no panels have been added', async () => {
|
||||
await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle);
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingDoesNotExist(unsavedDashboardTitle);
|
||||
});
|
||||
|
||||
it('can discard unsaved changes using the discard link', async () => {
|
||||
await PageObjects.dashboard.clickUnsavedChangesDiscard(
|
||||
`discard-unsaved-${dashboardTitle.split(' ').join('-')}`
|
||||
);
|
||||
await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(dashboardTitle);
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingDoesNotExist(dashboardTitle);
|
||||
await PageObjects.dashboard.loadSavedDashboard(dashboardTitle);
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
const currentPanelCount = await PageObjects.dashboard.getPanelCount();
|
||||
|
@ -132,7 +132,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await PageObjects.dashboard.saveDashboard(newDashboartTitle);
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle);
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingDoesNotExist(unsavedDashboardTitle);
|
||||
});
|
||||
|
||||
it('does not list unsaved changes when unsaved version of the dashboard is the same', async () => {
|
||||
|
@ -167,7 +167,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
// Check that it now does not exist
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(newDashboartTitle);
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingDoesNotExist(newDashboartTitle);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ export class DashboardPageObject extends FtrService {
|
|||
await this.testSubjects.existOrFail(`edit-unsaved-${title.split(' ').join('-')}`);
|
||||
}
|
||||
|
||||
public async expectUnsavedChangesDoesNotExist(title: string) {
|
||||
public async expectUnsavedChangesListingDoesNotExist(title: string) {
|
||||
this.log.debug(`Expect Unsaved Changes Listing Does Not Exist for `, title);
|
||||
await this.testSubjects.missingOrFail(`edit-unsaved-${title.split(' ').join('-')}`);
|
||||
}
|
||||
|
@ -174,11 +174,6 @@ export class DashboardPageObject extends FtrService {
|
|||
await this.testSubjects.existOrFail('dashboardLandingPage');
|
||||
}
|
||||
|
||||
public async clickDashboardBreadcrumbLink() {
|
||||
this.log.debug('clickDashboardBreadcrumbLink');
|
||||
await this.testSubjects.click('breadcrumb dashboardListingBreadcrumb first');
|
||||
}
|
||||
|
||||
public async expectOnDashboard(expectedTitle: string) {
|
||||
await this.retry.waitFor(
|
||||
`last breadcrumb to have dashboard title: ${expectedTitle}`,
|
||||
|
@ -192,19 +187,21 @@ export class DashboardPageObject extends FtrService {
|
|||
|
||||
public async gotoDashboardLandingPage(ignorePageLeaveWarning = true) {
|
||||
this.log.debug('gotoDashboardLandingPage');
|
||||
const onPage = await this.onDashboardLandingPage();
|
||||
if (!onPage) {
|
||||
await this.clickDashboardBreadcrumbLink();
|
||||
await this.retry.try(async () => {
|
||||
const warning = await this.testSubjects.exists('confirmModalTitleText');
|
||||
if (warning) {
|
||||
await this.testSubjects.click(
|
||||
ignorePageLeaveWarning ? 'confirmModalConfirmButton' : 'confirmModalCancelButton'
|
||||
);
|
||||
}
|
||||
});
|
||||
await this.expectExistsDashboardLandingPage();
|
||||
}
|
||||
if (await this.onDashboardLandingPage()) return;
|
||||
|
||||
const breadcrumbLink = this.config.get('serverless')
|
||||
? 'breadcrumb breadcrumb-deepLinkId-dashboards'
|
||||
: 'breadcrumb dashboardListingBreadcrumb first';
|
||||
await this.testSubjects.click(breadcrumbLink);
|
||||
await this.retry.try(async () => {
|
||||
const warning = await this.testSubjects.exists('confirmModalTitleText');
|
||||
if (warning) {
|
||||
await this.testSubjects.click(
|
||||
ignorePageLeaveWarning ? 'confirmModalConfirmButton' : 'confirmModalCancelButton'
|
||||
);
|
||||
}
|
||||
});
|
||||
await this.expectExistsDashboardLandingPage();
|
||||
}
|
||||
|
||||
public async clickClone() {
|
||||
|
@ -336,6 +333,12 @@ export class DashboardPageObject extends FtrService {
|
|||
});
|
||||
}
|
||||
|
||||
public async expectMissingUnsavedChangesBadge() {
|
||||
await this.retry.try(async () => {
|
||||
await this.testSubjects.missingOrFail('dashboardUnsavedChangesBadge');
|
||||
});
|
||||
}
|
||||
|
||||
public async clickNewDashboard(continueEditing = false) {
|
||||
const discardButtonExists = await this.testSubjects.exists('discardDashboardPromptButton');
|
||||
if (!continueEditing && discardButtonExists) {
|
||||
|
|
|
@ -43,7 +43,7 @@ export class TimeToVisualizePageObject extends FtrService {
|
|||
|
||||
public async resetNewDashboard() {
|
||||
await this.common.navigateToApp('dashboard');
|
||||
await this.dashboard.gotoDashboardLandingPage(true);
|
||||
await this.dashboard.gotoDashboardLandingPage();
|
||||
await this.dashboard.clickNewDashboard(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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 default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const PageObjects = getPageObjects([
|
||||
'timePicker',
|
||||
'dashboard',
|
||||
'visualize',
|
||||
'common',
|
||||
'header',
|
||||
'lens',
|
||||
]);
|
||||
|
||||
const pieChart = getService('pieChart');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const elasticChart = getService('elasticChart');
|
||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||
|
||||
describe('Building a new dashboard', function () {
|
||||
before(async () => {
|
||||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
|
||||
);
|
||||
await PageObjects.common.navigateToApp('dashboards');
|
||||
await PageObjects.dashboard.preserveCrossAppState();
|
||||
await PageObjects.dashboard.clickNewDashboard();
|
||||
await elasticChart.setNewChartUiDebugFlag(true);
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
|
||||
await kibanaServer.importExport.unload(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json'
|
||||
);
|
||||
});
|
||||
|
||||
it('can add a lens panel by value', async () => {
|
||||
await PageObjects.lens.createAndAddLensFromDashboard({});
|
||||
const newPanelCount = await PageObjects.dashboard.getPanelCount();
|
||||
expect(newPanelCount).to.eql(1);
|
||||
});
|
||||
|
||||
it('can edit a Lens panel by value and save changes', async () => {
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await dashboardPanelActions.openContextMenu();
|
||||
await dashboardPanelActions.clickEdit();
|
||||
await PageObjects.lens.switchToVisualization('donut');
|
||||
await PageObjects.lens.saveAndReturn();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
|
||||
const partitionVisExists = await testSubjects.exists('partitionVisChart');
|
||||
expect(partitionVisExists).to.be(true);
|
||||
});
|
||||
|
||||
it('can add a filter pill by clicking on the Lens chart', async () => {
|
||||
await pieChart.filterOnPieSlice('97.220.3.248');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
|
||||
it('can access a new Dashboard from the unsaved changes section of the listing page', async () => {
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingExists('New Dashboard');
|
||||
await PageObjects.dashboard.clickUnsavedChangesContinueEditing('New Dashboard');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
|
||||
// Test that the panel loads and the filter is properly applied
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
|
||||
it('can save the Dashboard successfully', async () => {
|
||||
await PageObjects.dashboard.expectUnsavedChangesBadge();
|
||||
await PageObjects.dashboard.saveDashboard('Super Serverless');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await PageObjects.dashboard.expectMissingUnsavedChangesBadge();
|
||||
});
|
||||
|
||||
it('loads the saved Dashboard', async () => {
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.dashboard.expectUnsavedChangesListingDoesNotExist('New Dashboard');
|
||||
|
||||
await PageObjects.dashboard.loadSavedDashboard('Super Serverless');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await PageObjects.dashboard.expectMissingUnsavedChangesBadge();
|
||||
// Test that the panel loads and the filter is properly applied
|
||||
await pieChart.expectPieSliceCount(1);
|
||||
});
|
||||
});
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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 PageObjects = getPageObjects(['common', 'settings', 'header', 'savedObjects', 'dashboard']);
|
||||
|
||||
describe('Importing an existing dashboard', () => {
|
||||
before(async () => {
|
||||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
|
||||
await kibanaServer.uiSettings.replace({});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esArchiver.unload('x-pack/test/functional/es_archives/logstash_functional');
|
||||
await kibanaServer.savedObjects.cleanStandardList();
|
||||
});
|
||||
|
||||
it('should be able to import dashboard created in 8.11', async () => {
|
||||
await PageObjects.common.navigateToApp('management');
|
||||
await testSubjects.click('app-card-objects');
|
||||
await PageObjects.savedObjects.waitTableIsLoaded();
|
||||
await PageObjects.savedObjects.importFile(
|
||||
path.join(__dirname, 'exports', 'serverless_dashboard_8_11.ndjson')
|
||||
);
|
||||
|
||||
// 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('dashboards');
|
||||
await PageObjects.dashboard.loadSavedDashboard('Super Saved Serverless');
|
||||
|
||||
// dashboard should load properly
|
||||
await PageObjects.dashboard.expectOnDashboard('Super Saved Serverless');
|
||||
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('does not show the unsaved changes badge in edit mode', async () => {
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await PageObjects.dashboard.expectMissingUnsavedChangesBadge();
|
||||
});
|
||||
});
|
||||
}
|
|
@ -13,5 +13,8 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./empty_page'));
|
||||
loadTestFile(require.resolve('./navigation'));
|
||||
loadTestFile(require.resolve('./cases/attachment_framework'));
|
||||
|
||||
loadTestFile(require.resolve('./dashboards/build_dashboard'));
|
||||
loadTestFile(require.resolve('./dashboards/import_dashboard'));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue