pointfreeco / swift-snapshot-testing

📸 Delightful Swift snapshot testing.

Home Page:https://www.pointfree.co/episodes/ep41-a-tour-of-snapshot-testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClearButton from UITextField is not recorded with iOS 17

GHMarcus opened this issue · comments

Describe the bug

Snapshotting a filled UITextField with an iOS 17 Simulator didn't record the ClearButton at the end of the text field anymore.

To Reproduce

  1. Methode:
  • Simply create a single ViewController with an UITextField in it.
  • Set the clearButtonMode from the text field to .always.
  • Write a test for this controller where you first set a value to the text field befor snapshotting it.
  • iOS 16 test devices will capture the filled text field with clear button
  • iOS 17 test devices will capture the filled text field without clear button
  1. Methode:
  • Use the attached sample project where I prepared the test scenario. In this test project there are 4 recorded snapshots. Empty and Filled states for iOS 16 and 17. They are recorded with an iPhone 14 and when you use an iOS 16 iPhone 14 and run all test both will succeed. When you run the tests with an iOS 17 iPhone 14 the second one (FilledAppearance) will fail.
  • TextInputBug.zip

Expected behavior

  • iOS 17 test devices will capture the filled text field with clear button

Environment

  • swift-snapshot-testing version 1.14.2
  • Xcode 15.0.1
  • Swift 5.9
  • OS: iOS 16.4 und iOS 17.0.1

Additional context

Some strange behaviour I ran into when debugging this bug:

  • If you set an breakpoint directly on the snapshotting line of the filled appearance test (in my test project its line 25 in the TextInputBugTests.swift file).
  • Run the tests.
  • After the system stopped at this breakpoint, take a Quick Look at the in the test created ViewController.
  • You will see the correct view with the clear button
  • After continuing the test it will succeed, instead of failing like when you not look at the ViewController