Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] Switch tests to use importExport - dashboard #94574

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 1 addition & 126 deletions test/functional/apps/dashboard/copy_panel_to.ts
Original file line number Diff line number Diff line change
@@ -1,126 +1 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dashboardVisualizations = getService('dashboardVisualizations');
const dashboardPanelActions = getService('dashboardPanelActions');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
const find = getService('find');

const PageObjects = getPageObjects([
'header',
'common',
'discover',
'dashboard',
'visualize',
'timePicker',
]);

const fewPanelsTitle = 'few panels';
const markdownTitle = 'Copy To Markdown';
let fewPanelsPanelCount = 0;

const openCopyToModal = async (panelName: string) => {
await dashboardPanelActions.openCopyToModalByTitle(panelName);
const modalIsOpened = await testSubjects.exists('copyToDashboardPanel');
expect(modalIsOpened).to.be(true);
const hasDashboardSelector = await testSubjects.exists('add-to-dashboard-options');
expect(hasDashboardSelector).to.be(true);
};

describe('dashboard panel copy to', function viewEditModeTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.preserveCrossAppState();
await PageObjects.dashboard.loadSavedDashboard(fewPanelsTitle);
await PageObjects.dashboard.waitForRenderComplete();
fewPanelsPanelCount = await PageObjects.dashboard.getPanelCount();

await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.timePicker.setHistoricalDataRange();
await dashboardVisualizations.createAndAddMarkdown({
name: markdownTitle,
markdown: 'Please add me to some other dashboard',
});
});

after(async function () {
await PageObjects.dashboard.gotoDashboardLandingPage();
});

it('does not show the new dashboard option when on a new dashboard', async () => {
await openCopyToModal(markdownTitle);
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const isDisabled = await dashboardSelector.findByCssSelector(
`input[id="new-dashboard-option"]:disabled`
);
expect(isDisabled).not.to.be(null);

await testSubjects.click('cancelCopyToButton');
});

it('copies a panel to an existing dashboard', async () => {
await openCopyToModal(markdownTitle);
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(
`label[for="existing-dashboard-option"]`
);
await label.click();

await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle);
await testSubjects.existOrFail(`dashboard-picker-option-few-panels`);
await find.clickByButtonText(fewPanelsTitle);
await testSubjects.click('confirmCopyToButton');

await PageObjects.dashboard.waitForRenderComplete();
await PageObjects.dashboard.expectOnDashboard(`Editing ${fewPanelsTitle}`);
const newPanelCount = await PageObjects.dashboard.getPanelCount();
expect(newPanelCount).to.be(fewPanelsPanelCount + 1);
});

it('does not show the current dashboard in the dashboard picker', async () => {
await openCopyToModal(markdownTitle);
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(
`label[for="existing-dashboard-option"]`
);
await label.click();

await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle);
await testSubjects.missingOrFail(`dashboard-picker-option-few-panels`);

await testSubjects.click('cancelCopyToButton');
});

it('copies a panel to a new dashboard', async () => {
await openCopyToModal(markdownTitle);
const dashboardSelector = await testSubjects.find('add-to-dashboard-options');
const label = await dashboardSelector.findByCssSelector(`label[for="new-dashboard-option"]`);
await label.click();
await testSubjects.click('confirmCopyToButton');

await PageObjects.dashboard.waitForRenderComplete();
await PageObjects.dashboard.expectOnDashboard(`Editing New Dashboard`);
});

it('it always appends new panels instead of overwriting', async () => {
const newPanelCount = await PageObjects.dashboard.getPanelCount();
expect(newPanelCount).to.be(2);
});
});
}
/* * 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 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */import expect from '@kbn/expect';import { FtrProviderContext } from '../../ftr_provider_context';export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardVisualizations = getService('dashboardVisualizations'); const dashboardPanelActions = getService('dashboardPanelActions'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const find = getService('find'); const PageObjects = getPageObjects([ 'header', 'common', 'discover', 'dashboard', 'visualize', 'timePicker', ]); const fewPanelsTitle = 'few panels'; const markdownTitle = 'Copy To Markdown'; let fewPanelsPanelCount = 0; const openCopyToModal = async (panelName: string) => { await dashboardPanelActions.openCopyToModalByTitle(panelName); const modalIsOpened = await testSubjects.exists('copyToDashboardPanel'); expect(modalIsOpened).to.be(true); const hasDashboardSelector = await testSubjects.exists('add-to-dashboard-options'); expect(hasDashboardSelector).to.be(true); }; describe('dashboard panel copy to', function viewEditModeTests() { before(async function () { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard(fewPanelsTitle); await PageObjects.dashboard.waitForRenderComplete(); fewPanelsPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setHistoricalDataRange(); await dashboardVisualizations.createAndAddMarkdown({ name: markdownTitle, markdown: 'Please add me to some other dashboard', }); }); after(async function () { await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('does not show the new dashboard option when on a new dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const isDisabled = await dashboardSelector.findByCssSelector( `input[id="new-dashboard-option"]:disabled` ); expect(isDisabled).not.to.be(null); await testSubjects.click('cancelCopyToButton'); }); it('copies a panel to an existing dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector( `label[for="existing-dashboard-option"]` ); await label.click(); await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); await testSubjects.existOrFail(`dashboard-picker-option-few-panels`); await find.clickByButtonText(fewPanelsTitle); await testSubjects.click('confirmCopyToButton'); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.expectOnDashboard(`Editing ${fewPanelsTitle}`); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.be(fewPanelsPanelCount + 1); }); it('does not show the current dashboard in the dashboard picker', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector( `label[for="existing-dashboard-option"]` ); await label.click(); await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); await testSubjects.missingOrFail(`dashboard-picker-option-few-panels`); await testSubjects.click('cancelCopyToButton'); }); it('copies a panel to a new dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector(`label[for="new-dashboard-option"]`); await label.click(); await testSubjects.click('confirmCopyToButton'); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.expectOnDashboard(`Editing New Dashboard`); }); it('it always appends new panels instead of overwriting', async () => { const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.be(2); }); });}
Expand Down
Loading