Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search] Set up basic scaffolding for Cypress tests in Kibana #108560

Merged
merged 9 commits into from
Aug 16, 2021

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Aug 13, 2021

Fix

This PR is #108309 but with Typescript configuration causing issues in master fixed 🤞

The issue appears to be that I hadn't specified an outDir config to a gitignored folder such as target, and as such compiled .d.ts and .map files were getting generated and then tracked in git on every yarn kbn bootstrap.

I've run yarn kbn clean and yarn kbn bootstrap locally and all my type checks are still working for me, but I'll also be asking other fellow Enterprise Search devs to test this locally and confirm that their bootstrap on this branch works without unexpected issues.

Original PR description

Summary

Why is Enterprise Search choosing to write E2E tests in Cypress over Kibana's FTR?

  • We already have an existing suite of Cypress E2E tests/commands/helpers for our standalone UI, meaning we don't have to rewrite as much / start from scratch
  • We have a slight preference to Cypress's API/command syntax
  • These tests will not be run on the normal per-PR kibana CI jobs - instead, they'll likely be run either nightly or possibly only when specific files change, so we're deviating away from Kibana norms in any case

What this PR does:

  • Creates 3 separate Cypress test suites (App Search, Workplace Search, and Enterprise Search Overview) for each separate plugin so that products can be tested individually as well as have their own custom settings
  • Sets up Cypress for Kibana's Typescript configurations (see https://docs.cypress.io/guides/tooling/typescript-support) now that our Cypress tests are no longer .js files
  • Sets up very basic "Hello world" tests for App Search and Workplace Search
  • Sets up tests locally only: you should be able to run sh cypress.sh run overview from the enterprise_search plugin folder and have all tests pass

What this PR does NOT do:

  • Create a fully-fleshed out set of happy path E2E tests for either AS or WS
  • Hook this up to any kind of CI - I did some brief exploration with Kibana FTR config, but @tarekziade or @brianseeders will be able to determine better how whether to continue using the functional test server vs. dockerized images
  • Figure out how to handle basic vs platinum tests (I'm hoping we can use Kibana's license management UI to upgrade vs downgrade from trials)

As always, I recommend following along by commit.

Screencaps

cypress.mp4

QA

  • Setup
    • Have Elasticsearch running localhost:9200
    • Have Enterprise Search running on localhost:3002
    • In kibana.dev.yml, set csp.strict: false and csp.warnLegacyBrowsers: false
    • Have Kibana running with --no-base-path and on localhost:5601
  • Confirm sh cypress.sh run overview passes
  • Confirm sh cypress.sh run as passes
  • Confirm sh cypress.sh run ws passes

Checklist

  • Documentation was added for features that require explanation or tutorials

- Required if we're going to have several different Cypress suites (one for each plugin/product essentially) in order for global cy.() commands and it()/describe() to register as expected

@see https://docs.cypress.io/guides/tooling/typescript-support#Clashing-types-with-Jest
NOTE: Unlike ent-search, shared/ will *not* have its own set of tests - rather, shared/cypress is a resource/set of helpers for other test suites to extend/import/etc.
@cee-chen cee-chen added release_note:skip Skip the PR/issue when compiling release notes auto-backport Deprecated - use backport:version if exact versions are needed v7.15.0 labels Aug 13, 2021
@cee-chen cee-chen marked this pull request as ready for review August 13, 2021 16:20
@cee-chen cee-chen requested review from a team August 13, 2021 16:20
@cee-chen cee-chen requested a review from a team as a code owner August 13, 2021 16:20
@cee-chen cee-chen requested a review from a team August 13, 2021 16:20
- For happy path testing, we _likely_ shouldn't need more than these tests going forward

- If we ever want to add an error connecting test however, this is likely where it should go (or alternatively, use Kibana's FTR with Enterprise Search host set but not spun up)
- placeholder/hello world test only
- placeholder/hello world test only
@cee-chen cee-chen force-pushed the ent-search-cypress branch from 3f5685b to a9d8447 Compare August 13, 2021 16:30
Copy link
Contributor

@scottybollinger scottybollinger left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

Copy link
Contributor

@byronhulcher byronhulcher left a comment

Choose a reason for hiding this comment

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

Code is good and I couldn't get the files to appear again.

@cee-chen
Copy link
Contributor Author

@elasticmachine merge upstream

@cee-chen cee-chen requested a review from spalger August 16, 2021 15:58
@cee-chen
Copy link
Contributor Author

Heya @spalger! I was recommended by @mistic to wait for your review before merging. Would super appreciate your OK/or if you see any issues with the current tsconfig setup for Cypress. Thanks!

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM, but one nit

src/dev/typescript/projects.ts Outdated Show resolved Hide resolved
@cee-chen cee-chen enabled auto-merge (squash) August 16, 2021 18:13
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@cee-chen cee-chen merged commit 3ffd6af into elastic:master Aug 16, 2021
@cee-chen cee-chen deleted the ent-search-cypress branch August 16, 2021 20:30
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Aug 16, 2021
…ana (elastic#108560)

* Set up tsconfigs

- Required if we're going to have several different Cypress suites (one for each plugin/product essentially) in order for global cy.() commands and it()/describe() to register as expected

@see https://docs.cypress.io/guides/tooling/typescript-support#Clashing-types-with-Jest

* Set up shared commands and routes

NOTE: Unlike ent-search, shared/ will *not* have its own set of tests - rather, shared/cypress is a resource/set of helpers for other test suites to extend/import/etc.

* Create basic Enterprise Search Overview E2E tests

- For happy path testing, we _likely_ shouldn't need more than these tests going forward

- If we ever want to add an error connecting test however, this is likely where it should go (or alternatively, use Kibana's FTR with Enterprise Search host set but not spun up)

* Set up App Search Cypress test scaffolding

- placeholder/hello world test only

* Set up Workplace Search Cypress test scaffolding

- placeholder/hello world test only

* Add helper script and update README

* Add config setup & documentation for potentially running Cypress against Kibana functional server

* PR feedback: Fix typescript project names

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 16, 2021
…ana (#108560) (#108779)

* Set up tsconfigs

- Required if we're going to have several different Cypress suites (one for each plugin/product essentially) in order for global cy.() commands and it()/describe() to register as expected

@see https://docs.cypress.io/guides/tooling/typescript-support#Clashing-types-with-Jest

* Set up shared commands and routes

NOTE: Unlike ent-search, shared/ will *not* have its own set of tests - rather, shared/cypress is a resource/set of helpers for other test suites to extend/import/etc.

* Create basic Enterprise Search Overview E2E tests

- For happy path testing, we _likely_ shouldn't need more than these tests going forward

- If we ever want to add an error connecting test however, this is likely where it should go (or alternatively, use Kibana's FTR with Enterprise Search host set but not spun up)

* Set up App Search Cypress test scaffolding

- placeholder/hello world test only

* Set up Workplace Search Cypress test scaffolding

- placeholder/hello world test only

* Add helper script and update README

* Add config setup & documentation for potentially running Cypress against Kibana functional server

* PR feedback: Fix typescript project names

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Constance <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants