Reproduction for long-press, drag & hold bug in XCUITest API.

Overview

XCUITest Bug Reproduction

press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)

Reproduction for long-press, drag & hold bug in XCUITest API.

Description

This API of XCUITest isn't working as expected, and this repo (demo application and UI test) reproduces the bug. Apple Documentation: https://developer.apple.com/documentation/xctest/xcuicoordinate/3551692-press

func press(
  forDuration duration: TimeInterval, 
  thenDragTo otherCoordinate: XCUICoordinate, 
  withVelocity velocity: XCUIGestureVelocity, 
  thenHoldForDuration holdDuration: TimeInterval
)

The Bug

When using the above API with a non-zero holdDuration value, there is no effect, and no long press (A.K.A. "hold") is made at the end of the dragging.

The Expected Behaviour

This is when I'm dragging my element manually (works as expected, the label changes its value to "Success!"):

Video.mp4

Download from here: Video.mp4

The Existing Behaviour

This test (here):

func testLongPressDragAndHold() throws {
  let app = XCUIApplication()
  app.launch()

  let button = app.buttons["button"]
  XCTAssert(button.waitForExistence(timeout: 5))

  let label = app.staticTexts["label"]
  XCTAssert(label.exists)

  button.press(forDuration: 1, thenDragTo: label, withVelocity: .default, thenHoldForDuration: 2)

  // The following assertion fails with the message:
  // XCTAssertEqual failed: ("Hold 1 second") is not equal to ("Success!")
  XCTAssertEqual(label.label, "Success!")
}

Results with an assertion error (XCTAssertEqual failed: ("Hold 1 second") is not equal to ("Success!")) when running on iPhone Simulator.

Visually, this happens:

UITests-Video.mp4

Download from here: UITests-Video.mp4

You may clone this repo, and execute the reproduction test from this file: XCUITestBugReproductionUITests/XCUITestBugReproductionUITests.swift

You might also like...
Aardvark is a library that makes it dead simple to create actionable bug reports.
Aardvark is a library that makes it dead simple to create actionable bug reports.

Aardvark Aardvark makes it dead simple to create actionable bug reports. Aardvark is made up of a collection of frameworks that provide different bug

Flexible bug report framework for iOS
Flexible bug report framework for iOS

Clue is a simple smart-bug report framework for iOS, which allows your users to record full bug/crash report and send it to you as a single .clue file

Describing a bug with Sheet and Menu
Describing a bug with Sheet and Menu

MenuTest Describing a bug with Sheet and Menu This repository is related to a question in Apples developers forum, with id: 692338 Dismiss via Button

Two Label Spacer Bug With SwiftUI

TwoLabelSpacerBugSwiftUI // This makes me feel like a fool. NavigationLink(destination: Text("destination")) { Text("\(Image(systemName: "text.align

Navigator.mediaDevices.getUserMedia bug on xcode13

capacitor-getusermedia-test navigator.mediaDevices.getUserMedia bug on xcode13 This App displays when build with xcode12.5.1 a camera stream. There wi

Steps and files needed to reproduce a CSP bug in Safari Web Extensions

CSP Safari bug repro There appears to be a discrepancy between how Safari handles CSP policies for extension pages compared to how other browsers do s

MacOS scrollview nsview scrollbar bug demo

macOS SwiftUI ScrollView Scrollbar Bug Demo If you create a ScrollView that contains an NSView that intersects the scroll view's scrollbars, the scrol

A longstanding annoying bug in our beloved operating system macOS

Houston There is a longstanding annoying bug in our beloved operating system macOS. If you open an application while Mission Control is active, the ap

Demonstrates a memory leak bug SwiftUI's toolbar APIs exhibit on macOS

Mac SwiftUI Toolbar Memory Leak Demo On Big Sur (macOS 11), SwiftUI's APIs for adding toolbar items to a window have (at least) two bugs around view r

Project describes UILabel bug with lineBreakingMode
Project describes UILabel bug with lineBreakingMode

UILabel-LineBreak-Bug This project demonstrates the problem with .lineBreakMode of UILabel in iOS 15.2. This issue is reproduced only in iOS 15.2 and

Buglife-iOS - Awesome bug reporting for iOS apps
Buglife-iOS - Awesome bug reporting for iOS apps

Buglife is an awesome bug reporting SDK & web platform for iOS apps. Here's how it works: User takes a screenshot, or stops screen recording User anno

Simply, Logify provides instant colorful logs to improve log tracking and bug tracing
Simply, Logify provides instant colorful logs to improve log tracking and bug tracing

Logify Simply, Logify provides instant colorful logs to improve log tracking and bug tracing. Why I need to use Logify? As discussed before in a lot o

A tester tool for the bug PoC released by Synacktiv for 15.0 - 15.4 beta 3

SploitTest A tester tool for the bug PoC released by Synacktiv for 15.0 - 15.4 beta 3 iOS 15.4 patched a kernel vulnerability introduced in iOS 15.0 b

In-app feedback and bug reporting tool for apps.

Instabug iOS SDK Instabug is an in-app feedback and bug reporting tool for mobile apps. With just a simple shake, your users or beta testers can repor

POC for a bug with react-native-webview crashing on IOS 16.1

POC Shared Worker issues with IOS 16.1 webview Apple Developers post with workaround Webkit confirmed issue Start a simple http server with shared wor

This component allows for the transfer of data items between collection views through drag and drop
This component allows for the transfer of data items between collection views through drag and drop

Drag and Drop Collection Views Written for Swift 4.0, it is an implementation of Dragging and Dropping data across multiple UICollectionViews. Try it

Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop
Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

Stock is a MacOS menu bar app that helps you quickly save a web link, a file link, or a text by using drag and drop

MacOS app which allows drag and drop of images to BLE thermal printers
MacOS app which allows drag and drop of images to BLE thermal printers

Print2BLE Copyright (c) 2021 BitBank Software, Inc. Written by Larry Bank [email protected] What is it? This project is a MacOS GUI applicatio

A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Owner
Asaf Korem
Asaf Korem
Matthew Asaminew 0 Jan 25, 2022
📺 A tvOS button which truncates long text with '... More'.

TvOSMoreButton ?? A tvOS button which truncates long text with '... More'. The TvOSMoreButton is a simple view which aims to mirror the behavior of Ap

Chris Goldsby 56 Oct 27, 2022
iOS15 UIRefreshControl issue reproduction

iOS15 UIRefreshControl issue reproduction

Muukii 2 Oct 8, 2021
A fitness application using swift which can help user to hold a better sleep

Natcap - Good for your sleep This is a fitness application which can help user to hold a better sleep which depends on their previous sleeping habit.

Mill 0 Dec 13, 2021
A simple cache that can hold anything, including Swift items

CacheIsKing CacheIsKing is a simple cache that allows you to store any item, including objects, pure Swift structs, enums (with associated values), et

Christopher Luu 13 Jan 22, 2018
A calculator for your Apple Watch but only if you have fingers small enough to press the buttons.

AppleWatchCalculator A calculator for your Apple Watch but only if you have fingers small enough to press the buttons. A very simple calculator on you

Patrick Balestra 148 Dec 21, 2022
The "Ask Me" is simple iOS application which shows answer on the screen everytime when the user press the ask button

The "Ask Me" is simple iOS application which shows answer on the screen everytime when the user press the ask button. This application is build and design by Chetan Parate using Xcode and Swift.

Chetan Parate 0 Oct 27, 2021
Swift Playgrounds for interacting with Collected.Press

CollectedSwiftPlaygrounds Swift Playgrounds for interacting with Collected.Press WebSocket Client Connects via a WebSocket to https://collected.press

Royal Icing 1 Oct 24, 2022
Butterfly is a lightweight library for integrating bug-report and feedback features with shake-motion event.

Butterfly is a lightweight library for integrating bug-report and feedback features with shake-motion event. Goals of this project One of th

Zigii Wong 410 Sep 9, 2022
Awesome bug reporting for iOS apps

Buglife is an awesome bug reporting SDK & web platform for iOS apps. Here's how it works: User takes a screenshot, or stops screen recording User anno

Buglife 498 Dec 17, 2022