diff --git a/.cypress/integration/datasources_test/datasources.spec.js b/.cypress/integration/datasources_test/datasources.spec.js deleted file mode 100644 index ea73ae91b8..0000000000 --- a/.cypress/integration/datasources_test/datasources.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import {FONTEND_BASE_PATH, DATASOURCES_API_PREFIX} from '../../utils/constants' - -const visitDatasourcesHomePage = () => { - cy.visit(FONTEND_BASE_PATH + DATASOURCES_API_PREFIX); -} - -describe('Integration tests for datasources plugin', () => { - - - it('Navigates to datasources plugin and expects the correct header', () => { - visitDatasourcesHomePage(); - cy.get('[data-test-subj="dataconnections-header"]').should('exist'); - }); - - it('Tests navigation between tabs and goes to Prometheus creation flow', () => { - visitDatasourcesHomePage(); - cy.get('[data-test-subj="new"]').click(); - cy.url().should('include', '/new'); - cy.get('[data-test-subj="datasource_card_prometheus"]').click(); - cy.url().should('include', '/configure/Prometheus'); - }); -}); diff --git a/.cypress/integration/datasources_test/datasources_basic_ui.spec.js b/.cypress/integration/datasources_test/datasources_basic_ui.spec.js new file mode 100644 index 0000000000..871b7025ac --- /dev/null +++ b/.cypress/integration/datasources_test/datasources_basic_ui.spec.js @@ -0,0 +1,71 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { + FONTEND_BASE_PATH, + DATASOURCES_API_PREFIX, + DATASOURCES_PATH, +} from '../../utils/constants' + +const manageDataSourcesTag = 'button[data-test-subj="manage"]'; +const newDataSourcesTag = 'button[data-test-subj="new"]'; +const createS3Button = '[data-test-subj="datasource_card_s3glue"]' +const createPrometheusButton = '[data-test-subj="datasource_card_prometheus"]'; + +const visitDatasourcesHomePage = () => { + cy.visit(FONTEND_BASE_PATH + DATASOURCES_API_PREFIX); +} + +const visitDatasourcesCreationPage = () => { + cy.visit(FONTEND_BASE_PATH + DATASOURCES_PATH.DATASOURCES_CREATION_BASE); +} + +describe('Integration tests for datasources plugin', () => { + it('Navigates to datasources plugin and expects the correct header', () => { + visitDatasourcesHomePage(); + cy.get('[data-test-subj="dataconnections-header"]').should('exist'); + }); + + it('Tests navigation between tabs', () => { + visitDatasourcesHomePage(); + + cy.get(manageDataSourcesTag) + .should('have.class', 'euiTab-isSelected') + .and('have.attr', 'aria-selected', 'true'); + cy.get(manageDataSourcesTag).click(); + cy.url().should('include', '/manage'); + + cy.get(newDataSourcesTag).click(); + cy.get(newDataSourcesTag) + .should('have.class', 'euiTab-isSelected') + .and('have.attr', 'aria-selected', 'true'); + cy.url().should('include', '/new'); + + cy.get(createS3Button).should('be.visible'); + cy.get(createPrometheusButton).should('be.visible'); + }); + + it('Tests navigation of S3 datasources creation page with hash', () => { + visitDatasourcesCreationPage(); + + cy.get(createS3Button).should('be.visible').click(); + cy.url().should('include', DATASOURCES_PATH.DATASOURCES_CONFIG_BASE + '/AmazonS3AWSGlue') + + cy.get('h1.euiTitle.euiTitle--medium') + .should('be.visible') + .and('contain', 'Configure Amazon S3 data source'); + }); + + it('Tests navigation of Prometheus datasources creation page with hash', () => { + visitDatasourcesCreationPage(); + + cy.get(createPrometheusButton).should('be.visible').click(); + cy.url().should('include', DATASOURCES_PATH.DATASOURCES_CONFIG_BASE + '/Prometheus') + + cy.get('h4.euiTitle.euiTitle--medium') + .should('be.visible') + .and('contain', 'Configure Prometheus data source'); + }); +}); diff --git a/.cypress/utils/constants.js b/.cypress/utils/constants.js index 718530acfc..00455bf966 100644 --- a/.cypress/utils/constants.js +++ b/.cypress/utils/constants.js @@ -12,7 +12,7 @@ export const FONTEND_BASE_PATH = Cypress.env('opensearchDashboards'); //Datasources API Constants export const DATASOURCES_API_PREFIX = '/app/datasources'; -export const DATASOURCES_API = { +export const DATASOURCES_PATH = { DATASOURCES_CREATION_BASE: `${DATASOURCES_API_PREFIX}#/new`, DATASOURCES_CONFIG_BASE: `${DATASOURCES_API_PREFIX}#/configure` } diff --git a/cypress.config.js b/cypress.config.js index 23dcb04513..84ad089460 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -18,7 +18,7 @@ module.exports = defineConfig({ env: { opensearch: 'localhost:9200', opensearchDashboards: 'localhost:5601', - security_enabled: true, + security_enabled: false, }, 'cypress-watch-and-reload': { watch: ['common/**', 'public/**', 'server/**'],