generated from StanfordBDHG/TemplateApplication
-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI test, add docs, and improve error handling
- Loading branch information
1 parent
7e70b18
commit b5570ca
Showing
6 changed files
with
153 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// This source file is part of the Stanford Spezi Template Application open-source project | ||
// | ||
// SPDX-FileCopyrightText: 2024 Stanford University | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
enum LogManagerError: Error { | ||
/// Throw when the log store is invalid | ||
case invalidLogStore | ||
/// Throw when the bundle identifier is invalid | ||
case invalidBundleIdentifier | ||
} | ||
|
||
extension LogManagerError: CustomStringConvertible { | ||
public var description: String { | ||
switch self { | ||
case .invalidLogStore: | ||
return "The OSLogStore is invalid." | ||
case .invalidBundleIdentifier: | ||
return "The bundle identifier is invalid." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// This source file is part of the Stanford Spezi Template Application open-source project | ||
// | ||
// SPDX-FileCopyrightText: 2024 Stanford University | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import OSLog | ||
import XCTest | ||
import XCTestExtensions | ||
import XCTHealthKit | ||
import XCTSpeziAccount | ||
import XCTSpeziNotifications | ||
|
||
class LogViewerTests: XCTestCase { | ||
@MainActor | ||
override func setUp() async throws { | ||
continueAfterFailure = false | ||
|
||
let app = XCUIApplication() | ||
app.launchArguments = ["--skipOnboarding"] | ||
app.launch() | ||
} | ||
|
||
|
||
@MainActor | ||
func testLogViewer() throws { | ||
let app = XCUIApplication() | ||
|
||
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 2.0)) | ||
|
||
sleep(2) | ||
|
||
XCTAssertTrue(app.navigationBars.buttons["Your Account"].waitForExistence(timeout: 6.0)) | ||
app.navigationBars.buttons["Your Account"].tap() | ||
|
||
XCTAssertTrue(app.buttons["View Logs"].waitForExistence(timeout: 2.0)) | ||
app.buttons["View Logs"].tap() | ||
|
||
XCTAssertTrue(app.staticTexts["Log Viewer"].waitForExistence(timeout: 2.0)) | ||
|
||
XCTAssertTrue(app.staticTexts["No Logs Available"].waitForExistence(timeout: 5.0)) | ||
} | ||
} |