Skip to content

Commit

Permalink
Add Testing folder in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vgarciabnz committed Jun 21, 2024
1 parent d5ff559 commit 3e87d92
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
id: getting-started
title: Getting started
sidebar_position: 1
---

# DHIS2 Mobile UI

> **@dhis2/dhis2-mobile-ui** is
Expand Down
2 changes: 2 additions & 0 deletions docs/testing/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
position: 2
label: 'Testing'
21 changes: 21 additions & 0 deletions docs/testing/recomposition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
id: recomposition
title: Recomposition
sidebar_position: 1
---

# Recomposition

The Compose Compiler plugin can generate reports / metrics around certain compose-specific concepts
that can be useful to understand what is happening with some of your compose code at a fine-grained
level.
You can read more about
it [here](https://github.com/androidx/androidx/blob/androidx-main/compose/compiler/design/compiler-metrics.md).

To generate the reports / metrics, run the following Gradle command

```shell
./gradlew assembleDebug -PenableComposeCompilerReports=true
```

This would generate the output at `<module>/build/compose_metrics`.
50 changes: 50 additions & 0 deletions docs/testing/screenshot-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
id: screenshot-testing
title: Screenshot testing
sidebar_position: 2
---

# Screenshot Testing

We are using [Paparazzi](https://cashapp.github.io/paparazzi/) for screenshot testing.

## Screenshot testing

```kotlin
class InputChipSnapshotTest {

@get:Rule
val paparazzi = paparazzi()

@Test
fun launchChip() {
paparazzi.snapshot {
ColumnComponentContainer {
InputChip(label = "Label", selected = false, badge = "3")
InputChip(label = "Label", selected = true, badge = "3")
}
}
}
}
```

## Running tests

`./gradlew designsystem:testDebugUnitTest`

Runs tests and generates an HTML report at `/build/reports/paparazzi/` showing all test runs
and snapshots.

## Saving golden images to repo

`./gradlew designsystem:recordPaparazziDebug`

Saves snapshots as golden values to a predefined source-controlled location (defaults to
`/src/test/snapshots`).

## Verifying

`./gradlew designsystem:verifyPaparazziDebug`

Runs tests and verifies against previously-recorded golden values. Failures generate diffs at
`/build/paparazzi/failures`.

0 comments on commit 3e87d92

Please sign in to comment.