Dashboard panel a11y tests refactoring and addition of missing tests (#139597) (#139759)

(cherry picked from commit 275e319406)

Co-authored-by: Bhavya RM <bhavya@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-30 15:53:00 -04:00 committed by GitHub
parent f9c7246560
commit e23dcd5b91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 166 additions and 174 deletions

View file

@ -118,7 +118,7 @@ export const ActionFactory: React.FC<ActionFactoryProps> = ({
</EuiFlexItem>
{!!onChange && (
<EuiFlexItem grow={false}>
<EuiButtonEmpty size="xs" onClick={onChange}>
<EuiButtonEmpty size="xs" data-test-subj="changeDrilldownType" onClick={onChange}>
{txtChangeButton}
</EuiButtonEmpty>
</EuiFlexItem>

View file

@ -1,66 +0,0 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home', 'settings']);
const a11y = getService('a11y');
const dashboardPanelActions = getService('dashboardPanelActions');
const testSubjects = getService('testSubjects');
const inspector = getService('inspector');
describe('Dashboard Panel', () => {
before(async () => {
await PageObjects.common.navigateToApp('dashboard');
await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard');
});
it('dashboard panel open ', async () => {
const header = await dashboardPanelActions.getPanelHeading('[Flights] Flight count');
await dashboardPanelActions.toggleContextMenu(header);
await a11y.testAppSnapshot();
// doing this again will close the Context Menu, so that next snapshot can start clean.
await dashboardPanelActions.toggleContextMenu(header);
});
it('dashboard panel inspect', async () => {
await dashboardPanelActions.openInspectorByTitle('[Flights] Flight count');
await a11y.testAppSnapshot();
});
it('dashboard panel inspector view chooser ', async () => {
await testSubjects.click('inspectorViewChooser');
await a11y.testAppSnapshot();
await testSubjects.click('inspectorViewChooser');
});
it('dashboard panel inspector request statistics ', async () => {
await inspector.openInspectorRequestsView();
await a11y.testAppSnapshot();
});
it('dashboard panel inspector request', async () => {
await testSubjects.click('inspectorRequestDetailRequest');
await a11y.testAppSnapshot();
});
it('dashboard panel inspector response', async () => {
await testSubjects.click('inspectorRequestDetailResponse');
await a11y.testAppSnapshot();
await inspector.close();
});
it('dashboard panel full screen', async () => {
const header = await dashboardPanelActions.getPanelHeading('[Flights] Flight count');
await dashboardPanelActions.openContextMenuMorePanel(header);
await testSubjects.click('embeddablePanelAction-togglePanel');
await a11y.testAppSnapshot();
});
});
}

View file

@ -32,7 +32,6 @@ export default function ({ getService, loadTestFile, getPageObjects }: FtrProvid
});
loadTestFile(require.resolve('./dashboard'));
loadTestFile(require.resolve('./dashboard_panel'));
loadTestFile(require.resolve('./filter_panel'));
loadTestFile(require.resolve('./home'));
loadTestFile(require.resolve('./discover'));

View file

@ -1,105 +0,0 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const { dashboard } = getPageObjects(['dashboard']);
const a11y = getService('a11y');
const dashboardPanelActions = getService('dashboardPanelActions');
const testSubjects = getService('testSubjects');
const esArchiver = getService('esArchiver');
const drilldowns = getService('dashboardDrilldownsManage');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects(['security', 'common']);
const toasts = getService('toasts');
const PANEL_TITLE = 'Visualization PieChart';
describe('Dashboard Edit Panel Accessibility', () => {
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/dashboard_drilldowns/drilldowns'
);
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
await kibanaServer.uiSettings.replace({ defaultIndex: 'logstash-*' });
await PageObjects.common.navigateToApp('dashboard');
await dashboard.loadSavedDashboard(drilldowns.DASHBOARD_WITH_PIE_CHART_NAME);
await testSubjects.click('dashboardEditMode');
});
after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});
it('can open menu', async () => {
await dashboardPanelActions.openContextMenu();
await a11y.testAppSnapshot();
});
it('can clone panel', async () => {
await dashboardPanelActions.clonePanelByTitle(PANEL_TITLE);
await a11y.testAppSnapshot();
await toasts.dismissAllToasts();
await dashboardPanelActions.removePanelByTitle(`${PANEL_TITLE} (copy)`);
});
it('can customize panel', async () => {
await dashboardPanelActions.customizePanel();
await a11y.testAppSnapshot();
});
it('can hide panel title', async () => {
await dashboardPanelActions.clickHidePanelTitleToggle();
await a11y.testAppSnapshot();
await testSubjects.click('saveNewTitleButton');
});
it('can drilldown', async () => {
await testSubjects.click('embeddablePanelToggleMenuIcon');
await testSubjects.click('embeddablePanelAction-OPEN_FLYOUT_ADD_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('flyoutCloseButton');
});
it('can view more actions', async () => {
await dashboardPanelActions.openContextMenuMorePanel();
await a11y.testAppSnapshot();
});
it('can create a custom time range', async () => {
await dashboardPanelActions.openContextMenuMorePanel();
await testSubjects.click('embeddablePanelAction-CUSTOM_TIME_RANGE');
await a11y.testAppSnapshot();
await testSubjects.click('addPerPanelTimeRangeButton');
});
it('can open inspector', async () => {
await dashboardPanelActions.openInspector();
await a11y.testAppSnapshot();
await testSubjects.click('euiFlyoutCloseButton');
});
it('can go fullscreen', async () => {
await dashboardPanelActions.clickExpandPanelToggle();
await a11y.testAppSnapshot();
await dashboardPanelActions.clickExpandPanelToggle();
});
it('can replace panel', async () => {
await dashboardPanelActions.replacePanelByTitle();
await a11y.testAppSnapshot();
await testSubjects.click('euiFlyoutCloseButton');
});
it('can delete panel', async () => {
await dashboardPanelActions.removePanel();
await a11y.testAppSnapshot();
});
});
}

View file

@ -0,0 +1,164 @@
/*
* 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 { FtrProviderContext } from '../ftr_provider_context';
import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const a11y = getService('a11y');
const dashboardPanelActions = getService('dashboardPanelActions');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'header', 'home']);
const toasts = getService('toasts');
const inspector = getService('inspector');
describe('Dashboard panel options a11y tests', () => {
let header: WebElementWrapper;
before(async () => {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('dashboard');
await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard');
header = await dashboardPanelActions.getPanelHeading('[Flights] Flight count');
});
after(async () => {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
await PageObjects.home.removeSampleDataSet('flights');
});
// dashboard panel options in view mode
it('dashboard panel - open menu', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await a11y.testAppSnapshot();
await dashboardPanelActions.toggleContextMenu(header);
});
it('dashboard panel - customize time range', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await testSubjects.click('embeddablePanelAction-CUSTOM_TIME_RANGE');
await a11y.testAppSnapshot();
await testSubjects.click('cancelPerPanelTimeRangeButton');
});
it('dashboard panel- inspect', async () => {
await dashboardPanelActions.openInspectorByTitle('[Flights] Flight count');
await a11y.testAppSnapshot();
});
it('dashboard panel - inspector view chooser ', async () => {
await testSubjects.click('inspectorViewChooser');
await a11y.testAppSnapshot();
await testSubjects.click('inspectorViewChooser');
});
it('dashboard panel - inspector request statistics ', async () => {
await inspector.openInspectorRequestsView();
await a11y.testAppSnapshot();
});
it('dashboard panel - inspector request', async () => {
await testSubjects.click('inspectorRequestDetailRequest');
await a11y.testAppSnapshot();
});
it('dashboard panel - inspector response', async () => {
await testSubjects.click('inspectorRequestDetailResponse');
await a11y.testAppSnapshot();
await inspector.close();
});
it('dashboard panel- more options in view mode', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await dashboardPanelActions.openContextMenuMorePanel(header);
await a11y.testAppSnapshot();
});
it('dashboard panel - maximize', async () => {
await dashboardPanelActions.openContextMenuMorePanel(header);
await dashboardPanelActions.clickExpandPanelToggle();
await a11y.testAppSnapshot();
await dashboardPanelActions.toggleContextMenu(header);
await dashboardPanelActions.openContextMenuMorePanel(header);
await dashboardPanelActions.clickExpandPanelToggle();
});
it('dashboard panel - copy to dashboard', async () => {
await dashboardPanelActions.openContextMenuMorePanel(header);
await testSubjects.click('embeddablePanelAction-copyToDashboard');
await a11y.testAppSnapshot();
await testSubjects.click('cancelCopyToButton');
});
// dashboard panel options in edit mode
it('dashboard panel - clone panel', async () => {
await testSubjects.click('dashboardEditMode');
await dashboardPanelActions.toggleContextMenu(header);
await testSubjects.click('embeddablePanelAction-clonePanel');
await toasts.dismissAllToasts();
await a11y.testAppSnapshot();
});
it('dashboard panel - edit panel title', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await testSubjects.click('embeddablePanelAction-ACTION_CUSTOMIZE_PANEL');
await a11y.testAppSnapshot();
await testSubjects.click('customizePanelHideTitle');
await a11y.testAppSnapshot();
await testSubjects.click('customizePanelHideTitle');
await testSubjects.click('saveNewTitleButton');
});
it('dashboard panel - Create drilldown panel', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await testSubjects.click('embeddablePanelAction-OPEN_FLYOUT_ADD_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('actionFactoryItem-DASHBOARD_TO_DASHBOARD_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('changeDrilldownType');
await testSubjects.click('actionFactoryItem-URL_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('changeDrilldownType');
await testSubjects.click('actionFactoryItem-OPEN_IN_DISCOVER_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('drilldownWizardSubmit');
});
it('dashboard panel - manage drilldown', async () => {
await dashboardPanelActions.toggleContextMenu(header);
await testSubjects.click('embeddablePanelAction-OPEN_FLYOUT_EDIT_DRILLDOWN');
await a11y.testAppSnapshot();
await testSubjects.click('euiFlyoutCloseButton');
});
it('dashboard panel - more options in edit view', async () => {
await dashboardPanelActions.openContextMenuMorePanel(header);
await a11y.testAppSnapshot();
});
it('dashboard panel - save to library', async () => {
await dashboardPanelActions.openContextMenuMorePanel(header);
await testSubjects.click('embeddablePanelAction-saveToLibrary');
await a11y.testAppSnapshot();
await testSubjects.click('saveCancelButton');
});
it('dashboard panel - replace panel', async () => {
await dashboardPanelActions.openContextMenuMorePanel(header);
await testSubjects.click('embeddablePanelAction-replacePanel');
await a11y.testAppSnapshot();
await testSubjects.click('euiFlyoutCloseButton');
});
});
}

View file

@ -26,7 +26,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('./apps/uptime'),
require.resolve('./apps/spaces'),
require.resolve('./apps/advanced_settings'),
require.resolve('./apps/dashboard_edit_panel'),
require.resolve('./apps/dashboard_panel_options'),
require.resolve('./apps/dashboard_controls'),
require.resolve('./apps/users'),
require.resolve('./apps/roles'),