diff --git a/.cypress/integration/integrations_test/integrations.spec.js b/.cypress/integration/integrations_test/integrations.spec.js index 4b446f26f..f1281a795 100644 --- a/.cypress/integration/integrations_test/integrations.spec.js +++ b/.cypress/integration/integrations_test/integrations.spec.js @@ -2,15 +2,14 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ +/* eslint-disable jest/expect-expect */ /// -import { - TEST_INTEGRATION_INSTANCE, TEST_SAMPLE_INSTANCE, -} from '../../utils/constants'; +import { TEST_INTEGRATION_INSTANCE, TEST_SAMPLE_INSTANCE } from '../../utils/constants'; -let testInstanceSuffix = (Math.random() + 1).toString(36).substring(7); -let testInstance = `${TEST_INTEGRATION_INSTANCE}_${testInstanceSuffix}`; +const testInstanceSuffix = (Math.random() + 1).toString(36).substring(7); +const testInstance = `${TEST_INTEGRATION_INSTANCE}_${testInstanceSuffix}`; const moveToIntegrationsHome = () => { cy.visit(`${Cypress.env('opensearchDashboards')}/app/integrations#/available`); @@ -28,10 +27,9 @@ const createSamples = () => { moveToAvailableNginxIntegration(); cy.get('[data-test-subj="try-it-button"]').click(); cy.get('.euiToastHeader__title').should('contain', 'successfully'); -} - +}; -describe('Basic sanity test for integrations plugin', () => { +describe('Integrations plugin', () => { it('Navigates to integrations plugin and expects the correct header', () => { moveToIntegrationsHome(); cy.get('[data-test-subj="integrations-header"]').should('exist'); @@ -40,66 +38,66 @@ describe('Basic sanity test for integrations plugin', () => { it('Navigates to integrations plugin and tests that clicking the nginx cards navigates to the nginx page', () => { moveToIntegrationsHome(); cy.get('[data-test-subj="integration_card_nginx"]').click(); - cy.url().should('include', '/available/nginx') - }) + cy.url().should('include', '/available/nginx'); + }); it('Navigates to nginx page and asserts the page to be as expected', () => { moveToAvailableNginxIntegration(); - cy.get('[data-test-subj="nginx-overview"]').should('exist') - cy.get('[data-test-subj="nginx-details"]').should('exist') - cy.get('[data-test-subj="nginx-screenshots"]').should('exist') - cy.get('[data-test-subj="nginx-assets"]').should('exist') + cy.get('[data-test-subj="nginx-overview"]').should('exist'); + cy.get('[data-test-subj="nginx-details"]').should('exist'); + cy.get('[data-test-subj="nginx-screenshots"]').should('exist'); + cy.get('[data-test-subj="nginx-assets"]').should('exist'); cy.get('[data-test-subj="fields"]').click(); - cy.get('[data-test-subj="nginx-fields"]').should('exist') - }) + cy.get('[data-test-subj="nginx-fields"]').should('exist'); + }); it('Uses the search of assets and fields tables', () => { moveToAvailableNginxIntegration(); cy.get('input[type="search"]').eq(0).focus().type('ss4o{enter}'); - cy.get('.euiTableRow').should('have.length', 1);//Filters correctly to the index pattern + cy.get('.euiTableRow').should('have.length', 1); //Filters correctly to the index pattern cy.get('[data-test-subj="fields"]').click(); - cy.get('input[type="search"]').eq(0).focus().clear().type('severity.observe') - cy.get('.euiTableRow').should('have.length', 2);//Filters correctly to the field name - }) + cy.get('input[type="search"]').eq(0).focus().clear().type('severity.observe'); + cy.get('.euiTableRow').should('have.length', 2); //Filters correctly to the field name + }); it('Uses the filter of assets table', () => { moveToAvailableNginxIntegration(); cy.get('.euiFilterGroup').trigger('mouseover').click(); cy.get('.euiFilterSelectItem').contains('visualization').click(); - cy.get('.euiTableRow').should('have.length', 6);//Filters correctly to visualization types - }) + cy.get('.euiTableRow').should('have.length', 6); //Filters correctly to visualization types + }); }); -describe('Tests the add nginx integration instance flow', () => { +describe('Add nginx integration instance flow', () => { it('Navigates to nginx page and triggers the adds the instance flow', () => { createSamples(); 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') + 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().type(testInstance); // 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', 'nginx'); - }) + }); it('Navigates to installed integrations page and verifies that nginx-test exists', () => { moveToAddedIntegrations(); cy.contains(testInstance).should('exist'); cy.get('input[type="search"]').eq(0).focus().type(`${testInstance}{enter}`); - cy.get('.euiTableRow').should('have.length', 1);//Filters correctly to the test integration instance + cy.get('.euiTableRow').should('have.length', 1); //Filters correctly to the test integration instance cy.get(`[data-test-subj="${testInstance}IntegrationLink"]`).click(); - }) + }); it('Navigates to added integrations page and verifies that nginx-test exists and linked asset works as expected', () => { moveToAddedIntegrations(); cy.contains(TEST_INTEGRATION_INSTANCE).should('exist'); cy.get(`[data-test-subj="${testInstance}IntegrationLink"]`).click(); cy.get(`[data-test-subj="IntegrationAssetLink"]`).click(); - cy.url().should('include', '/dashboards#/') - }) + cy.url().should('include', '/dashboards#/'); + }); it('Navigates to installed nginx-test instance page and deletes it', () => { moveToAddedIntegrations(); @@ -115,17 +113,15 @@ describe('Tests the add nginx integration instance flow', () => { cy.get('button[data-test-subj="popoverModal__deleteButton"]').should('not.be.disabled'); cy.get('button[data-test-subj="popoverModal__deleteButton"]').click(); cy.get('.euiToastHeader__title').should('contain', 'successfully'); - }) + }); }); -describe('Tests the add nginx integration instance flow', () => { +describe('Nginx try it flow', () => { it('Navigates to nginx page and triggers the try it flow', () => { moveToAvailableNginxIntegration(); cy.get('[data-test-subj="try-it-button"]').click(); cy.get('.euiToastHeader__title').should('contain', 'successfully'); moveToAddedIntegrations(); cy.contains(TEST_SAMPLE_INSTANCE).should('exist'); - }) + }); }); - - diff --git a/public/components/integrations/components/setup_integration.tsx b/public/components/integrations/components/setup_integration.tsx index 8b7efea45..97fc85e02 100644 --- a/public/components/integrations/components/setup_integration.tsx +++ b/public/components/integrations/components/setup_integration.tsx @@ -26,11 +26,14 @@ import { EuiTitle, } from '@elastic/eui'; import React, { useState, useEffect } from 'react'; -import { Color } from 'common/constants/integrations'; +import { Color } from '../../../../common/constants/integrations'; import { coreRefs } from '../../../framework/core_refs'; import { IntegrationTemplate, addIntegrationRequest } from './create_integration_helpers'; -import { CONSOLE_PROXY, INTEGRATIONS_BASE } from '../../../../common/constants/shared'; -import { DATACONNECTIONS_BASE } from '../../../../common/constants/shared'; +import { + CONSOLE_PROXY, + INTEGRATIONS_BASE, + DATACONNECTIONS_BASE, +} from '../../../../common/constants/shared'; export interface IntegrationSetupInputs { displayName: string; @@ -119,7 +122,7 @@ const suggestDataSources = async (type: string): Promise