fleet/cypress
Zach Wasserman 39cef4c43f
Revert "Fleet UI: Reroute homepage (#1640)" (#1724)
Reverts #1640 so that the homepage does not change during the patch release.

This commit will be re-applied after the release is cut.
2021-08-18 18:06:03 -07:00
..
fixtures Merge master into teams 2021-04-14 17:52:15 +01:00
integration Revert "Fleet UI: Reroute homepage (#1640)" (#1724) 2021-08-18 18:06:03 -07:00
plugins Refactor cypress tests and expand testing (#450) 2021-03-12 11:49:28 -08:00
support Improvements to fleetctl enroll secret specs (#1244) 2021-06-29 10:58:15 -07:00
README.md Update documentation structure (#1230) 2021-06-28 11:15:22 -04:00
tsconfig.json Add commands for enrolling hosts in E2E tests (#1089) 2021-06-15 10:14:57 -07:00

Cypress Testing

Cypress tests are designed solely for end-to-end testing. If this is your first time developing or running end-to-end tests, Fleet testing documentation includes git instructions for test preparation and running tests.

Fleet Cypress directories

Integration directory

Cypress tests the integration of entire features of the app.

With the roll out of teams, Cypress tests the user interface of each role of a user on the Basic Tier (Fleet Basic Documentation) and Core Tier (Fleet Core Documentation).

Support directory

Commands that are shared across tests are located in the support directory.

Opening Cypress locally

To open simply run:

yarn cypress:open

This will open up cypress locally and allow you to view the current test suite, as well as start writing new tests.

Building best practices

As much as possible, build from a user's perspective. Use .within cypress command as needed to scope a command within a specific element (e.g. table, nav).

As much as possible, assert that the code is only selecting 1 item or that the final assertion is the appropriate count.

Prioritization of selecting elements

  1. By element tag using elements (e.g. buttons), we can target text within. Confirm what the user is seeing with target text. If this is not specific enough, add on Role.
  2. By role using default or explicitly assigned roles of elements. If this is not specific enough, add on element class.
  3. By element class is least preferred as it does not follow a user's perspective. Occasionally this may be the only option. If that is the case, prioritize using the class name that specifies what the element is doing.

Resources