diff --git a/.cypress/integration/datasources_test/datasources.spec.js b/.cypress/integration/datasources_test/datasources.spec.js index 3c9ff64d6b..ea73ae91b8 100644 --- a/.cypress/integration/datasources_test/datasources.spec.js +++ b/.cypress/integration/datasources_test/datasources.spec.js @@ -3,33 +3,22 @@ * SPDX-License-Identifier: Apache-2.0 */ -/// +import {FONTEND_BASE_PATH, DATASOURCES_API_PREFIX} from '../../utils/constants' -const moveToDatasourcesHome = () => { - cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources`); -}; - -// const moveToNewDatasourcesPage = () => { -// cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/new`); -// }; - -// const moveToCreatePrometheusDatasourcePage = () => { -// cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/configure/PROMETHEUS`); -// }; +const visitDatasourcesHomePage = () => { + cy.visit(FONTEND_BASE_PATH + DATASOURCES_API_PREFIX); +} describe('Integration tests for datasources plugin', () => { - // const testPrometheusSuffix = (Math.random() + 1).toString(36).substring(7); - // const testPrometheusInstance = `Prometheus_${testPrometheusSuffix}`; - // const testS3Suffix = (Math.random() + 1).toString(36).substring(7); - // const testS3Instance = `S3_${testS3Suffix}`; + it('Navigates to datasources plugin and expects the correct header', () => { - moveToDatasourcesHome(); + visitDatasourcesHomePage(); cy.get('[data-test-subj="dataconnections-header"]').should('exist'); }); it('Tests navigation between tabs and goes to Prometheus creation flow', () => { - moveToDatasourcesHome(); + visitDatasourcesHomePage(); cy.get('[data-test-subj="new"]').click(); cy.url().should('include', '/new'); cy.get('[data-test-subj="datasource_card_prometheus"]').click(); diff --git a/.cypress/utils/constants.js b/.cypress/utils/constants.js index af655fbe3e..718530acfc 100644 --- a/.cypress/utils/constants.js +++ b/.cypress/utils/constants.js @@ -6,6 +6,17 @@ export const delay = 1500; export const COMMAND_TIMEOUT_LONG = 10000; +//BASE Constants +export const BACKEND_BASE_PATH = Cypress.env('opensearch'); +export const FONTEND_BASE_PATH = Cypress.env('opensearchDashboards'); + +//Datasources API Constants +export const DATASOURCES_API_PREFIX = '/app/datasources'; +export const DATASOURCES_API = { + DATASOURCES_CREATION_BASE: `${DATASOURCES_API_PREFIX}#/new`, + DATASOURCES_CONFIG_BASE: `${DATASOURCES_API_PREFIX}#/configure` +} + // trace analytics export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d'; export const SPAN_ID = 'a673bc074b438374'; diff --git a/.github/workflows/integration-tests-workflow.yml b/.github/workflows/integration-tests-workflow.yml index 2ee8a85ecb..d1179a6e2d 100644 --- a/.github/workflows/integration-tests-workflow.yml +++ b/.github/workflows/integration-tests-workflow.yml @@ -109,6 +109,15 @@ jobs: node-version: ${{ steps.versions_step.outputs.node_version }} registry-url: 'https://registry.npmjs.org' + - name: Configure OpenSearch Dashboards + run: | + rm -rf ./config/opensearch_dashboards.yml + cat << 'EOT' > ./config/opensearch_dashboards.yml + server.host: "0.0.0.0" + home.disableWelcomeScreen: true + EOT + working-directory: OpenSearch-Dashboards + - name: Install correct yarn version for OpenSearch Dashboards run: | npm uninstall -g yarn diff --git a/cypress.config.js b/cypress.config.js index dff98e5eb8..23dcb04513 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -24,8 +24,6 @@ module.exports = defineConfig({ watch: ['common/**', 'public/**', 'server/**'], }, e2e: { - // We've imported your old cypress plugins here. - // You may want to clean this up later by importing these. setupNodeEvents(on, config) { return require('./.cypress/plugins/index.js')(on, config); },