diff --git a/cypress.json b/cypress.json index b6ecf4119..6d79e760c 100644 --- a/cypress.json +++ b/cypress.json @@ -18,7 +18,7 @@ "ENDPOINT_WITH_PROXY": false, "MANAGED_SERVICE_ENDPOINT": false, "VISBUILDER_ENABLED": true, - "DATASOURCE_MANAGEMENT_ENABLED": false, + "DATASOURCE_MANAGEMENT_ENABLED": true, "ML_COMMONS_DASHBOARDS_ENABLED": true, "WAIT_FOR_LOADER_BUFFER_MS": 0, "DASHBOARDS_ASSISTANT_ENABLED": false, diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/1_create_datasource.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/1_create_datasource.spec.js index 16340acb8..dd7c56f6a 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/1_create_datasource.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/1_create_datasource.spec.js @@ -53,9 +53,9 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { ); cy.get('[name="dataSourceTitle"]').type('test_noauth'); cy.get('[name="endpoint"]').type(OSD_TEST_DOMAIN_ENDPOINT_URL); - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'no_auth' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="no_auth"]').click(); + cy.get('[data-test-subj="createDataSourceButton"]').should( 'be.enabled' ); @@ -79,9 +79,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { ); cy.get('[name="dataSourceTitle"]').type('test_auth'); cy.get('[name="endpoint"]').type(OSD_TEST_DOMAIN_ENDPOINT_URL); - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'username_password' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="username_password"]').click(); cy.get('[data-test-subj="createDataSourceFormUsernameField"]').type( username ); @@ -91,6 +90,7 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { cy.get('[data-test-subj="createDataSourceButton"]').should( 'be.enabled' ); + cy.get('[name="dataSourceDescription"]').type( 'cypress test basic auth data source' ); @@ -110,15 +110,15 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { ); cy.get('[name="dataSourceTitle"]').type('test_sigv4_es'); cy.get('[name="endpoint"]').type(OSD_TEST_DOMAIN_ENDPOINT_URL); - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get('[data-test-subj="createDataSourceFormRegionField"]').type( REGION ); cy.get( '[data-test-subj="createDataSourceFormSigV4ServiceTypeSelect"]' - ).select('es'); + ).click(); + cy.get('button[id="es"]').click(); cy.get('[data-test-subj="createDataSourceFormAccessKeyField"]').type( ACCESS_KEY ); @@ -149,15 +149,16 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { ); cy.get('[name="dataSourceTitle"]').type('test_sigv4_aoss'); cy.get('[name="endpoint"]').type(OSD_TEST_DOMAIN_ENDPOINT_URL); - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get('[data-test-subj="createDataSourceFormRegionField"]').type( REGION ); - cy.get( - '[data-test-subj="createDataSourceFormSigV4ServiceTypeSelect"]' - ).select('aoss'); + cy.get('[data-test-subj="createDataSourceFormSigV4ServiceTypeSelect"]') + .click() + .get('button[id="aoss"]') + .click(); + cy.get('[data-test-subj="createDataSourceFormAccessKeyField"]').type( ACCESS_KEY ); @@ -246,18 +247,16 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('Username validation', () => { it('validate that username field does not show when auth type is no auth', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'no_auth' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="no_auth"]').click(); cy.get('[data-test-subj="createDataSourceFormUsernameField"]').should( 'not.exist' ); }); it('validate that username is a required field when auth type is username & password', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'username_password' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="username_password"]').click().blur(); cy.get('[data-test-subj="createDataSourceFormUsernameField"]') .focus() .blur(); @@ -267,9 +266,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { }); it('validate that username field does not show any error when auth type is username & password and field is not empty', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'username_password' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="username_password"]').click(); cy.get('[data-test-subj="createDataSourceFormUsernameField"]') .type(username) .blur(); @@ -281,18 +279,16 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('Password validation', () => { it('validate that password field does not show when auth type is no auth', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'no_auth' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="no_auth"]').click(); cy.get('[data-test-subj="createDataSourceFormPasswordField"]').should( 'not.exist' ); }); it('validate that password is a required field when auth type is username & password', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'username_password' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="username_password"]').click(); cy.get('[data-test-subj="createDataSourceFormPasswordField"]') .focus() .blur(); @@ -302,9 +298,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { }); it('validate that password field does not show any error when auth type is username & password and field is not empty', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'username_password' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="username_password"]').click(); cy.get('[data-test-subj="createDataSourceFormPasswordField"]') .type(password) .blur(); @@ -316,9 +311,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { describe('SigV4 AuthType: fields validation', () => { it('validate that region is a required field', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get('[data-test-subj="createDataSourceFormRegionField"]') .focus() .blur(); @@ -328,9 +322,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { }); it('validate that accessKey is a required field', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get('[data-test-subj="createDataSourceFormAccessKeyField"]') .focus() .blur(); @@ -340,9 +333,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { }); it('validate that secretKey is a required field', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get('[data-test-subj="createDataSourceFormSecretKeyField"]') .focus() .blur(); @@ -352,9 +344,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { }); it('validate that serviceName is a required field, and with default option rendered', () => { - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'sigv4' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="sigv4"]').click(); cy.get( '[data-test-subj="createDataSourceFormSigV4ServiceTypeSelect"]' ).should('have.value', 'es'); @@ -385,9 +376,8 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { it('validate if create data source button is not disabled only if there is no any field error', () => { cy.get('[name="dataSourceTitle"]').type('test_create_button'); cy.get('[name="endpoint"]').type(OSD_TEST_DOMAIN_ENDPOINT_URL); - cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').select( - 'no_auth' - ); + cy.get('[data-test-subj="createDataSourceFormAuthTypeSelect"]').click(); + cy.get('button[id="no_auth"]').click(); cy.get('[data-test-subj="createDataSourceButton"]').should( 'not.be.disabled' );