Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimal Cypress tests for integrations #990

Merged
merged 13 commits into from
Jan 30, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

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

import { BASE_PATH } from '../../../utils/base_constants';

const testInstanceName = 'test_integration_cypress';

const moveToAvailableNginxIntegration = () => {
cy.visit(`${BASE_PATH}/app/integrations#/available/nginx`);
};

const moveToAddedIntegrations = () => {
cy.visit(`${BASE_PATH}/app/integrations#/installed`);
};

const createSamples = () => {
moveToAvailableNginxIntegration();
cy.get('[data-test-subj="try-it-button"]').click();
cy.get('.euiToastHeader__title').should('contain', 'successfully');
};

describe('Add nginx integration instance flow', () => {
it('Navigates to nginx page and triggers the adds the instance flow', () => {
createSamples();
Swiddis marked this conversation as resolved.
Show resolved Hide resolved
moveToAvailableNginxIntegration();
cy.get('[data-test-subj="add-integration-button"]').click();
cy.get('[data-test-subj="new-instance-name"]').should(
'have.value',
'nginx Integration'
);
cy.get('[data-test-subj="create-instance-button"]').should('be.disabled');
// Modifies the name of the integration
cy.get('[data-test-subj="new-instance-name"]').clear();
cy.get('[data-test-subj="new-instance-name"]').type(testInstanceName);
// Validates the created sample index
cy.get('[data-test-subj="data-source-name"]').type(
'ss4o_logs-nginx-sample-sample{enter}'
);
cy.get('[data-test-subj="create-instance-button"]').click();
cy.get('[data-test-subj="eventHomePageTitle"]').should(
'contain',
testInstanceName
);
});

it('Navigates to installed integrations page and verifies that installed integration exists', () => {
moveToAddedIntegrations();
cy.contains(testInstanceName).should('exist');
Swiddis marked this conversation as resolved.
Show resolved Hide resolved
cy.get('input[type="search"]').eq(0).focus();
cy.get('input[type="search"]').eq(0).type(`${testInstanceName}{enter}`);
cy.get('.euiTableRow').should('have.length', 1); //Filters correctly to the test integration instance
cy.get(`[data-test-subj="${testInstanceName}IntegrationLink"]`).click();
Swiddis marked this conversation as resolved.
Show resolved Hide resolved
});
});
Loading