Client

To Initialize a python client for camelQA, you must pass in an API key and optional parameters. Note that parameters differ based on implementation.

// Set the bundle ID of the app you'd like to test
let app = XCUIApplication(bundleIdentifier: "com.toyopagroup.picaboo")
app.launch()

let q = QamlClient(
    apiKey: "<API_KEY>", 
    app: "<APP_INSTANCE>", 
    useAccessibilityElements: <BOOL, default = true>
)

app

This is the bundleID of the app you’d like to launch. Note you can still switch between apps by using switchToApp or openURL.

useAccessibilityElements

Tests executed in XCUITest can utilize accessibility labels. Setting this to true leverages accessibility and setting this to false disables the feature.

Actions

execute

This is the main way you interact with qaml. Give a natural language command and it will execute the command.

try await q.execute("swipe down")
try await q.execute("tap the search bar")

Nothing is returned. A QAMLExecException will be thrown if it is unable to execute the command.

assert_condition

This is how you tell qaml to verify something without taking any action. assert_condition takes a screenshot of the current screen and runs it through GPT-4o against your prompt and returns a pass or fail.

try await q.execute("type camelqa.com")
try await q.assert_condition("camelqa.com is shown")
try await q.execute("tap go")
try await q.assert_condition("loading screen is shown")

Nothing is returned. A QAMLExecException will be thrown if the condition is not met.

wait_until

This calls assert_condition on a loop. This is how you tell qaml to wait until an event occurs (ex. screen has completed loading).

wait_until takes a screenshot of the current screen and runs it through GPT-4o against your prompt and returns a pass or fail until the condition is met or timeout occurs.

try await q.waitUntil(
    condition: <String>, 
    timeout: <TimeInterval> // optional, default is 10 seconds
)

// example:
try await q.waitUntil("Results page has completed loading")

system_prompt

This appends information to the qaml system prompt. Use this to specify details about your app.

q.systemPrompt = "Never scroll down, even if the user asks for it."

switch_to_app

This is how to switch between apps. For iOS, use the bundleID. For Android, use the package ID.

Note: for iOS, you must swtich to an app using this function in order to interact with that app.
try await q.switchToApp(bundleId: "com.apple.mobilesafari")

open_URL

This is how to open a specific URL.

try await q.openURL(url: "https://en.m.wikipedia.org/wiki/Artificial_intelligence")