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

[Cypress Updates] Metrics updates #2269

Merged
merged 2 commits into from
Dec 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
moveToEventsHome();
cy.get('[data-test-subj="eventHome__savedQueryTableName"]')
.first()
.contains(PPL_METRICS_NAMES[metricIndex]);
.contains(PPL_METRICS_NAMES[0]);
});
});

Expand All @@ -41,6 +41,8 @@
createSavedObjectMetric({ testMetricIndex: 1 });

moveToMetricsHome();
cy.get('[data-test-subj="comboBoxToggleListButton"]').click();
cy.get('[data-test-subj="prometheusOption"]').click();
cy.get('[data-test-subj="metricsListItems_availableMetrics"]')
.contains(PPL_METRICS_NAMES[1])
.should('exist');
Expand All @@ -57,11 +59,11 @@

describe('Check data source picker', () => {
it('Index picker should be only available under Otel metric datasource', () => {
cy.get('[data-test-subj="metricsDataSourcePicker"]').click();
cy.get('[data-test-subj="comboBoxToggleListButton"]').click();
cy.get('[data-test-subj="prometheusOption"]').click();
cy.get('[data-test-subj="metricsIndexPicker"]').should('not.exist');

cy.get('[data-test-subj="metricsDataSourcePicker"]').click();
cy.get('[data-test-subj="comboBoxToggleListButton"]').click();
cy.get('[data-test-subj="openTelemetryOption"]').click();
cy.get('[data-test-subj="metricsIndexPicker"]').should('exist');
});
Expand Down Expand Up @@ -137,25 +139,22 @@
.click();
});

it('Drag and drop a Metric visualization in edit mode', () => {
it('Drag and drop a Metric visualization', () => {
cy.get('[data-test-subj="metricsListItems_availableMetrics"]')
.contains(PPL_METRICS_NAMES[1])
.trigger('mouseover')
.click();
cy.get('h5')
.contains(PPL_METRICS_NAMES[0])
.trigger('mousedown', { which: 1, force: true })
.trigger('mousemove', { clientX: 415, clientY: 500 })
.trigger('mouseup', { force: true });
cy.wait(delay * 3);
cy.get('div.react-grid-layout>div')
.eq(1)
.invoke('attr', 'style')
.should('match', new RegExp('(.*)transform: translate((.*)10px)(.*)'));
cy.get('h5').eq(2).contains(PPL_METRICS_NAMES[1]).should('exist');;
cy.get('[data-test-subj="draggable"]').eq(0)
.focus()
.type(' ')
.type('{downarrow}')
.type(' ');
cy.get('h5').eq(2).contains(PPL_METRICS_NAMES[0]).should('exist');
});

it('Change date filter of the Metrics home page', () => {
cy.get('.euiButtonEmpty[data-test-subj="superDatePickerToggleQuickMenuButton"]').click({

Check warning on line 157 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
force: true,
});
cy.get('.euiLink').contains('This year').trigger('mouseover').click();
Expand All @@ -175,10 +174,10 @@
cy.wait(delay * 3);
moveToMetricsHome();
cy.get('[data-test-subj="metrics__saveManagementPopover"]').trigger('mouseover').click();
cy.get('[data-test-subj="comboBoxSearchInput"]')
cy.get('[data-test-subj="comboBoxSearchInput"]').eq(1)

Check warning on line 177 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.focus()
.type(TESTING_PANEL, { force: true });
cy.get('[data-test-subj="metrics__SaveConfirm"]').click({ force: true });

Check warning on line 180 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiToastHeader__title').contains('successfully').should('exist');
});
});
Expand Down Expand Up @@ -211,20 +210,20 @@
};

const createCustomMetric = ({ testMetricIndex }) => {
cy.get('[id^=autocomplete-textarea]').focus().type(PPL_METRICS[metricIndex], {
cy.get('[id^=autocomplete-textarea]').focus().type(PPL_METRICS[testMetricIndex], {
delay: 50,
});
cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').trigger('mouseover').click();
suppressResizeObserverIssue();
cy.get('button[id="main-content-vis"]').contains('Visualizations').trigger('mouseover').click();
cy.wait(delay * 2);
cy.get('[data-test-subj="comboBoxToggleListButton"]').click();
cy.get('[data-test-subj="comboBoxSearchInput"]').focus().type(VIS_TYPE_LINE, { force: true });
cy.get('[data-test-subj="comboBoxToggleListButton"]').eq(1).click();
cy.get('[data-test-subj="comboBoxSearchInput"]').eq(1).focus().type(VIS_TYPE_LINE, { force: true });

Check warning on line 221 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click({ force: true });

Check warning on line 222 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('[data-test-subj="eventExplorer__querySaveName"]')

Check warning on line 223 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.focus()
.type(PPL_METRICS_NAMES[metricIndex], { force: true });
.type(PPL_METRICS_NAMES[testMetricIndex], { force: true });
cy.get('[data-test-subj="eventExplorer__metricSaveName"]').click({ force: true });

Check warning on line 226 in .cypress/integration/metrics_analytics_test/metrics_analytics.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.wait(delay * 10);
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]', {
timeout: COMMAND_TIMEOUT_LONG,
Expand Down
6 changes: 2 additions & 4 deletions .cypress/utils/event_analytics/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { COMMAND_TIMEOUT_LONG, suppressResizeObserverIssue, delay } from '../constants';
import { COMMAND_TIMEOUT_LONG, suppressResizeObserverIssue } from '../constants';

export const clearQuerySearchBoxText = (testSubjectName) => {
cy.get(`[data-test-subj="${testSubjectName}"]`, {
Expand All @@ -19,7 +19,7 @@
suppressResizeObserverIssue();
cy.get('[data-test-subj="superDatePickerToggleQuickMenuButton"]').click();
cy.get(rangeSelected).click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').contains('Refresh').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
};

export const landOnEventHome = () => {
Expand All @@ -44,21 +44,19 @@
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/`
);
cy.wait(delay);
};

const vis_name_sub_string = Math.floor(Math.random() * 100);
export const saveVisualizationAndVerify = () => {
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
cy.get('[data-test-subj="eventExplorer__querySaveComboBox"]').click();
cy.get('.euiPopover__panel .euiFormControlLayoutIcons [data-test-subj="comboBoxToggleListButton"]')

Check warning on line 53 in .cypress/utils/event_analytics/helpers.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.eq(0)
.click({ force: true });
cy.get('.euiPopover__panel input')

Check warning on line 56 in .cypress/utils/event_analytics/helpers.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.eq(1)
.type(`Test visualization` + vis_name_sub_string, { force: true });
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click({ force: true });

Check warning on line 59 in .cypress/utils/event_analytics/helpers.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.wait(delay);
cy.get('.euiHeaderBreadcrumbs a').eq(1).click({ force: true });
cy.get('.euiFlexGroup .euiFormControlLayout__childrenWrapper input')
.eq(0)
Expand Down
Loading