Reputation: 502
Button Shapes (the accessibility feature) on iOS can be enabled and disabled from the setting app on the simulator. But what if we want to enable and disable it to take snapshots or any other kind of unit test from within XCTestCase
?
It doesn't seem to be a UITrait and has a buttonShapesEnabled
property exposed from UIAccessibility
but how do we change this property from inside a unit test?
Upvotes: 0
Views: 111
Reputation: 209
I would recommend using a UI Test to do this.
Using a UI Test, you could open the settings app and configure this setting by creating an XCUIApplication that targets the Settings app.
XCUIApplication(bundleIdentifier: "com.apple.Preferences")
Then interact with the buttons in Settings to enable/disable button shapes.
You could then launch and interact with your app, using the screenshot() method to take screenshots:
https://developer.apple.com/documentation/xctest/xcuiscreenshotproviding/2897250-screenshot
Upvotes: 1