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

[Demo App] Add more UI tests on demo app #154

Open
11 of 15 tasks
pylapp opened this issue Oct 4, 2024 · 0 comments · May be fixed by #197
Open
11 of 15 tasks

[Demo App] Add more UI tests on demo app #154

pylapp opened this issue Oct 4, 2024 · 0 comments · May be fixed by #197
Assignees
Labels
📱 demo app Update of the Demo App

Comments

@pylapp
Copy link
Member

pylapp commented Oct 4, 2024

Description

The demo applicaiton now exposes tokens and renders them.
However lot of UI tests are missing and should be added for eack token section.

The swift-snpashot-testing must be used.

Definition of Done

  • Add UI tests for border (for Orange theme)
  • Add UI tests for border (for Sosh theme)
  • Add UI tests for border (for Inverse theme)
  • Add UI tests for elevation (for Orange theme)
  • Add UI tests for elevation (for Sosh theme)
  • Add UI tests for elevation (for Inverse theme)
  • Add UI tests for opacity (for Orange theme)
  • Add UI tests for opacity (for Sosh theme)
  • Add UI tests for opacity (for Inverse theme)
  • Add UI tests for typography (for Orange theme)
  • Add UI tests for typography (for Sosh theme)
  • Add UI tests for typography (for Inverse theme)
  • Add UI tests for components screen (to ensure it remains empty)
  • Update of course CHANGELOG, documentation if needed, etc.
  • Keep updated the ShowcaseUITestPlan

Other details

Previous tests defined for fake components can be used (not as is and improved of course).
For each tokens groupe, define an XCTestCase file and add as many test functions as tokens and theme combinations. For example, create a OUDSTokensElevationUITests file with 9 x 3 test functions (3 thèmes, 9 tokens).

import OUDSComponents
import OUDSThemesOrange
import OUDSThemesSosh
import OUDSThemesInverse
import SwiftUI
import XCTest

/// Class to make UI tests on the fake component `OUDSFormsTextInput` using the
/// [swift-snapshot-testing](https://github.com/pointfreeco/swift-snapshot-testing) library.
final class OUDSFormsTextInputUITests: XCTestCase {

    // MARK: - Wrapper

    private struct TestFormsTextInput: View {
        @State private var value: String = ""

        var body: some View {
            OUDSFormsTextInput(label: "Some label", hint: "Some hint", placeholder: "Add text here", value: $value)
        }
    }

    // MARK: - Tests

    func testOUDSFormsTextInput_OrangeTheme() {
        Snapshot.assert(TestFormsTextInput().environment(\.theme, OrangeTheme()), testName: "\(#function)OrangeTheme")
    }

    func testOUDSFormsTextInput_SoshTheme() {
        Snapshot.assert(TestFormsTextInput().environment(\.theme, SoshTheme()), testName: "\(#function)SoshTheme")
    }

    func testOUDSFormsTextInput_InverseTheme() {
        Snapshot.assert(TestFormsTextInput().environment(\.theme, InverseTheme()), testName: "\(#function)InverseTheme")
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 demo app Update of the Demo App
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants