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

Initial test case using Cypress #196

Conversation

yizheliu-amazon
Copy link
Contributor

@yizheliu-amazon yizheliu-amazon commented Jun 3, 2020

Issue #, if available:

Description of changes:
Initial test case using Cypress. CI will be configured as next step. And more tests will be added.

Testing:

➜  anomaly-detection-kibana-plugin git:(cypress-init) ✗ yarn cy:run
yarn run v1.22.0
$ cypress run

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    4.6.0                                                                              │
  │ Browser:    Electron 80 (headless)                                                             │
  │ Specs:      1 found (ad/dashboard/ad_dashboard.spec.ts)                                        │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────

  Running:  ad/dashboard/ad_dashboard.spec.ts                                               (1 of 1)


  AD Dashboard
    ✓ Empty dashboard - no detector (29526ms)


  1 passing (30s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        1                                                                                │
  │ Passing:      1                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     29 seconds                                                                       │
  │ Spec Ran:     ad/dashboard/ad_dashboard.spec.ts                                                │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  ad/dashboard/ad_dashboard.spec.ts        00:29        1        1        -        -        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:29        1        1        -        -        -

✨  Done in 53.73s.

Screenshot:
Command: yarn cy:open
Screen Shot 2020-06-02 at 6 25 57 PM

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Comment on lines +31 to +35
// Import commands.js using ES2015 syntax:
// import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is everything commented out here because we have no modified configuration/behavior yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. It is more like a placeholder for now.

package.json Outdated
"start-cy-server": "yarn start --no-base-path --oss",
"cy:open": "cypress open",
"cy:run": "cypress run",
"e2e:test": "WAIT_ON_TIMEOUT=900000 start-server-and-test 'yarn start-cy-server' http-get://localhost:5601/app/opendistro-anomaly-detection-kibana 'yarn cy:run'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we test by running yarn e2e:test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the upcoming CI change, it will be used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, makes sense

@ohltyler ohltyler linked an issue Jun 3, 2020 that may be closed by this pull request
* permissions and limitations under the License.
*/

/// <reference types="cypress" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to enable Intelligent Code Completion in IDE: https://docs.cypress.io/guides/tooling/IDE-integration.html#Triple-slash-directives

@ylwu-amzn
Copy link
Contributor

Can you explain how to run integration test in readme?

@yizheliu-amazon
Copy link
Contributor Author

Can you explain how to run integration test in readme?

sure. will add it.

Copy link
Contributor

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looks like small conflict with ‘yarn.lock’ after my upgrade changes.

@yizheliu-amazon yizheliu-amazon merged commit 3179e88 into opendistro-for-elasticsearch:master Jun 4, 2020
@yizheliu-amazon yizheliu-amazon deleted the cypress-init branch June 4, 2020 18:02
Copy link
Contributor

@mihirsoni mihirsoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great start. Thanks for doing it :)

@ohltyler ohltyler added the test fix/enhance testing label Jun 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
test fix/enhance testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration test
4 participants