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

[#154] Add UI-based unit tests for demo application #197

Draft
wants to merge 24 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bb0c1b6
feat : add ouds tokens border ui test
Tayebsed93 Oct 15, 2024
9f012ad
feat : add ouds tokens opacity ui tests
Tayebsed93 Oct 15, 2024
090a4cf
feat : add ouds token elevations ui tests
Tayebsed93 Oct 15, 2024
ea140d6
feat : add ouds tokens dimension ui tests
Tayebsed93 Oct 16, 2024
4ea27bd
feat : add ouds token typography ui tests
Tayebsed93 Oct 16, 2024
3cd101a
feat : add components page ui test
Tayebsed93 Oct 16, 2024
8747e4f
doc : update change log
Tayebsed93 Oct 16, 2024
ed01f16
fix : update component ui test
Tayebsed93 Oct 16, 2024
af93884
fix : podfile version
Tayebsed93 Oct 16, 2024
51118c8
fix : theme support environment
Tayebsed93 Oct 16, 2024
a892635
feat : add ouds token elevations ui tests
Tayebsed93 Oct 15, 2024
6c43703
fix : podfile version
Tayebsed93 Oct 16, 2024
c225b62
review : swift lint corrections applied
Tayebsed93 Oct 17, 2024
dace9f0
review : adjust test class names for dimension
Tayebsed93 Oct 17, 2024
9ac7492
review : adjust test class names for elevation
Tayebsed93 Oct 17, 2024
92f3f24
review : adjust test class names for opacity
Tayebsed93 Oct 17, 2024
102a30d
review : adjust test class names for typography
Tayebsed93 Oct 17, 2024
8013618
fix : delete image snapshots folder
Tayebsed93 Oct 17, 2024
9f5d0d9
review : fix consistency with SwiftLint rules
Tayebsed93 Oct 18, 2024
036afa1
review : removed unrelated code
Tayebsed93 Oct 18, 2024
145546a
review : create documentation ui test snapshot
Tayebsed93 Oct 18, 2024
aa15a4f
review : update DEVELOP.md
Tayebsed93 Oct 18, 2024
4633104
review : fix CHANGELOG order by moving new entry
Tayebsed93 Oct 18, 2024
705e8bf
review : add final keyword to class definitions
Tayebsed93 Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,40 @@ Indeed for new tests the tool makes snapshots of the views, thus for the first r

Such tests here are used to as to be sure the look and feel of any components and tokens rendering remaing the expected ones.

### Steps to Use swift-snapshot-testing

1. Navigate to the Project :
- Open your project in Xcode and go to the directory:
```shell
Showcase -> ShowcaseTests -> OUDSTokensBorderUITests
```
2. Locate Reference Images:
- Inside the `OUDSTokensBorderUITests` folder, you will find the `OrangeTheme` and `InverseTheme` directories. These folders contain the reference screenshots for the Orange and Inverse themes, which will serve as comparison points.
3. Open the Test File:
- Open the file `OUDSTokensBorderUITests.swift`.
4. Run the Snapshot Test:
- Locate and execute the function `testBorderToken_OrangeTheme_SectionWidth_BorderWidthNone_Light()`.
<img width="898" alt="Capture d’écran 2024-10-18 à 16 44 46" src="https://github.com/user-attachments/assets/bc2d6cb4-3854-499a-82b2-6b5676e2505b">

- Running this test will launch the selected simulator and create a new snapshot of the `BorderTokenPage`.
<img width="909" alt="Capture d’écran 2024-10-18 à 16 53 55" src="https://github.com/user-attachments/assets/d07dfc72-1034-4b40-8875-6fff22dad412">

5. Run the Snapshot Test:
- After the snapshot has been generated, re-run the same test after the error indicating that there is no snapshot, so it can use the newly created snapshot as a comparison against the reference image.
<img width="910" alt="Capture d’écran 2024-10-18 à 16 55 15" src="https://github.com/user-attachments/assets/2588e0a5-6571-4049-97dd-c92a92e2a4d2">

6. Verify the Output:
- The test will check the rendered output of the `BorderTokenPage`, which is instantiated with the `Orange theme`:
```swift
BorderTokenPage().environment(\.theme, OrangeTheme())
```
- If the generated screenshot matches the reference image, the test will pass. If they do not match, the test will fail, indicating a discrepancy
7. Verify the Output:
- **Important:** If you change the device or simulator you are using, **delete the snapshots** located in the `__Snapshots__` folder to avoid mismatches:
- Snapshots should **never be committed** to the repository, as they are meant for local testing purposes only
<img width="548" alt="Capture d’écran 2024-10-18 à 17 00 42" src="https://github.com/user-attachments/assets/9e11e225-6218-4cb5-bae1-933d305aefa6">


## Build phases

The project contains several custom build phases so as to automatize several steps:
Expand Down Expand Up @@ -277,4 +311,4 @@ Our currant plan does not allow to make GitHub mirroring, so we use GitHub HTTP
If you want to set up your runners, feel free to have a look on */docs_release/README.md*
However of course you will have to define all the variables, secrets and have the mandatory files listed above.

You can find more details about the pipelines and script [in the wiki](https://github.com/Orange-OpenSource/ouds-ios/wiki/5-%E2%80%90-About-continuous-integration-and-delivery).
You can find more details about the pipelines and script [in the wiki](https://github.com/Orange-OpenSource/ouds-ios/wiki/5-%E2%80%90-About-continuous-integration-and-delivery).
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [DemoApp] Update opacity screen with new design ([#200](https://github.com/Orange-OpenSource/ouds-ios/issues/200))
- [DemoApp] Update opacity screen with new design ([#200](https://github.com/Orange-OpenSource/ouds-ios/issues/200))
- [DemoApp] Add color tokens screen in demo app ([#152](https://github.com/Orange-OpenSource/ouds-ios/issues/152))
- [Library] Add semantic tokens `spacePaddingInlineTallest`, `spacePaddingBlockTallest`, `spaceColumnGapTaller`, `spaceColumnGapWithArrowShortest`, `spaceRowGapShortest` (Figjam final synchronization of October 16th)
- [Library] Add semantic color tokens ([#124](https://github.com/Orange-OpenSource/ouds-ios/issues/124))
- [DemoApp] Add more UI tests on demo app ([#154](https://github.com/Orange-OpenSource/ouds-ios/issues/154))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faut mettre la nouvelle ligne du CHANGELOG en haut de la section appropriée

- [DemoApp] Fix some design issues and mutualize some UI elements ([#189](https://github.com/Orange-OpenSource/ouds-ios/issues/189))
- [DemoApp] Add sizing tokens screen in demo app ([#150](https://github.com/Orange-OpenSource/ouds-ios/issues/150))
- [DemoApp] Add spacing tokens screen in demo app ([#149](https://github.com/Orange-OpenSource/ouds-ios/issues/149))
Expand Down
Loading