Repository navigation
fix(ios): ignore marker long presses on Apple Maps #201
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
Aaqibhafeezkhan
wants to merge
1
commit into
gmi-software:main
Choose a base branch
from
Aaqibhafeezkhan:fix/apple-marker-long-press
base: main
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.
+396
−5
Open
Changes from all commits
Commits
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
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
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
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
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
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,34 @@ | ||
| import markerRed from '../assets/markerred.png'; | ||
| import type { MapScenario } from './types'; | ||
|
|
||
| export const MARKER_DRAG_REGRESSION_SCENARIO_ID = 'marker-drag-regression'; | ||
|
|
||
| export const markerDragRegressionScenario: MapScenario = { | ||
| id: MARKER_DRAG_REGRESSION_SCENARIO_ID, | ||
| name: 'Marker drag regression', | ||
| description: 'Simulator test fixture for pin and image marker dragging', | ||
| region: { | ||
| latitude: 52.2297, | ||
| longitude: 21.0122, | ||
| latitudeDelta: 0.08, | ||
| longitudeDelta: 0.08, | ||
| }, | ||
| markers: [ | ||
| { | ||
| id: 'pin', | ||
| coordinate: { latitude: 52.2201, longitude: 20.9962 }, | ||
| title: 'Draggable pin', | ||
| draggable: true, | ||
| enteringAnimation: false, | ||
| }, | ||
| { | ||
| id: 'image', | ||
| coordinate: { latitude: 52.2201, longitude: 21.0282 }, | ||
| title: 'Draggable image', | ||
| image: markerRed, | ||
| anchor: { x: 0.5, y: 1 }, | ||
| draggable: true, | ||
| enteringAnimation: false, | ||
| }, | ||
| ], | ||
| }; |
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,68 @@ | ||
| import XCTest | ||
|
|
||
| final class MarkerDragUITests: XCTestCase { | ||
| private var app: XCUIApplication! | ||
|
|
||
| override func setUpWithError() throws { | ||
| continueAfterFailure = false | ||
| app = XCUIApplication() | ||
| app.launch() | ||
| } | ||
|
|
||
| func testDraggingPinAndImageMarkersOnlyFiresDragEnd() throws { | ||
| let scenarioButton = app.buttons["Marker drag regression"] | ||
| XCTAssertTrue(scenarioButton.waitForExistence(timeout: 30)) | ||
|
|
||
| let scenarioStrip = app.scrollViews.firstMatch | ||
| for _ in 0..<12 { | ||
| if scenarioButton.isHittable { | ||
| break | ||
| } | ||
| scenarioStrip.swipeLeft() | ||
| } | ||
| XCTAssertTrue(scenarioButton.isHittable) | ||
| scenarioButton.tap() | ||
|
|
||
| let map = app.descendants(matching: .any) | ||
| .matching(identifier: "marker-drag-regression-map") | ||
| .firstMatch | ||
| XCTAssertTrue(map.waitForExistence(timeout: 30)) | ||
|
|
||
| let result = app.staticTexts["marker-drag-verification-status"] | ||
| XCTAssertTrue(result.waitForExistence(timeout: 30)) | ||
| waitForStatus(result, containing: ["pin=0", "image=0", "long=0", "ready=true"]) | ||
|
|
||
| let pin = app.descendants(matching: .any) | ||
| .matching(identifier: "react-native-better-maps.marker.pin") | ||
| .firstMatch | ||
| XCTAssertTrue(pin.waitForExistence(timeout: 30), "The pin annotation must be exposed at its rendered position.") | ||
| XCTAssertTrue(pin.isHittable, "The rendered pin annotation must be hittable.") | ||
| XCTAssertGreaterThan(pin.frame.width, 0) | ||
| XCTAssertGreaterThan(pin.frame.height, 0) | ||
|
|
||
| let pinStart = pin.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) | ||
| let pinEnd = map.coordinate(withNormalizedOffset: CGVector(dx: 0.40, dy: 0.48)) | ||
| pinStart.press(forDuration: 1.0, thenDragTo: pinEnd) | ||
| waitForStatus(result, containing: ["pin=1", "image=0", "long=0"]) | ||
|
|
||
| let image = app.descendants(matching: .any) | ||
| .matching(identifier: "react-native-better-maps.marker.image") | ||
| .firstMatch | ||
| XCTAssertTrue(image.waitForExistence(timeout: 30), "The image annotation must be exposed at its rendered position.") | ||
| XCTAssertTrue(image.isHittable, "The rendered image annotation must be hittable.") | ||
| XCTAssertGreaterThan(image.frame.width, 0) | ||
| XCTAssertGreaterThan(image.frame.height, 0) | ||
|
|
||
| let imageStart = image.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) | ||
| let imageEnd = map.coordinate(withNormalizedOffset: CGVector(dx: 0.60, dy: 0.48)) | ||
| imageStart.press(forDuration: 1.0, thenDragTo: imageEnd) | ||
| waitForStatus(result, containing: ["pin=1", "image=1", "long=0"]) | ||
| } | ||
|
|
||
| private func waitForStatus(_ element: XCUIElement, containing fragments: [String]) { | ||
| let format = fragments.map { "label CONTAINS %@" }.joined(separator: " AND ") | ||
| let predicate = NSPredicate(format: format, argumentArray: fragments) | ||
| let expectation = XCTNSPredicateExpectation(predicate: predicate, object: element) | ||
| XCTAssertEqual(XCTWaiter.wait(for: [expectation], timeout: 20), .completed, element.label) | ||
| } | ||
| } |
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,13 @@ | ||
| # iOS marker-drag UI regression | ||
|
|
||
| This UI test launches the Expo example on an iOS simulator and performs long-press drags on both a MapKit pin annotation and a bundled-image annotation. It verifies that each native drag-end callback is delivered and that the map-level long-press callback count stays at zero. | ||
|
|
||
| Run it on macOS with Xcode and CocoaPods installed: | ||
|
|
||
| ```bash | ||
| bash example/scripts/run-marker-drag-ui-tests.sh | ||
| ``` | ||
|
|
||
| The script runs Expo prebuild, installs pods, adds a generated UI-test target to the ignored Xcode project, and executes the test. The target is generated instead of committed because `example/ios/` is intentionally ignored and recreated by Expo prebuild. | ||
|
|
||
| The same UI test runs on the Apple-provider leg of the native GitHub Actions workflow. |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.