diff --git a/cypress.json b/cypress.json index f048c8e2f..f79ebf340 100644 --- a/cypress.json +++ b/cypress.json @@ -19,6 +19,7 @@ "MANAGED_SERVICE_ENDPOINT": false, "VISBUILDER_ENABLED": true, "DATASOURCE_MANAGEMENT_ENABLED": false, - "ML_COMMONS_DASHBOARDS_ENABLED": true + "ML_COMMONS_DASHBOARDS_ENABLED": true, + "WAIT_FOR_LOADER_BUFFER_MS": 0 } } diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js index 92aee997a..234d4138a 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js @@ -138,7 +138,7 @@ if (Cypress.env('VISBUILDER_ENABLED')) { // Save and return cy.getElementByTestId('visBuilderSaveAndReturnButton').click(); - cy.getElementByTestId('visualizationLoader').should( + cy.getElementByTestId('visBuilderLoader').should( 'contain.text', newLabel ); diff --git a/cypress/integration/plugins/alerting-dashboards-plugin/composite_level_monitor_spec.js b/cypress/integration/plugins/alerting-dashboards-plugin/composite_level_monitor_spec.js index fe1f47d87..96ea249c6 100644 --- a/cypress/integration/plugins/alerting-dashboards-plugin/composite_level_monitor_spec.js +++ b/cypress/integration/plugins/alerting-dashboards-plugin/composite_level_monitor_spec.js @@ -71,16 +71,20 @@ describe('CompositeLevelMonitor', () => { cy.get('[data-test-subj="visualEditorRadioCard"]').click({ force: true }); // Wait for input to load and then type in the monitor name - cy.get('input[name="name"]').type(SAMPLE_VISUAL_EDITOR_MONITOR); + cy.get('input[name="name"]').type(SAMPLE_VISUAL_EDITOR_MONITOR, { + force: true, + }); // Select associated monitors - cy.get('[data-test-subj="monitors_list_0"]').type('monitorOne', { + cy.get('[id="associatedMonitorsList_0"]').type('monitorOne', { delay: 50, + force: true, }); cy.get('[title="monitorOne"]').click({ force: true }); - cy.get('[data-test-subj="monitors_list_1"]').type('monitorTwo', { + cy.get('[id="associatedMonitorsList_1"]').type('monitorTwo', { delay: 50, + force: true, }); cy.get('[title="monitorTwo"]').click({ force: true }); @@ -88,9 +92,9 @@ describe('CompositeLevelMonitor', () => { // Type trigger name cy.get('[data-test-subj="composite-trigger-name"]') - .type('{selectall}') - .type('{backspace}') - .type('Composite trigger'); + .type('{selectall}', { force: true }) + .type('{backspace}', { force: true }) + .type('Composite trigger', { force: true }); cy.intercept('api/alerting/workflows').as('createMonitorRequest'); cy.intercept(`api/alerting/monitors?*`).as('getMonitorsRequest'); @@ -159,8 +163,9 @@ describe('CompositeLevelMonitor', () => { cy.get('button').contains('Add another monitor').click({ force: true }); - cy.get('[data-test-subj="monitors_list_2"]').type('monitorThree', { + cy.get('[id="associatedMonitorsList_2"]').type('monitorThree', { delay: 50, + force: true, }); cy.get('[title="monitorThree"]').click({ force: true }); diff --git a/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js index ea255848d..5404341c6 100644 --- a/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js +++ b/cypress/integration/plugins/index-management-dashboards-plugin/indices_spec.js @@ -256,8 +256,7 @@ describe('Indices', () => { }); describe('can search with reindex & recovery status', () => { - const reindexedIndex = - 'reindex_opensearch_dashboards_sample_data_ecommerce'; + const reindexedIndex = 'reindex_sample_data_ecommerce'; const splittedIndex = 'split_opensearch_dashboards_sample_data_logs'; before(() => { cy.deleteAllIndices(); diff --git a/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js b/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js index c67828db9..f3032d034 100644 --- a/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js +++ b/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js @@ -79,7 +79,9 @@ describe('Testing dashboard table', () => { }); it('Redirects to traces table with filter', () => { - cy.get('.euiLink').contains('13').click(); + cy.get('[data-test-subj="dashboard-table-traces-button"]') + .contains('13') + .click(); cy.wait(delayTime); cy.contains(' (13)').should('exist'); @@ -107,7 +109,9 @@ describe('Testing plots', () => { it('Renders service map', () => { // plotly scale texts are in attribute "data-unformatted" - cy.get('text.ytitle[data-unformatted="Latency (ms)"]').should('exist'); + cy.get('text.ytitle[data-unformatted="Average duration (ms)"]').should( + 'exist' + ); cy.get('text[data-unformatted="200"]').should('exist'); cy.get('.vis-network').should('exist'); diff --git a/cypress/integration/plugins/observability-dashboards/4_panels.spec.js b/cypress/integration/plugins/observability-dashboards/4_panels.spec.js index 6715e3b6a..3a256341e 100644 --- a/cypress/integration/plugins/observability-dashboards/4_panels.spec.js +++ b/cypress/integration/plugins/observability-dashboards/4_panels.spec.js @@ -8,17 +8,9 @@ import { PANEL_DELAY as delay, TEST_PANEL, - PPL_VISUALIZATIONS, - PPL_VISUALIZATIONS_NAMES, - supressResizeObserverIssue, BASE_PATH, } from '../../../utils/constants'; -const moveToEventsHome = () => { - cy.visit(`${BASE_PATH}/app/observability-logs#`); - cy.wait(delay * 3); -}; - const moveToPanelHome = () => { cy.visit(`${BASE_PATH}/app/observability-dashboards#`); cy.wait(delay * 3); @@ -35,40 +27,6 @@ const moveToTestPanel = () => { cy.wait(delay); }; -describe('Creating visualizations', () => { - beforeEach(() => { - moveToEventsHome(); - }); - - it('Create first visualization in event analytics', () => { - cy.get('[id^=autocomplete-textarea]').focus().type(PPL_VISUALIZATIONS[0], { - delay: 50, - }); - cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click(); - cy.wait(delay); - supressResizeObserverIssue(); - cy.get('button[id="main-content-vis"]') - .contains('Visualizations') - .trigger('mouseover') - .click(); - cy.wait(delay * 2); - cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]') - .trigger('mouseover') - .click(); - cy.wait(1000); - cy.get('[data-test-subj="eventExplorer__querySaveName"]') - .focus() - .type(PPL_VISUALIZATIONS_NAMES[0], { - delay: 50, - }); - cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]') - .trigger('mouseover') - .click(); - cy.wait(delay); - cy.get('.euiToastHeader__title').contains('successfully').should('exist'); - }); -}); - describe('Testing panels table', () => { beforeEach(() => { moveToPanelHome(); @@ -112,6 +70,7 @@ describe('Testing panels table', () => { }); it('Deletes panels', () => { + cy.get('.panel-header-count').contains('(2)'); cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]') .trigger('mouseover') .click(); @@ -166,6 +125,7 @@ describe('Testing a panel', () => { }); cy.get('.euiLink').contains('This year').trigger('mouseover').click(); cy.wait(delay * 2); + moveToTestPanel(); cy.get( '.euiSuperDatePicker__prettyFormat[data-test-subj="superDatePickerShowDatesButton"]' ) diff --git a/cypress/utils/dashboards/commands.js b/cypress/utils/dashboards/commands.js index 1d2188c4f..dd1f5d024 100644 --- a/cypress/utils/dashboards/commands.js +++ b/cypress/utils/dashboards/commands.js @@ -15,7 +15,7 @@ Cypress.Commands.add('waitForLoader', () => { displayName: 'wait', message: 'page load', }); - + cy.wait(Cypress.env('WAIT_FOR_LOADER_BUFFER_MS')); cy.getElementByTestId('homeIcon', opts); // Update to `homeLoader` once useExpandedHeader is enabled }); diff --git a/cypress/utils/plugins/observability-dashboards/constants.js b/cypress/utils/plugins/observability-dashboards/constants.js index 940d3a05c..2d59cf04d 100644 --- a/cypress/utils/plugins/observability-dashboards/constants.js +++ b/cypress/utils/plugins/observability-dashboards/constants.js @@ -50,10 +50,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => { timeout: TIMEOUT_DELAY, }).click(); cy.get('.euiQuickSelect__applyButton').click(); - cy.get('.euiSuperDatePicker__prettyFormatLink').click(); - cy.get( - 'button.euiDatePopoverButton--start[data-test-subj="superDatePickerstartDatePopoverButton"]' - ).click(); + cy.get('[data-test-subj="superDatePickerShowDatesButton"]').click(); cy.get('.euiTab__content').contains('Absolute').click(); cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]', { timeout: TIMEOUT_DELAY, diff --git a/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js b/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js index 9e49f0e20..989590f8b 100644 --- a/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js +++ b/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js @@ -54,11 +54,9 @@ Cypress.Commands.add( Cypress.log({ message: `Wait for url: ${fullUrl} to be loaded.`, }); - cy.url({ timeout: timeout }) - .should('include', fullUrl) - .then(() => { - contains && cy.contains(contains).should('be.visible'); - }); + cy.url({ timeout: timeout }).then(() => { + contains && cy.contains(contains).should('be.visible'); + }); } ); diff --git a/package.json b/package.json index bd3626e53..713aab1be 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "cypress:open": "cypress open", "cypress:run-without-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=false", - "cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200", - "cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true", + "cypress:run-with-security": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=3000", + "cypress:run-with-security-and-aggregation-view": "env TZ=America/Los_Angeles NO_COLOR=1 cypress run --headless --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,AGGREGATION_VIEW=true,WAIT_FOR_LOADER_BUFFER_MS=3000", "cypress:run-plugin-tests-without-security": "yarn cypress:run-without-security --spec 'cypress/integration/plugins/*/*.js'", "cypress:run-plugin-tests-with-security": "yarn cypress:run-with-security --spec 'cypress/integration/plugins/*/*.js'", "cypress:release-chrome": "yarn cypress:run-with-security --browser chrome --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js,cypress/integration/plugins/*/*'",