Skip to content

Commit 4425a47

Browse files
authored
Bugfix #31040 ⁃ Fix testOnboardingCard_viewDidAppear_viewSendsCardView failing test on iOS 17.5 (#31047)
Call manually to viewDidAppear on iOS 18 and above
1 parent 3cf6c04 commit 4425a47

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

firefox-ios/firefox-ios-tests/Tests/ClientTests/OnboardingTests/OnboardingTelemetryDelegationTests.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ class OnboardingTelemetryDelegationTests: XCTestCase {
3131
XCTFail("expected a view controller, but got nothing")
3232
return
3333
}
34-
firstVC.viewDidAppear(true)
34+
35+
// On iOS 17 and earlier, the system already triggers a viewDidAppear call,
36+
// so calling it manually would cause the expected count to fail.
37+
// In iOS 18 and later, this behavior changed and we must call viewDidAppear manually.
38+
if #available(iOS 18, *) {
39+
firstVC.viewDidAppear(true)
40+
}
3541

3642
try testEventMetricRecordingSuccess(metric: GleanMetrics.Onboarding.cardView)
3743
}

0 commit comments

Comments
 (0)