Skip to content

Commit

Permalink
Add wiki documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Oct 12, 2021
1 parent 6201574 commit 6716e63
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions wiki/cypress-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,19 @@ To track what Cypress is doing while running tests, you can pass in `--config vi
Failing screenshot artifacts (as well as Cypress logs) are generated by our Jenkins CI.

TODO: Instructions on where to click to see the relevant artifact(s)/screenshots

## Code coverage

Cypress has been configured to automatically output Cypress code coverage to the `reports/cypress-coverage` folder. If you would prefer to turn this off locally, you can add the `--env coverage=false` flag when running your your cypress commands.

To view the generated HTML reports, you can either drag the `reports/cypress-coverage/index.html` file into a browser window, or in a terminal, run `open reports/cypress-coverage/index.html` from the EUI project root.

### Combined Jest & Cypress code coverage

If you're working on a component that has both Cypress and Jest tests, we have a command that allows you to combine the results of both coverage reports.

1. Setup: On the component(s) you're looking for final coverage #s for,
- Ensure you have already run `yarn test-unit --coverage` to generate a Jest report
- Ensure you have already run `yarn test-cypress` to generate a Cypress report
2. Run `yarn combine-test-coverage`
- This should automatically open a browser window with `reports/combined-coverage/index.html`
10 changes: 10 additions & 0 deletions wiki/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,13 @@ Component mocking relies on using the `[name].testenv.*` namespace for identific
### Mapping all module exports

The rendered output of a mocked component is at the author's discretion, however, all public exports from a module must be preserved in the mock file. Note that this does not apply to exported TypeScript types and interfaces, which will always be derived from the original component file.

## Code coverage

Jest code coverage reports can be generated by running `yarn test` or `yarn test-unit` with the `--coverage` flag. Generated HTML reports are output to the `reports/` folder.

To view them, you can either drag the `reports/jest-coverage/index.html` file into a browser window, or in a terminal, run `open reports/jest-coverage/index.html` from the EUI project root.

We currently do not use code coverage %s in CI for automated checks or reports. Code coverage is a tool intended to help devs quickly find lines/branches that still need to be covered and determine test cases to write.

> If you're working on a component that has both Cypress and Jest tests, see the [Cypress testing doc](cypress-testing.md#code-coverage) and its code coverage section for instructions on how to get a combined code coverage report.

0 comments on commit 6716e63

Please sign in to comment.