Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Update Cypress for ODFE 1.10 (#173)
Browse files Browse the repository at this point in the history
* 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 bf9a91c)

* 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 6d82e56)

* Fix the unit-test workflow by checking out the repo first

(cherry picked from commit cc9fc0c)

* 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](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

* 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 <ftianli@amazon.com>

(cherry picked from commit 8b0dd58)

* Adds support for Kibana 7.9.0 (#171)

* keyCode to key

* fix UT

* remove used dependency

(cherry picked from commit 5d3ff53)

* Release note automate (#172)

* release note automation

* python script fix

* compatibale with Kibana

(cherry picked from commit c72d37e)

* 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>
  • Loading branch information
3 people authored and Tianli Feng committed Aug 25, 2020
1 parent 718821c commit 3a51a37
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 961 deletions.
40 changes: 12 additions & 28 deletions cypress/integration/alert_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ describe('Alerts', () => {
cy.createMonitor(sampleMonitorWithAlwaysTrueTrigger);
});

it.only('successfully', () => {
it('successfully', () => {
// Wait for 1 minute
cy.wait(60000);

// Reload the page
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');
});
Expand All @@ -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');
Expand All @@ -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 });
Expand All @@ -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);
});
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand All @@ -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');
Expand Down
27 changes: 7 additions & 20 deletions cypress/integration/destination_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
});
Expand Down
78 changes: 20 additions & 58 deletions cypress/integration/monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
});
Expand All @@ -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 });
Expand All @@ -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');
Expand All @@ -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 });
Expand All @@ -256,32 +226,24 @@ 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
cy.contains('Create trigger');

// 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);
Expand Down
15 changes: 15 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -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.
*/

/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
Expand Down
24 changes: 24 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@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"
},
Expand Down
Loading

0 comments on commit 3a51a37

Please sign in to comment.