AutoVidSDK is a specialized Swift library designed to transform standard UI tests into "Cinematic" productions. It extends XCTest with human-like interactions, smooth animations, and directorial controls, making it perfect for generating high-quality App Store Previews, marketing videos, and demo clips directly from your UI tests.
- Cinematic Interactions: tap, type, drag, and scroll with human-like timing and smoothness.
- Director Mode: Organize your test execution into "Scenes" for better pacing and log readability.
- Smooth Scrolling: Custom
slowSwipemethods to replace jerky standard swipes, creating a natural feel. - Smart Waiting: Built-in
waitToReadmethods to give viewers time to digest content on screen. - Reliability: built-in
waitForExistencechecks to reduce flakiness during recording sessions.
Add AutoVidSDK to your Package.swift dependencies:
dependencies: [
.package(url: "https://github.com/stevenselcuk/AutoVidSDK.git", from: "1.0.0")
],
targets: [
.target(
name: "YourAppUITests",
dependencies: ["AutoVidSDK"]
)
]Or add it via Xcode:
- File > Add Packages...
- Enter the URL of this repository.
- Add it to your UI Testing Bundle target.
- Import the SDK in your UI Test file.
- Use
AutoVidDirectorto manage the flow. - Replace standard interactions (e.g.,
.tap()) with cinematic ones (e.g.,.humanTap()).
import XCTest
import AutoVidSDK
final class AppStorePreviewTests: XCTestCase {
@MainActor
func testAppPreviewFlow() throws {
let app = XCUIApplication()
// 1. Start the Production (Launches app & prepares for recording)
AutoVidDirector.startProduction(app: app)
// 2. Define a Scene
AutoVidDirector.scene("Onboarding Flow") {
// Use human-like typing
let nameField = app.textFields["NameInput"]
nameField.humanTap()
nameField.humanType("John Doe", speed: 0.15)
// Use smooth button presses
app.buttons["Continue"].humanTap()
}
// 3. Navigate with smooth scrolling
AutoVidDirector.scene("Explore Feed") {
// Swipes slowly to show content
app.slowSwipeUp(duration: 2.0)
// Pause to let the viewer read
AutoVidDirector.waitToRead(seconds: 1.5)
}
// 4. Wrap up
AutoVidDirector.wrapProduction()
}
}The AutoVidDirector class acts as the coordinator for your recording session.
startProduction(app: XCUIApplication): Launches the app and waits for the initial animation to settle.scene(_ name: String, action: () -> Void): Wraps a block of interactions logic into a named "Scene". Adds logs and pauses for pacing.waitToRead(seconds: TimeInterval): pauses execution explicitly to allow viewers to read text on the screen.wrapProduction(): Finalizes the recording session with a closing delay to avoid abrupt cuts.announce(_ text: String): Logs a director's announcement (useful for debugging flow).
Standard XCUIElement methods are extended for smoother visual results.
humanTap(): Waits for existence, ensures hit-ability (scrolls if needed), pauses briefly, and then taps.humanType(_ text: String, speed: TimeInterval = 0.12): Taps the element and types text character-by-character with a natural delay.longPressAndHold(duration: TimeInterval = 1.0): Performs a long press action.
slowSwipeUp(duration: TimeInterval = 2.0): Smoothly scrolls up.slowSwipeDown(duration: TimeInterval = 2.0): Smoothly scrolls down.slowSwipeLeft(duration: TimeInterval = 2.0): Smoothly scrolls left.slowSwipeRight(duration: TimeInterval = 2.0): Smoothly scrolls right.cinematicDrag(to dest: XCUIElement, duration: TimeInterval = 1.0, velocity: XCUIGestureVelocity = .default): Drags an element to another element's position smoothly.
preciseSliderAdjustment(toNormalizedValue value: CGFloat, duration: TimeInterval = 1.0): Adjusts a slider to a specific value over a set duration, avoiding "jumping".simulateOrientationChange(to orientation: UIDeviceOrientation): Rotates the device and waits for the UI to adapt.
- Pacing is Key: Use
waitToReadliberally. Viewers need time to process what they see. - Break it Down: Use
sceneblocks to logically separate parts of your flow. It makes the test code easier to read and maintain. - Hide the Status Bar: For professional App Store previews, remember to clean up the status bar (full battery, 9:41 time) using
xcrun simctl status_barcommands before running your test. - Use Accessibility Identifiers: Ensure your UI elements have
.accessibilityIdentifierset in your main app code for reliable finding.
See the example mock app for more details. https://github.com/stevenselcuk/AutoVidMockApp
This SDK is available under the MIT license. See the LICENSE file for more info.