This commit is contained in:
RachelElysia 2021-06-14 09:42:56 -04:00 committed by GitHub
parent 35a49ed87e
commit 5e3beb367f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,8 @@ 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 test.
## Bulding best practices
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).
@ -18,7 +18,7 @@ As much as possible, assert that the code is only selecting 1 item or that the f
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. Occassionally this may be the only option. If that is the case, prioritize using the class name that specifies what the element is doing.
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
- [Fleet testing documentation](https://github.com/fleetdm/fleet/blob/main/docs/4-Contribution/2-Testing.md)