Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed May 22, 2024
1 parent c4f80ff commit 5d83b75
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ runner.iterate() // 🏃
- Add example project (See TabNav-project, playlist-project, UITesting-project) 👈👈👈
- Maybe add ideas from AccessRunner project, might have advanced ways of doing things etc 👈
- Maybe use semaphore to make async -> sync ? 👈
- Clean up UITestSugar
- Create a test project in SwiftUI
14 changes: 7 additions & 7 deletions Sources/TestRunner/SceneRunner+Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Foundation
*/
extension SceneRunner {
/**
* Call this to begin iterating over the scenes.
* - Description: This function will keep iterating until all scenes have been iterated over.
* - Remark: It uses recursion to iterate over the scenes. If there is a next scene, it initializes and runs it.
* - Remark: If there are no more scenes, it calls the complete function to signal that all scenes have been run.
* Call this to begin iterating over the scenes
* - Description: This function will keep iterating until all scenes have been iterated over
* - Remark: It uses recursion to iterate over the scenes. If there is a next scene, it initializes and runs it
* - Remark: If there are no more scenes, it calls the complete function to signal that all scenes have been run
*/
public func iterate() {
// Check if there is a next scene
Expand All @@ -22,10 +22,10 @@ extension SceneRunner {
}
/**
* Run a scene
* - Description: This function takes a scene of type SceneKind and calls its run function.
* It is used in the iterate function to run each scene.
* - Description: This function takes a scene of type SceneKind and calls its run function
* It is used in the iterate function to run each scene
* - Parameters:
* - scene: The scene to run, of type `SceneKind`.
* - scene: The scene to run, of type `SceneKind`
*/
public func run(scene: SceneKind) {
scene.run() // Call the run function of the scene
Expand Down
6 changes: 3 additions & 3 deletions Sources/TestRunner/SceneRunner+Create.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Foundation
#if canImport(XCTest)
import XCTest
/**
* Extending SceneRunner to include testing functionalities
* Extending `SceneRunner` to include testing functionalities
*/
extension SceneRunner {
/**
* This function is very convenient when testing scenes. It creates only one reference to the app,
* which is necessary for the tests to work correctly.
* which is necessary for the tests to work correctly
*
* - Remark: Every call to `XCUIApplication` creates a new instance of this object. This is why the `XCUIApplication`
* object is created at the beginning of the test and stored in the `app` variable. This ensures that we are working
Expand All @@ -19,7 +19,7 @@ extension SceneRunner {
@objc open func createXCUIApp() -> XCUIApplication {
let app: XCUIApplication = .init() // Creates a new instance of XCUIApplication
app.launch() // launches it
return app // and returns it.
return app // and returns it
}
}
// - Fixme: ⚠️️ We could enhance this by launching the app with a specific bundleID.
Expand Down
4 changes: 2 additions & 2 deletions Sources/TestRunner/SceneRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Iterator
#if canImport(XCTest) // Conditional import for XCTest
import XCTest
/**
* `SceneRunner` is a class that plays through scenes like a playlist.
* `SceneRunner` is a class that "plays" through scenes like a playlist.
* It is a subclass of `ArrayIterator` with `SceneKind.Type` as the generic parameter.
* It also conforms to `SceneRunnerKind` protocol.
*
Expand All @@ -31,7 +31,7 @@ open class SceneRunner: ArrayIterator<SceneKind.Type>, SceneRunnerKind {
public var complete: Completed
/**
* Initiate the scene-runner
* - Fixme: ⚠️️ Add support for launchOptions as well?
* - Fixme: ⚠️️ Add support for launchOptions as well? Might not need it, explore further
* - Parameters:
* - sequence: An array of scenes (to be played out)
* - onComplete: A callback that notifies the user when the sequence has completed
Expand Down
10 changes: 5 additions & 5 deletions Sources/TestRunner/protocol/SceneKind.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Foundation
/**
* The SceneKind protocol represents a scene in the application.
* - Abstract: A scene is a self-contained unit of functionality that can be run by the SceneRunner.
* - Description: This is particularly useful in the context of UI testing where you need to interact with the app's UI elements.
* - Note: This extension is only available when XCTest can be imported, i.e., in a testing context.
* - Abstract: A scene is a self-contained unit of functionality that can be run by the `SceneRunner`
* - Description: This is particularly useful in the context of UI testing where you need to interact with the app's UI elements
* - Note: This extension is only available when `XCTest` can be imported, i.e., in a testing context
*/
public protocol SceneKind {
/**
Expand All @@ -15,8 +15,8 @@ public protocol SceneKind {
*/
func run()
/**
* Initializes a new instance of the SceneKind protocol.
* - Parameter sceneRunner: The SceneRunner responsible for running this scene.
* Initializes a new instance of the `SceneKind` protocol
* - Parameter sceneRunner: The `SceneRunner` responsible for running this scene
*/
init(sceneRunner: SceneRunnerKind)
}
2 changes: 1 addition & 1 deletion Sources/TestRunner/protocol/SceneRunnerKind.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
#if canImport(XCTest)
import XCTest
/**
* Public protocol that defines the requirements for a SceneRunner.
*/
Expand Down
4 changes: 3 additions & 1 deletion TestRunnerApp/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import UIKit

/**
* - Fixme: ⚠️️ add more doc
*/
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var window: UIWindow? = {
Expand Down

0 comments on commit 5d83b75

Please sign in to comment.