Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ds-observability into feature-explorer-query-assistant
  • Loading branch information
paulstn committed Jan 10, 2024
2 parents 592e09a + 9a0fb3d commit 8a6132d
Show file tree
Hide file tree
Showing 52 changed files with 2,008 additions and 5,231 deletions.
18 changes: 0 additions & 18 deletions .babelrc

This file was deleted.

16 changes: 16 additions & 0 deletions .cypress/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
extends: ['plugin:cypress/recommended'],
env: {
'cypress/globals': true,
},
plugins: ['cypress'],
rules: {
// Add cypress specific rules here
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/assertion-before-screenshot': 'warn',
'cypress/no-force': 'warn',
'cypress/no-async-tests': 'error',
},
};
64 changes: 30 additions & 34 deletions .cypress/integration/integrations_test/integrations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
/* eslint-disable jest/expect-expect */

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

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`);
Expand All @@ -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');
Expand All @@ -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();
Expand All @@ -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');
})
});
});


28 changes: 12 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ module.exports = {
'@elastic/eslint-config-kibana',
'plugin:@elastic/eui/recommended',
'plugin:react-hooks/recommended',
"eslint:recommended",
"plugin:cypress/recommended",
"plugin:import/recommended",
"prettier"
],
env: {
'cypress/globals': true,
},
plugins: [
'cypress',
'plugin:jest/recommended',
'plugin:prettier/recommended',
],

rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@osd/eslint/no-restricted-paths': [
'error',
{
Expand All @@ -38,17 +39,12 @@ module.exports = {
],
},
],
// Add cypress specific rules here
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/assertion-before-screenshot': 'warn',
'cypress/no-force': 'warn',
'cypress/no-async-tests': 'error',
},
overrides: [
{
files: ['**/*.{js,ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'no-console': 0,
'@osd/eslint/require-license-header': [
'error',
Expand Down
17 changes: 5 additions & 12 deletions .github/draft-release-notes-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,23 @@ replacers:
categories:
- title: 'Breaking Changes'
labels:
- 'Breaking Changes'
- 'breaking'
- title: 'Features'
labels:
- 'feature'
- title: 'Enhancements'
labels:
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'bug'
- title: 'Infrastructure'
labels:
- 'infra'
- 'test'
- 'dependencies'
- 'github actions'
- 'infrastructure'
- 'testing'
- 'integ-test-failure'
- 'repository'
- title: 'Documentation'
labels:
- 'documentation'
- title: 'Maintenance'
labels:
- "version compatibility"
- "maintenance"
- title: 'Refactoring'
labels:
- 'refactor'
- 'code quality'
13 changes: 13 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Enforce PR labels

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
runs-on: ubuntu-latest
steps:
- uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "breaking,feature,enhancement,bug,infrastructure,dependencies,documentation,maintenance,skip-changelog"
REQUIRED_LABELS_ANY_DESCRIPTION: "A release label is required: ['breaking', 'bug', 'dependencies', 'documentation', 'enhancement', 'feature', 'infrastructure', 'maintenance', 'skip-changelog']"
Loading

0 comments on commit 8a6132d

Please sign in to comment.