Skip to content

Add UI tests#149

Merged
watkyn merged 53 commits intomasterfrom
add-ui-tests
Apr 9, 2026
Merged

Add UI tests#149
watkyn merged 53 commits intomasterfrom
add-ui-tests

Conversation

@watkyn
Copy link
Copy Markdown
Contributor

@watkyn watkyn commented Apr 8, 2026

Adding UI testing in phases

watkyn and others added 30 commits January 29, 2026 16:32
With SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, all types are MainActor
by default. The actor's synchronization purpose (single-flight token
refresh) is now provided by MainActor serialization.

Changes:
- actor NetworkAuthManager → class NetworkAuthManager
- bearerAuthSupported(): drop async (no longer needed without actor)
- basicAuthString(): drop nonisolated (no longer an actor)
- JamfProAPIClient: drop await from bearerAuthSupported() calls
- NetworkAuthManagerTests: drop await from bearerAuthSupported() calls

Side effect: Resolves Token.isValid cross-isolation warning because
Token and NetworkAuthManager are now both on MainActor.

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
With MainActor default isolation, manual dispatch to the main thread
is redundant. All three locations are already MainActor-isolated.

Changes:
- Alert.swift: Remove DispatchQueue.main.async wrapper in display()
- OpenViewController.swift: Remove wrapper in tableView selectionIndexes
- SaveViewController.swift: Remove wrapper in savePressed panel callback

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Replace Task/completion handler pattern with direct async throws methods.

Changes:
- UploadManager.verifyConnection: async throws -> VerificationInfo
- UploadManager.upload: async throws (no completion handler)
- UploadInfoView.verifyConnection: now async, uses try await
- UploadInfoView.performUpload: now async, uses try await
- Button action bridges to async with Task { await ... }

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Replace completion handler pattern with throws -> Executable since the
work is synchronous (reads bundle info and code requirements).

Changes:
- Model.loadExecutable(url:) now throws -> Executable (no completion)
- Remove LoadExecutableCompletion typealias
- findExecutableOnComputerUsing → findExecutable, returns directly
- getExecutableFrom: uses do/catch instead of completion handler
- getAppleEventChoices: uses do/catch for each loadExecutable call
- TCCProfileViewController: promptForExecutables and acceptDrop updated
- OpenViewController.prompt: updated to use try/catch

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Replace completion handler pattern with throws -> TCCProfile since
the work is synchronous (decode data, read file).

Changes:
- TCCProfileImporter.decodeTCCProfile(data:) now throws -> TCCProfile
- TCCProfileImporter.decodeTCCProfile(fileUrl:) now throws -> TCCProfile
- Remove TCCProfileImportCompletion typealias
- TCCProfileConfigurationPanel: uses try/catch in panel callback
- TCCProfileImporterTests: updated to use try/catch pattern

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Mark SecurityWrapper and Model methods with @Concurrent to move disk
I/O and security operations off MainActor onto the cooperative pool.

Changes:
- SecurityWrapper.copyDesignatedRequirement: @Concurrent async throws
- SecurityWrapper.sign: @Concurrent async throws
- SecurityWrapper.loadSigningIdentities: @Concurrent async throws
- Model.loadExecutable: @Concurrent async throws -> Executable
- Model.getAppleEventChoices: now async (calls loadExecutable)
- Model.getExecutableFrom/findExecutable: now async
- Model.getExecutablesFromAllPolicies: now async
- Model.importProfile: now async
- All callers updated to use Task/await where needed
- ModelTests: updated to async test methods

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Flip SWIFT_VERSION from 5.0 to 6.0 so all concurrency warnings become
hard errors. Fix override isolation mismatches.

Changes:
- SWIFT_VERSION = 6.0 in all 4 build configurations
- SaveViewController.observeValue: add nonisolated + MainActor.assumeIsolated
- ModelTests.setUp: add nonisolated + MainActor.assumeIsolated
- Update plan document to reflect all stages complete

Agent-Logs-Url: https://github.com/jamf/PPPC-Utility/sessions/4235dbf5-feb0-4744-839d-543eee3b8ee5

Co-authored-by: watkyn <40115+watkyn@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
watkyn and others added 17 commits April 6, 2026 14:16
Production changes:
- Networking.swift: Add session:URLSession parameter (default .shared),
  replace all 5 URLSession.shared calls with injected session
- JamfProAPIClient.swift: Replace URLSession.shared in HTML version
  fallback with inherited session property
- UploadManager.swift: Add session:URLSession parameter, pass through
  to JamfProAPIClient constructors

Test infrastructure:
- MockURLProtocol: Simple URLProtocol subclass with single static
  requestHandler, URLSession.mock(handler:) convenience, and
  HTTPURLResponse.ok/status helpers
- MockURLProtocolTests: 3 tests verifying interception, error status
  codes, and reset behavior (.serialized suite)

Convention updates:
- CLAUDE.md: Add 'always use Swift Concurrency' rule, update mock
  convention to serialized suites with simple static handler
- docs/plans: Matching updates to Phase 2 & 4 descriptions

No behavioral change — URLSession.shared remains the default for all
production paths. 69 tests pass, no new compiler warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- New UploadManagerTests with verifyConnection tests (mustSign true/false,
  credential errors, unavailability errors) and upload tests verifying
  site XML presence/absence through the full network mock flow
- Expand TCCProfileTests with XML-parsing-based assertions for
  jamfProAPIData structure, site element inclusion, and site exclusion
- 96 tests total, all passing, no new compiler warnings
- App target coverage: 45.03%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@watkyn watkyn requested review from Copilot, jjpritzl and pmoprhy April 8, 2026 20:44
@watkyn watkyn changed the base branch from master to new-testing-plan April 8, 2026 20:45

This comment was marked as resolved.

@watkyn watkyn marked this pull request as ready for review April 9, 2026 15:33
Base automatically changed from new-testing-plan to master April 9, 2026 18:52
@watkyn watkyn merged commit 14b2744 into master Apr 9, 2026
5 checks passed
@watkyn watkyn deleted the add-ui-tests branch April 9, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants