From 812b01de485e33895eb335ccd86ee3c703da3eee Mon Sep 17 00:00:00 2001 From: Tianli Feng <62041081+ftianli-amzn@users.noreply.github.com> Date: Mon, 24 Aug 2020 22:57:23 -0700 Subject: [PATCH] Update Cypress for ODFE 1.10 (#173) * Adds support for Kibana 7.8.0 (#163) * Bump version number of ES, ODFE, and node * update Jest snapshots * update release notes with Kibana 7.8.0 support * Move plugin entry into Kibana app category in sidebar (cherry picked from commit bf9a91cbe3ad1c92c6eb3591d9120689b09d10bd) * Update the unit-test workflow script to get Kibana version from package.json (#165) * Get Kibana version from the package.json file in unit-test workflow (cherry picked from commit 6d82e568fb6d7bd6d1b19e279b8ae6c4d47b6fc8) * Fix the unit-test workflow by checking out the repo first (cherry picked from commit cc9fc0cf9f4bffe8b2957a4abfb85ba8dd515e61) * Bump lodash from 4.17.15 to 4.17.19 (#169) * Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] * update yarn.lock by running 'yarn kbn bootstrap' Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tianli Feng (cherry picked from commit 8b0dd58dad3a0b91c05f6e4054ac54b85dff4630) * Adds support for Kibana 7.9.0 (#171) * keyCode to key * fix UT * remove used dependency (cherry picked from commit 5d3ff531ba2e3e9073ad05075e954b178d8c2127) * Release note automate (#172) * release note automation * python script fix * compatibale with Kibana (cherry picked from commit c72d37e01f014906e5f764bca681060103e4f01e) * upgrade cypress verison to 5.0.0 * ingonre an uncaught error and add some copyright notice * change a wording back Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bowen Lan <62091230+bowenlan-amzn@users.noreply.github.com> --- .github/draft-release-notes-config.yml | 46 + .../draft-release-notes-workflow.yml | 20 + .github/workflows/unit-tests-workflow.yml | 16 +- cypress/integration/alert_spec.js | 40 +- cypress/integration/destination_spec.js | 27 +- cypress/integration/monitor_spec.js | 78 +- cypress/plugins/index.js | 15 + cypress/support/index.js | 24 + index.js | 5 +- package.json | 10 +- public/app.js | 7 +- .../Flyout/__snapshots__/Flyout.test.js.snap | 8 - .../__snapshots__/flyouts.test.js.snap | 4 +- .../__snapshots__/FormikSwitch.test.js.snap | 4 +- .../__snapshots__/AnomaliesChart.test.js.snap | 14 +- .../expressions/WhereExpression.test.js | 6 +- .../__tests__/AnomalyDetector.test.js | 6 +- .../AnomalyDetector.test.js.snap | 1 + .../MonitorIndex/MonitorIndex.test.js | 54 +- .../__snapshots__/MonitorIndex.test.js.snap | 1 + .../__snapshots__/Message.test.js.snap | 16 +- .../TriggerExpressions.test.js | 2 +- .../DashboardControls.test.js.snap | 79 +- .../DestinationsControls.test.js.snap | 224 ++- .../containers/Monitors/Monitors.test.js | 15 +- release-notes/create-release-notes.py | 46 + ...g-kibana-plugin.release-notes-0.10.0.0.md} | 0 ...ng-kibana-plugin.release-notes-0.7.0.0.md} | 0 ...ng-kibana-plugin.release-notes-0.8.0.0.md} | 0 ...ng-kibana-plugin.release-notes-0.9.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.0.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.1.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.10.0.0.md | 4 + ...ng-kibana-plugin.release-notes-1.2.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.3.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.4.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.6.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.7.0.0.md} | 0 ...ng-kibana-plugin.release-notes-1.8.0.0.md} | 0 ...ing-kibana-plugin.release-notes-1.9.0.0.md | 4 + test/setup.jest.js | 7 + yarn.lock | 1722 +++++++++-------- 42 files changed, 1315 insertions(+), 1190 deletions(-) create mode 100644 .github/draft-release-notes-config.yml create mode 100644 .github/workflows/draft-release-notes-workflow.yml create mode 100644 release-notes/create-release-notes.py rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-0.10.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-0.10.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-0.7.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-0.7.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-0.8.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-0.8.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-0.9.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-0.9.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.0.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.0.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.1.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.1.0.0.md} (100%) create mode 100644 release-notes/opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.10.0.0.md rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.2.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.2.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.3.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.3.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.4.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.4.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.6.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.6.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.7.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.7.0.0.md} (100%) rename release-notes/{opendistro-for-elasticsearch.alerting-kibana.release-notes-1.8.0.0.md => opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.8.0.0.md} (100%) create mode 100644 release-notes/opendistro-for-elasticsearch-alerting-kibana-plugin.release-notes-1.9.0.0.md diff --git a/.github/draft-release-notes-config.yml b/.github/draft-release-notes-config.yml new file mode 100644 index 00000000..9718083b --- /dev/null +++ b/.github/draft-release-notes-config.yml @@ -0,0 +1,46 @@ +# https://github.com/marketplace/actions/release-drafter +# As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready + +template: | + Compatible with Kibana (**set version here**). + $CHANGES +# Setting the formatting and sorting for the release notes body +name-template: Version (set version here) +change-template: '* $TITLE (#$NUMBER)' +sort-by: merged_at +sort-direction: ascending +replacers: + - search: '##' + replace: '###' + +# Organizing the tagged PRs into unified ODFE categories +categories: + - title: 'Breaking changes' + labels: + - 'breaking change' + - title: 'Features' + labels: + - 'feature' + - title: 'Enhancements' + labels: + - 'enhancement' + - 'action' + - 'API' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Infrastructure' + labels: + - 'infra' + - 'testing' + - 'CI/CD' + - 'dependencies' + - title: 'Documentation' + labels: + - 'documentation' + - title: 'Maintenance' + labels: + - 'version support' + - title: 'Refactoring' + labels: + - 'refactor' \ No newline at end of file diff --git a/.github/workflows/draft-release-notes-workflow.yml b/.github/workflows/draft-release-notes-workflow.yml new file mode 100644 index 00000000..9a0dd9ca --- /dev/null +++ b/.github/workflows/draft-release-notes-workflow.yml @@ -0,0 +1,20 @@ +name: Release Drafter + +on: + push: + branches: + - master + +jobs: + update_release_draft: + name: Update draft release notes + runs-on: ubuntu-latest + steps: + - name: Update draft release notes + uses: release-drafter/release-drafter@v5 + with: + config-name: draft-release-notes-config.yml + name: Version (set here) + tag: (None) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 1acac851..699f053f 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -9,11 +9,19 @@ jobs: name: Run unit tests runs-on: ubuntu-latest steps: + - name: Checkout Alerting Kibana plugin + uses: actions/checkout@v2 + with: + path: alerting-kibana-plugin + - name: Get Kibana version + id: kibana_version + run: | + echo "::set-output name=kibana_version::$(node -p "(require('./alerting-kibana-plugin/package.json').kibana.version).match(/[.0-9]+/)[0]")" - name: Checkout Kibana uses: actions/checkout@v2 with: repository: opendistro-for-elasticsearch/kibana-oss - ref: 7.7.0 + ref: ${{ steps.kibana_version.outputs.kibana_version }} token: ${{ secrets.GITHUB_KIBANA_OSS }} path: kibana - name: Get node and yarn versions @@ -31,12 +39,10 @@ jobs: npm uninstall -g yarn echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} - - name: Checkout Alerting Kibana plugin - uses: actions/checkout@v2 - with: - path: kibana/plugins/alerting-kibana-plugin - name: Bootstrap plugin/kibana run: | + mkdir -p kibana/plugins + mv alerting-kibana-plugin kibana/plugins cd kibana/plugins/alerting-kibana-plugin yarn kbn bootstrap - name: Run tests diff --git a/cypress/integration/alert_spec.js b/cypress/integration/alert_spec.js index ace1c744..6d21eceb 100644 --- a/cypress/integration/alert_spec.js +++ b/cypress/integration/alert_spec.js @@ -38,7 +38,7 @@ describe('Alerts', () => { cy.createMonitor(sampleMonitorWithAlwaysTrueTrigger); }); - it.only('successfully', () => { + it('successfully', () => { // Wait for 1 minute cy.wait(60000); @@ -46,7 +46,7 @@ describe('Alerts', () => { cy.reload(); // Confirm we can see one and only alert in Active state - cy.get('tbody > tr').should($tr => { + cy.get('tbody > tr').should(($tr) => { expect($tr, '1 row').to.have.length(1); expect($tr, 'item').to.contain('Active'); }); @@ -67,9 +67,7 @@ describe('Alerts', () => { cy.get('input[data-test-subj^="checkboxSelectRow-"]').click({ force: true }); // Click Acknowledge button - cy.get('button') - .contains('Acknowledge') - .click({ force: true }); + cy.get('button').contains('Acknowledge').click({ force: true }); // Confirm we can see the alert is in 'Acknowledged' state cy.contains('Acknowledged'); @@ -91,25 +89,19 @@ describe('Alerts', () => { cy.get('input[data-test-subj^="checkboxSelectRow-"]').click({ force: true }); // Click Monitors button to route to Monitors tab - cy.get('button') - .contains('Monitors') - .click({ force: true }); + cy.get('button').contains('Monitors').click({ force: true }); // Type in monitor name in search box - cy.get(`input[type="search"]`) - .focus() - .type(SAMPLE_MONITOR_TO_BE_DELETED); + cy.get(`input[type="search"]`).focus().type(SAMPLE_MONITOR_TO_BE_DELETED); // Confirm we filtered down to our one and only monitor - cy.get('tbody > tr').should($tr => { + cy.get('tbody > tr').should(($tr) => { expect($tr, '1 row').to.have.length(1); expect($tr, 'item').to.contain(SAMPLE_MONITOR_TO_BE_DELETED); }); // Select checkbox for the existing monitor - cy.get('input[data-test-subj^="checkboxSelectRow-"]') - .first() - .click({ force: true }); + cy.get('input[data-test-subj^="checkboxSelectRow-"]').first().click({ force: true }); // Click Actions button to open the actions menu cy.contains('Actions').click({ force: true }); @@ -118,12 +110,10 @@ describe('Alerts', () => { cy.contains('Delete').click({ force: true }); // Clear the text in the search box - cy.get(`input[type="search"]`) - .focus() - .clear(); + cy.get(`input[type="search"]`).focus().clear(); // Confirm we can see only one monitor in the list - cy.get('tbody > tr').should($tr => { + cy.get('tbody > tr').should(($tr) => { expect($tr, '1 row').to.have.length(1); expect($tr, 'item').to.contain(SAMPLE_MONITOR_WORKFLOW); }); @@ -132,9 +122,7 @@ describe('Alerts', () => { cy.wait(60000); // Click Dashboard button to route to Dashboard tab - cy.get('button') - .contains('Dashboard') - .click({ force: true }); + cy.get('button').contains('Dashboard').click({ force: true }); // Confirm we can see the alert is in 'Completed' state cy.contains('Completed'); @@ -166,9 +154,7 @@ describe('Alerts', () => { cy.contains('Active'); // Click Monitors button to route to Monitors tab - cy.get('button') - .contains('Monitors') - .click({ force: true }); + cy.get('button').contains('Monitors').click({ force: true }); // Confirm we can see a monitor in the list cy.contains(SAMPLE_MONITOR_TO_BE_DELETED); @@ -186,9 +172,7 @@ describe('Alerts', () => { cy.contains('There are no existing monitors'); // Click Dashboard button to route to Dashboard tab - cy.get('button') - .contains('Dashboard') - .click({ force: true }); + cy.get('button').contains('Dashboard').click({ force: true }); // Confirm we can see the alert is in 'Deleted' state cy.contains('Deleted'); diff --git a/cypress/integration/destination_spec.js b/cypress/integration/destination_spec.js index 15a96e56..d2c4eedc 100644 --- a/cypress/integration/destination_spec.js +++ b/cypress/integration/destination_spec.js @@ -56,9 +56,7 @@ describe('Destinations', () => { cy.get('input[name="custom_webhook.url"]').type(SAMPLE_URL, { force: true }); // Click the create button - cy.get('button') - .contains('Create') - .click({ force: true }); + cy.get('button').contains('Create').click({ force: true }); // Confirm we can see the created destination in the list cy.contains(SAMPLE_DESTINATION); @@ -76,20 +74,13 @@ describe('Destinations', () => { cy.contains(SAMPLE_DESTINATION); // Click the Edit button - cy.get('button') - .contains('Edit') - .click({ force: true }); + cy.get('button').contains('Edit').click({ force: true }); // Wait for input to load and then type in the destination name - cy.get('input[name="name"]') - .focus() - .clear() - .type(UPDATED_DESTINATION, { force: true }); + cy.get('input[name="name"]').focus().clear().type(UPDATED_DESTINATION, { force: true }); // Click the create button - cy.get('button') - .contains('Update') - .click({ force: true }); + cy.get('button').contains('Update').click({ force: true }); // Confirm we can see the updated destination in the list cy.contains(UPDATED_DESTINATION); @@ -129,20 +120,16 @@ describe('Destinations', () => { it('successfully', () => { // Sort the table by monitor name in alphabetical order - cy.get('thead > tr > th') - .contains('Destination name') - .click({ force: true }); + cy.get('thead > tr > th').contains('Destination name').click({ force: true }); // Confirm the monitor with a different name does not exist cy.contains(SAMPLE_DESTINATION_WITH_ANOTHER_NAME).should('not.exist'); // Type in monitor name in search box - cy.get(`input[type="search"]`) - .focus() - .type(SAMPLE_DESTINATION_WITH_ANOTHER_NAME); + cy.get(`input[type="search"]`).focus().type(SAMPLE_DESTINATION_WITH_ANOTHER_NAME); // Confirm we filtered down to our one and only destination - cy.get('tbody > tr').should($tr => { + cy.get('tbody > tr').should(($tr) => { expect($tr, '1 row').to.have.length(1); expect($tr, 'item').to.contain(SAMPLE_DESTINATION_WITH_ANOTHER_NAME); }); diff --git a/cypress/integration/monitor_spec.js b/cypress/integration/monitor_spec.js index 7d019557..12c8b6d8 100644 --- a/cypress/integration/monitor_spec.js +++ b/cypress/integration/monitor_spec.js @@ -58,22 +58,16 @@ describe('Monitors', () => { cy.get('#index').type('*', { force: true }); // Click the create button - cy.get('button') - .contains('Create') - .click({ force: true }); + cy.get('button').contains('Create').click({ force: true }); // Confirm "monitor is created" shows cy.contains(`Monitor ${SAMPLE_MONITOR} has been created`); // Go back to main page of the Plugin - cy.get('a') - .contains('Alerting') - .click({ force: true }); + cy.get('a').contains('Alerting').click({ force: true }); // Go to the Monitors list - cy.get('button') - .contains('Monitors') - .click({ force: true }); + cy.get('button').contains('Monitors').click({ force: true }); // Confirm we can see the created monitor in the list cy.contains(SAMPLE_MONITOR); @@ -91,38 +85,26 @@ describe('Monitors', () => { cy.contains(SAMPLE_MONITOR); // Select the existing monitor - cy.get('a') - .contains(SAMPLE_MONITOR) - .click({ force: true }); + cy.get('a').contains(SAMPLE_MONITOR).click({ force: true }); // Click Edit button cy.contains('Edit').click({ force: true }); // Wait for input to load and then type in the new monitor name - cy.get('input[name="name"]') - .focus() - .clear() - .type(UPDATED_MONITOR, { force: true }); + cy.get('input[name="name"]').focus().clear().type(UPDATED_MONITOR, { force: true }); // Click Update button - cy.get('button') - .contains('Update') - .last() - .click({ force: true }); + cy.get('button').contains('Update').last().click({ force: true }); // Confirm the update process is done and the page loaded cy.contains('Create trigger'); // This step is used to make the monitors list refresh // Go back to main page of Alerting plugin - cy.get('a') - .contains('Alerting') - .click({ force: true }); + cy.get('a').contains('Alerting').click({ force: true }); // Go to the Monitors list - cy.get('button') - .contains('Monitors') - .click({ force: true }); + cy.get('button').contains('Monitors').click({ force: true }); // Confirm we can see the updated monitor in the list cy.contains(UPDATED_MONITOR); @@ -165,20 +147,16 @@ describe('Monitors', () => { it('successfully', () => { // Sort the table by monitor name in alphabetical order - cy.get('thead > tr > th') - .contains('Monitor name') - .click({ force: true }); + cy.get('thead > tr > th').contains('Monitor name').click({ force: true }); // Confirm the monitor with a different name does not exist cy.contains(SAMPLE_MONITOR_WITH_ANOTHER_NAME).should('not.exist'); // Type in monitor name in search box - cy.get(`input[type="search"]`) - .focus() - .type(SAMPLE_MONITOR_WITH_ANOTHER_NAME); + cy.get(`input[type="search"]`).focus().type(SAMPLE_MONITOR_WITH_ANOTHER_NAME); // Confirm we filtered down to our one and only monitor - cy.get('tbody > tr').should($tr => { + cy.get('tbody > tr').should(($tr) => { expect($tr, '1 row').to.have.length(1); expect($tr, 'item').to.contain(SAMPLE_MONITOR_WITH_ANOTHER_NAME); }); @@ -196,9 +174,7 @@ describe('Monitors', () => { cy.contains(SAMPLE_MONITOR); // Select the existing monitor - cy.get('a') - .contains(SAMPLE_MONITOR) - .click({ force: true }); + cy.get('a').contains(SAMPLE_MONITOR).click({ force: true }); // Click Create Trigger button cy.contains('Create trigger').click({ force: true }); @@ -207,9 +183,7 @@ describe('Monitors', () => { cy.get('input[name="name"]').type(SAMPLE_TRIGGER, { force: true }); // Click the create button - cy.get('button') - .contains('Create') - .click({ force: true }); + cy.get('button').contains('Create').click({ force: true }); // Confirm we can see only one row in the trigger list cy.contains('This table contains 1 row'); @@ -231,17 +205,13 @@ describe('Monitors', () => { cy.contains(SAMPLE_MONITOR); // Select the existing monitor - cy.get('a') - .contains(SAMPLE_MONITOR) - .click({ force: true }); + cy.get('a').contains(SAMPLE_MONITOR).click({ force: true }); // Select checkbox for the existing monitor cy.get('input[data-test-subj^="checkboxSelectRow-"]').click({ force: true }); // Click the trigger Edit button - cy.get('.euiPanel') - .contains('Edit') - .click({ force: true }); + cy.get('.euiPanel').contains('Edit').click({ force: true }); // Click the Add Action button to configure trigger actions cy.contains('Add action').click({ force: true }); @@ -256,9 +226,7 @@ describe('Monitors', () => { cy.get('button[type="custom_webhook"]').click({ force: true }); // Click Update button to update the monitor - cy.get('button') - .contains('Update') - .click({ force: true }); + cy.get('button').contains('Update').click({ force: true }); // The following is used to validate the action has been added. // Confirm the update process is done and the page loaded @@ -266,22 +234,16 @@ describe('Monitors', () => { // This step is used to make the actions list of the trigger refresh // Go to the Monitors list - cy.get('a') - .contains('Monitors') - .click({ force: true }); + cy.get('a').contains('Monitors').click({ force: true }); // Select the existing monitor - cy.get('a') - .contains(SAMPLE_MONITOR) - .click({ force: true }); + cy.get('a').contains(SAMPLE_MONITOR).click({ force: true }); - // Select checkbox for the existing monitor + // Select checkbox for the created trigger cy.get('input[data-test-subj^="checkboxSelectRow-"]').click({ force: true }); // Click the trigger Edit button - cy.get('div.euiPanel') - .contains('Edit') - .click({ force: true }); + cy.get('div.euiPanel').contains('Edit').click({ force: true }); // Confirm we can see the new action cy.contains(SAMPLE_ACTION); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 8dd144a6..0f4a9c91 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + /// // *********************************************************** // This example plugins/index.js can be used to load plugins diff --git a/cypress/support/index.js b/cypress/support/index.js index 37a498fb..65ac9482 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + // *********************************************************** // This example support/index.js is processed and // loaded automatically before your test files. @@ -18,3 +33,12 @@ import './commands'; // Alternatively you can use CommonJS syntax: // require('./commands') + +// ignore the error "ResizeObserver loop limit exceeded", https://github.com/quasarframework/quasar/issues/2233 +const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/; +Cypress.on('uncaught:exception', (err) => { + /* returning false here prevents Cypress from failing the test */ + if (resizeObserverLoopErrRe.test(err.message)) { + return false; + } +}); diff --git a/index.js b/index.js index 98a5ae1a..d9625806 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,6 @@ * permissions and limitations under the License. */ -import { resolve } from 'path'; import { alerts, destinations, elasticsearch, monitors, detectors } from './server/routes'; import { AlertService, @@ -24,8 +23,9 @@ import { } from './server/services'; import { createAlertingCluster, createAlertingADCluster } from './server/clusters'; import { PLUGIN_NAME } from './utils/constants'; +import { DEFAULT_APP_CATEGORIES } from '../../src/core/utils'; -export default function(kibana) { +export default function (kibana) { return new kibana.Plugin({ require: ['elasticsearch'], name: PLUGIN_NAME, @@ -35,6 +35,7 @@ export default function(kibana) { description: 'Kibana Alerting Plugin', main: `plugins/${PLUGIN_NAME}/app`, icon: `plugins/${PLUGIN_NAME}/images/alerting_icon.svg`, + category: DEFAULT_APP_CATEGORIES.kibana, }, hacks: [`plugins/${PLUGIN_NAME}/hack`], diff --git a/package.json b/package.json index d0ec30c9..7242adbc 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "opendistro-alerting", - "version": "1.8.0.0", + "version": "1.10.0.0", "description": "Kibana Alerting Plugin", "main": "index.js", "license": "Apache-2.0", "homepage": "https://github.com/opendistro-for-elasticsearch/alerting-kibana-plugin", "kibana": { - "version": "7.7.0", + "version": "7.9.0", "templateVersion": "6.3.3" }, "repository": { @@ -32,14 +32,14 @@ "@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana", "@kbn/expect": "link:../../packages/kbn-expect", "@kbn/plugin-helpers": "link:../../packages/kbn-plugin-helpers", - "cypress": "^4.8.0", + "cypress": "^5.0.0", "husky": "^3.0.0", "lint-staged": "^9.2.0" }, "dependencies": { "brace": "^0.11.1", "formik": "1.1.1", - "lodash": "^4.17.13", + "lodash": "^4.17.19", "query-string": "5.1.1", "react-router-dom": "4.3.1", "react-vis": "^1.11.7" @@ -48,7 +48,7 @@ "fstream": "1.0.12" }, "engines": { - "node": "10.19.0", + "node": "10.21.0", "yarn": "^1.21.1" } } diff --git a/public/app.js b/public/app.js index 6c6727fb..4f5fea7e 100644 --- a/public/app.js +++ b/public/app.js @@ -20,7 +20,6 @@ import { uiModules } from 'ui/modules'; import { HashRouter as Router, Route } from 'react-router-dom'; import 'react-vis/dist/style.css'; -import 'ui/autoload/styles'; import './less/main.less'; import Main from './pages/Main'; import { AppContext } from './utils/AppContext'; @@ -35,7 +34,7 @@ if (darkMode) { require('@elastic/charts/dist/theme_only_light.css'); } -app.config($locationProvider => { +app.config(($locationProvider) => { $locationProvider.html5Mode({ enabled: false, requireBase: false, @@ -43,7 +42,7 @@ app.config($locationProvider => { }); }); -app.config(stateManagementConfigProvider => stateManagementConfigProvider.disable()); +app.config((stateManagementConfigProvider) => stateManagementConfigProvider.disable()); function RootController($scope, $element, $http) { const domNode = $element[0]; @@ -52,7 +51,7 @@ function RootController($scope, $element, $http) { render( -
} /> +
} /> , domNode diff --git a/public/components/Flyout/__snapshots__/Flyout.test.js.snap b/public/components/Flyout/__snapshots__/Flyout.test.js.snap index db6c8a4f..9c9f5c7f 100644 --- a/public/components/Flyout/__snapshots__/Flyout.test.js.snap +++ b/public/components/Flyout/__snapshots__/Flyout.test.js.snap @@ -2,23 +2,15 @@ exports[`Flyout defaults if bad flyout data 1`] = ` `; exports[`Flyout renders 1`] = `
  • - HTML Templates with Mustache.js - +
, diff --git a/public/components/FormControls/FormikSwitch/__snapshots__/FormikSwitch.test.js.snap b/public/components/FormControls/FormikSwitch/__snapshots__/FormikSwitch.test.js.snap index d033b732..f24b1682 100644 --- a/public/components/FormControls/FormikSwitch/__snapshots__/FormikSwitch.test.js.snap +++ b/public/components/FormControls/FormikSwitch/__snapshots__/FormikSwitch.test.js.snap @@ -5,7 +5,7 @@ exports[`FormikSwitch renders 1`] = ` class="euiSwitch" >