appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
71 lines • 3.47 kB
TypeScript
import type { XCUITestDriver } from '../driver';
import type { XCTestResult, RunXCTestResult } from './types';
import type { StringRecord } from '@appium/types';
import type IDB from 'appium-idb';
/**
* Asserts that IDB is present and that launchWithIDB was used.
*
* @param opts - Opts object from the driver instance
* @returns The IDB instance
* @throws {Error} If IDB is not available or launchWithIDB is not enabled
*/
export declare function assertIDB(this: XCUITestDriver, opts: XCUITestDriver['opts']): IDB;
/**
* Parse the stdout of XC test log.
*
* @param stdout - A line of standard out from `idb xctest run ...`
* @returns The final output of the XCTest run
*/
export declare function parseXCTestStdout(stdout: string): XCTestResult[] | string[];
/**
* Error thrown when XCTest subprocess returns non-zero exit code.
*/
export interface XCUITestError extends Error {
code: number;
signal?: string;
result?: XCTestResult[];
}
/**
* Run a native XCTest script.
*
* Launches a subprocess that runs the XC Test and blocks until it is completed. Parses the stdout of the process and returns its result as an array.
*
* **Facebook's [IDB](https://github.com/facebook/idb) tool is required** to run such tests; see [the idb docs](https://fbidb.io/docs/test-execution/) for reference.
*
* @param testRunnerBundleId - Test app bundle (e.g.: `io.appium.XCTesterAppUITests.xctrunner`)
* @param appUnderTestBundleId - App-under-test bundle
* @param xcTestBundleId - XCTest bundle ID
* @param args - Launch arguments to start the test with (see [reference documentation](https://developer.apple.com/documentation/xctest/xcuiapplication/1500477-launcharguments))
* @param testType - XC test type
* @param env - Environment variables passed to test
* @param timeout - Timeout (in ms) for session completion
* @returns The array of test results
* @throws {XCUITestError} Error thrown if subprocess returns non-zero exit code
*/
export declare function mobileRunXCTest(this: XCUITestDriver, testRunnerBundleId: string, appUnderTestBundleId: string, xcTestBundleId: string, args?: string[], testType?: 'app' | 'ui' | 'logic', env?: StringRecord, timeout?: number): Promise<RunXCTestResult>;
/**
* Installs an XCTest bundle to the device under test.
*
* **Facebook's [IDB](https://github.com/facebook/idb) tool is required** for this command to work.
*
* @param xctestApp - Path of the XCTest app (URL or filename with extension `.app`)
*/
export declare function mobileInstallXCTestBundle(this: XCUITestDriver, xctestApp: string): Promise<void>;
/**
* List XCTest bundles that are installed on the device.
*
* **Facebook's [IDB](https://github.com/facebook/idb) tool is required** for this command to work.
*
* @returns List of XCTest bundles (e.g.: `XCTesterAppUITests.XCTesterAppUITests/testLaunchPerformance`)
*/
export declare function mobileListXCTestBundles(this: XCUITestDriver): Promise<string[]>;
/**
* List XCTests in a test bundle.
*
* **Facebook's [IDB](https://github.com/facebook/idb) tool is required** for this command to work.
*
* @param bundle - Bundle ID of the XCTest
* @returns The list of xctests in the test bundle (e.g., `['XCTesterAppUITests.XCTesterAppUITests/testExample', 'XCTesterAppUITests.XCTesterAppUITests/testLaunchPerformance']`)
*/
export declare function mobileListXCTestsInTestBundle(this: XCUITestDriver, bundle: string): Promise<string[]>;
//# sourceMappingURL=xctest.d.ts.map