forked from qodo-benchmark/firefox-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix FXIOS-14456 #31308 ⁃ Fix test failing on XCode 26.2 to enable using this version on Bitrise #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tomerqodo
wants to merge
4
commits into
coderabbit_full_base_bugfix_fxios-14456_31308__fix_test_failing_on_xcode_262_to_enable_using_this_version_on_bitrise_pr12
Choose a base branch
from
coderabbit_full_head_bugfix_fxios-14456_31308__fix_test_failing_on_xcode_262_to_enable_using_this_version_on_bitrise_pr12
base: coderabbit_full_base_bugfix_fxios-14456_31308__fix_test_failing_on_xcode_262_to_enable_using_this_version_on_bitrise_pr12
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+73
−67
Open
Bugfix FXIOS-14456 #31308 ⁃ Fix test failing on XCode 26.2 to enable using this version on Bitrise #38
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 0 additions & 25 deletions
25
BrowserKit/Tests/WebEngineTests/Mock/MockWKFrameInfo.swift
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
BrowserKit/Tests/WebEngineTests/Mock/MockWKSecurityOrigin.swift
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
BrowserKit/Tests/WebEngineTests/Utilities/WebKitTestHelpers.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at http://mozilla.org/MPL/2.0/ | ||
|
|
||
| import WebKit | ||
| import XCTest | ||
|
|
||
| /// Provides real `WKFrameInfo` and `WKSecurityOrigin` objects for tests. | ||
| /// These types can no longer be created or mocked safely, as WebKit now requires | ||
| /// fully initialized instances. This helper loads a lightweight `WKWebView` | ||
| /// navigation and captures the frame and origin values that WebKit supplies. | ||
| final class WebKitTestHelpers { | ||
| class FakeWKNavigationDelegate: NSObject, WKNavigationDelegate { | ||
| let expect: XCTestExpectation | ||
| var capturedFrame: WKFrameInfo? | ||
| var capturedOrigin: WKSecurityOrigin? | ||
|
|
||
| init(expect: XCTestExpectation) { self.expect = expect } | ||
|
|
||
| func webView(_ webView: WKWebView, | ||
| decidePolicyFor navigationAction: WKNavigationAction, | ||
| decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { | ||
| let frame = navigationAction.targetFrame | ||
| capturedFrame = frame | ||
| capturedOrigin = frame?.securityOrigin | ||
| decisionHandler(.allow) | ||
| expect.fulfill() | ||
| return | ||
| } | ||
| } | ||
|
|
||
| // Loads a URL in a real WKWebView and returns the first valid | ||
| // WKFrameInfo and WKSecurityOrigin from a navigation action. | ||
| static func captureFrameAndOrigin(for url: URL, timeout: TimeInterval = 3.0) -> (WKFrameInfo, WKSecurityOrigin)? { | ||
| let webView = WKWebView(frame: .zero) | ||
| let expect = XCTestExpectation(description: "capture frame & origin") | ||
|
|
||
| let delegate = FakeWKNavigationDelegate(expect: expect) | ||
| webView.navigationDelegate = delegate | ||
|
|
||
| // load a real https URL (use example.com to be safe) | ||
| webView.load(URLRequest(url: url)) | ||
|
|
||
| let waiter = XCTWaiter.wait(for: [expect], timeout: timeout) | ||
| if let frame = delegate.capturedFrame, let origin = delegate.capturedOrigin { | ||
| return (frame, origin) | ||
| } | ||
| return nil | ||
| } | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 146
🏁 Script executed:
cat -n ./BrowserKit/Tests/WebEngineTests/WKUIHandlerTests.swift | head -100Repository: qodo-benchmark/firefox-ios-combined-coderabbit
Length of output: 4546
Fix expectation fulfillment order (test currently times out).
Line 53 calls
wait(for:)before line 54 callsexpectation.fulfill(), so the wait will never complete and the test will timeout. Move expectation creation before the closure and add fulfillment inside the decision handler.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents