Usage

You can utilize our our Swift SDK with or without appium. Appium has the advantage that our SDK can interact with the full device, whereas with the XCUITest method we can only interact with the app itself.

  1. Import the GPT Driver pacakge

import gptd_swift

  1. Initialize GPT Driver in the setUp function of an XCTestCase file, and pass the XCUIApplication instance.

DemoUITests.swift
import XCTest
import gptd_swift

@MainActor
final class DemoUITests: XCTestCase {
    
    var app: XCUIApplication!
    var gptDriver: GptDriver!

    override func setUpWithError() throws {
        continueAfterFailure = false
        
        app = XCUIApplication()
        app.launch()
        
        // Init gpt driver by passing the XCUIApplication
        gptDriver = GptDriver(
            apiKey: "TEST_API_KEY",
            nativeApp: app
        )
    }

    override func tearDownWithError() throws {
        app = nil
    }
    
    func testNavigationToSecondScreen() async throws {
        
        try await gptDriver.execute("Tap on the Go to Second Screen button")
        
        try await gptDriver.execute("Check if you can see a screen with a second screen headline")
        
    }
    
}

Last updated