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] <[email protected]>

* 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 <[email protected]>

(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 <[email protected]>
  • Loading branch information
3 people authored Aug 25, 2020
1 parent e4b9d66 commit 812b01d
Show file tree
Hide file tree
Showing 42 changed files with 1,315 additions and 1,190 deletions.
46 changes: 46 additions & 0 deletions .github/draft-release-notes-config.yml
Original file line number Diff line number Diff line change
@@ -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'
20 changes: 20 additions & 0 deletions .github/workflows/draft-release-notes-workflow.yml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 11 additions & 5 deletions .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
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
Loading

0 comments on commit 812b01d

Please sign in to comment.