Geomap: Map control options e2e (#54809)

This commit is contained in:
Adela Almasan 2022-09-09 14:56:35 -05:00 committed by GitHub
parent b6237a43e6
commit b08f839c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 3 deletions

View File

@ -70,11 +70,11 @@
"options": {
"controls": {
"mouseWheelZoom": true,
"showAttribution": true,
"showAttribution": false,
"showDebug": false,
"showMeasure": false,
"showScale": false,
"showZoom": true
"showZoom": false
},
"tooltip": {
"mode": "details"

View File

@ -0,0 +1,35 @@
import { e2e } from '@grafana/e2e';
const DASHBOARD_ID = 'P2jR04WVk';
e2e.scenario({
describeName: 'Geomap map controls options',
itName: 'Tests map controls options',
addScenarioDataSource: false,
addScenarioDashBoard: false,
skipScenario: false,
scenario: () => {
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { editPanel: 1 } });
// Show zoom
e2e.components.OptionsGroup.group('Map controls').scrollIntoView().should('exist');
cy.get('input[id="controls.showZoom"]').check({ force: true });
cy.contains('+');
cy.get('.ol-zoom').should('exist');
// Show attribution
cy.get('input[id="controls.showAttribution"]').check({ force: true });
cy.get('.ol-attribution').should('exist');
// Show scale
cy.get('input[id="controls.showScale"]').check({ force: true });
cy.get('.ol-scale-line').should('exist');
// Show measure tool
cy.get('input[id="controls.showMeasure"]').check({ force: true });
e2e.components.PanelEditor.measureButton().should('exist');
// Show debug
cy.get('input[id="controls.showDebug"]').check({ force: true });
e2e.components.DebugOverlay.wrapper().should('exist');
},
});

View File

@ -127,6 +127,9 @@ export const Components = {
toggleVizPicker: 'toggle-viz-picker',
toggleVizOptions: 'toggle-viz-options',
toggleTableView: 'toggle-table-view',
// [Geomap] Map controls
measureButton: 'show measure tools',
},
PanelInspector: {
Data: {
@ -368,4 +371,7 @@ export const Components = {
inputField: 'data-testid-file-upload-input-field',
fileNameSpan: 'data-testid-file-upload-file-name',
},
DebugOverlay: {
wrapper: 'debug-overlay',
},
};

View File

@ -6,6 +6,7 @@ import React, { PureComponent } from 'react';
import tinycolor from 'tinycolor2';
import { GrafanaTheme } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors/src';
import { stylesFactory } from '@grafana/ui';
import { config } from 'app/core/config';
@ -43,7 +44,7 @@ export class DebugOverlay extends PureComponent<Props, State> {
const { zoom, center } = this.state;
return (
<div className={this.style.infoWrap}>
<div className={this.style.infoWrap} aria-label={selectors.components.DebugOverlay.wrapper}>
<table>
<tbody>
<tr>