Add ATT (App Tracking Transparency) Implementation with Comprehensive UI Tests#13
Open
wpinho-branch wants to merge 11 commits intomainfrom
Open
Add ATT (App Tracking Transparency) Implementation with Comprehensive UI Tests#13wpinho-branch wants to merge 11 commits intomainfrom
wpinho-branch wants to merge 11 commits intomainfrom
Conversation
… UI tests This commit adds a complete ATT testing framework to BranchLinkSimulator with: ## New Features - ATTManager: Singleton manager for handling ATT permission requests and status tracking - ATTTestView: SwiftUI view with ATT testing interface and test scenarios - Comprehensive UI test suite with 23 tests covering all ATT functionality ## Test Fixes Fixed 2 failing UI tests to achieve 100% pass rate: 1. testRequestPermissionButtonStateMatchesATTStatus (line 210): - Changed from `isEnabled` to `isHittable` for SwiftUI button state detection - Custom-styled SwiftUI buttons don't reliably report enabled state via `isEnabled` - `isHittable` properly detects interactive state in XCUITest 2. testTestScenariosSectionExists (lines 98-101): - Added additional scroll (`app.swipeUp()`) and wait time - Ensures all 4 scenario elements are visible before assertions - Fixed "Denied" scenario element not found error ## Test Results ✅ All 23 UI tests passing (100% pass rate) ✅ Both previously failing tests now pass ✅ Total test execution time: ~196 seconds ## Files Added - BranchLinkSimulator/ATTManager.swift - BranchLinkSimulator/ATTTestView.swift - BranchLinkSimulatorUITests/ATTTestViewUITests.swift - BranchLinkSimulatorUITests/BranchLinkSimulatorUITests.swift - BranchLinkSimulatorUITests/BranchLinkSimulatorUITestsLaunchTests.swift ## Project Configuration - Updated project.pbxproj to include new files and test targets
- Package.swift: Swift package configuration with Branch SDK dependency - HomeView.swift: Main UI navigation with Settings button - Info.plist: ATT permission description (NSUserTrackingUsageDescription) - ATTBranchIntegrationTests.swift: Integration tests for ATT with Branch SDK - ATTManagerTests.swift: Unit tests for ATTManager singleton These files are required for the ATT feature to build and test correctly.
…oid race conditions with SwiftUI view rendering
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a complete App Tracking Transparency (ATT) testing framework to BranchLinkSimulator with comprehensive UI test coverage and fixes for failing tests.
New Features
ATTManager (BranchLinkSimulator/ATTManager.swift)
ATTTestView (BranchLinkSimulator/ATTTestView.swift)
Comprehensive UI Test Suite (BranchLinkSimulatorUITests/ATTTestViewUITests.swift)
Test Results
✅ All 23 tests passing (100% pass rate)
✅ Both previously failing tests now pass
✅ Total test execution time: ~196 seconds
Test Execution Summary
Previously Failing Tests Now Pass
testRequestPermissionButtonStateMatchesATTStatus- 7.199stestTestScenariosSectionExists- 8.857sFiles Changed
New Files
BranchLinkSimulator/ATTManager.swift- ATT state management singletonBranchLinkSimulator/ATTTestView.swift- SwiftUI ATT testing interfaceBranchLinkSimulatorUITests/ATTTestViewUITests.swift- 23 comprehensive UI testsBranchLinkSimulatorUITests/BranchLinkSimulatorUITests.swift- Base UI test fileBranchLinkSimulatorUITests/BranchLinkSimulatorUITestsLaunchTests.swift- Launch testsModified Files
BranchLinkSimulator.xcodeproj/project.pbxproj- Added new files and test targets to projectTechnical Details
XCUITest Best Practices Applied
isHittableinstead ofisEnabledfor custom-styled SwiftUI buttonswaitForExistence(timeout:)for reliable element queriesATT Authorization States Covered
Testing Instructions
To run the UI tests:
Or run all 23 tests individually in Xcode Test Navigator.
Impact
Checklist
Total test execution time: ~196 seconds
Test success rate: 23/23 (100%)
Previously failing tests fixed: 2/2 (100%)