Skip to content

Commit

Permalink
Fix the datasources cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Dec 21, 2023
1 parent 1110e0c commit 2b9a2eb
Showing 1 changed file with 26 additions and 30 deletions.
56 changes: 26 additions & 30 deletions .cypress/integration/datasources_test/datasources.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,34 @@

/// <reference types="cypress" />


const moveToDatasourcesHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources`);
};
const moveToDatasourcesHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources`);
};

const moveToNewDatasourcesPage = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/new`);
};
// const moveToNewDatasourcesPage = () => {
// cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/new`);
// };

const moveToCreatePrometheusDatasourcePage = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/configure/PROMETHEUS`);
};

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();
cy.get('[data-test-subj="dataconnections-header"]').should('exist');
});
// const moveToCreatePrometheusDatasourcePage = () => {
// cy.visit(`${Cypress.env('opensearchDashboards')}/app/datasources#/configure/PROMETHEUS`);
// };

it('Tests navigation between tabs and goes to Prometheus creation flow', () => {
moveToDatasourcesHome();
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');
});
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();
cy.get('[data-test-subj="dataconnections-header"]').should('exist');
});



it('Tests navigation between tabs and goes to Prometheus creation flow', () => {
moveToDatasourcesHome();
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');
});
});

0 comments on commit 2b9a2eb

Please sign in to comment.