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

[Fleet] [Meta] Add UI integration tests for Fleet app #121436

Open
15 of 37 tasks
joshdover opened this issue Dec 16, 2021 · 6 comments
Open
15 of 37 tasks

[Fleet] [Meta] Add UI integration tests for Fleet app #121436

joshdover opened this issue Dec 16, 2021 · 6 comments
Labels
Meta Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture

Comments

@joshdover
Copy link
Contributor

joshdover commented Dec 16, 2021

We've had a few recent breakages that likely could have been caught by automated UI integration tests. In #113106, we added support for writing tests in the Cypress test framework which greatly improves the test writing experience and reliability. We should start leveraging this new framework to cover some our most important flows.

We should not use these UI integration tests to cover all edge cases, but should follow the familiar "testing pyramid" model where these tests cover each feature, but not every permutation of inputs and outputs. Unit tests should leveraged for such cases.

These tests will not be truly e2e (due to no running Fleet Server and Agents), but should assert against the expected state in the Fleet API, Elasticsearch APIs, and/or the .fleet-* indices.

This issue is tangential to #115788 which covers the Integrations list behavior.

Areas needing tests

Roughly in priority of importance, we should add tests for the following UI flows:

Onboarding and setup

Preview Give feedback
  1. Team:Fleet technical debt
    criamico

Agent policies

Preview Give feedback

Integration policies

Preview Give feedback

Integrations

Preview Give feedback
  1. Feature:Unified Integrations Team:Fleet chore technical debt tests_needed

Agent list view

Preview Give feedback
  1. Team:Fleet
    nchaulet

Agent details view

Preview Give feedback

Enrollment tokens view

Preview Give feedback

Data streams view

Preview Give feedback

Recommendation:

  • Keep tests with real API at a minimum, as they are much slower
  • Real API should used for high value scenarios only (high impact if broken, most used)
  • Mock API can be used for less used, less impactful paths - the idea is that API tests should cover that the backend works as expected too
  • Avoid testing the same feature twice, one feature may cover another feature implicitly (e.g. add integration creates agent policy by default)
  • e2e tests can have more steps in one testcase, not efficient to separate them to small testcases with one assert (setup takes more time)
  • clean up after running the tests, to make them repeatable (e.g. delete created assets)

See as an example the time difference: real API takes minutes, mock API seconds
image

@joshdover joshdover added technical debt Improvement of the software architecture and operational architecture Team:Fleet Team label for Observability Data Collection Fleet team labels Dec 16, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@joshdover
Copy link
Contributor Author

@mostlyjason Would like some feedback on the priority here from a customer perspective. I think we will eventually cover all of this, but it would be good to prioritize the most important flows for customers + areas we expect to making changes in the near future.

@mostlyjason
Copy link
Contributor

Looks like a good order

@juliaElastic
Copy link
Contributor

One thing that I think Chaulet raised earlier, that we should point epr to a mock repo/API in cypress tests, to avoid breakages when epr packages change. I think we could try doing that with this issue. If it needs more effort, it can be raised as a new issue.

@joshdover
Copy link
Contributor Author

One thing that I think Chaulet raised earlier, that we should point epr to a mock repo/API in cypress tests, to avoid breakages when epr packages change.

I think we should discuss this. Is the benefit of doing this over running the local EPR registry with stable test packages that we can control when they change, worth the downsides? I worry that implementing a mock API will be fragile and could give us a false sense of confidence in the tests.

Additionally, we are going to need to handle package changes, especially for these default packages which are slated to be bundled directly in Kibana as part of #112095. For those, I think we should explicitly test against package changes when they get updated in the Kibana repo.

@joshdover joshdover changed the title [Fleet] Add UI integration tests for Fleet app [Fleet] [Meta] Add UI integration tests for Fleet app Feb 10, 2022
@joshdover joshdover added the Meta label Feb 10, 2022
@criamico
Copy link
Contributor

criamico commented Feb 14, 2023

I'm not sure if the test covering the "add agent" flow is currently tracked in this issue: https://github.com/elastic/kibana/blob/main/x-pack/plugins/fleet/cypress/e2e/fleet_agent_flyout.cy.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Meta Team:Fleet Team label for Observability Data Collection Fleet team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

No branches or pull requests

5 participants