Skip to content

Commit

Permalink
Refactor datasources test and disable security config
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Dec 22, 2023
1 parent cd6ae96 commit 0965f59
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 29 deletions.
27 changes: 0 additions & 27 deletions .cypress/integration/datasources_test/datasources.spec.js

This file was deleted.

71 changes: 71 additions & 0 deletions .cypress/integration/datasources_test/datasources_basic_ui.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {

Check failure on line 6 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `⏎··FONTEND_BASE_PATH,⏎··DATASOURCES_API_PREFIX,⏎··DATASOURCES_PATH,⏎}·from·'../../utils/constants'` with `·FONTEND_BASE_PATH,·DATASOURCES_API_PREFIX,·DATASOURCES_PATH·}·from·'../../utils/constants';`
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"]'

Check failure on line 14 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
const createPrometheusButton = '[data-test-subj="datasource_card_prometheus"]';

const visitDatasourcesHomePage = () => {
cy.visit(FONTEND_BASE_PATH + DATASOURCES_API_PREFIX);
}

Check failure on line 19 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

const visitDatasourcesCreationPage = () => {
cy.visit(FONTEND_BASE_PATH + DATASOURCES_PATH.DATASOURCES_CREATION_BASE);
}

Check failure on line 23 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

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')

Check failure on line 54 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

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')

Check failure on line 65 in .cypress/integration/datasources_test/datasources_basic_ui.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

cy.get('h4.euiTitle.euiTitle--medium')
.should('be.visible')
.and('contain', 'Configure Prometheus data source');
});
});
2 changes: 1 addition & 1 deletion .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Check failure on line 17 in .cypress/utils/constants.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `,`
}

Check failure on line 18 in .cypress/utils/constants.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/**'],
Expand Down

0 comments on commit 0965f59

Please sign in to comment.