XCUI overview
This SDK allows you to work with Applitools Eyes using XCUI.
Installation
Using Swift Package Manager
In Xcode, select File > Add Packages... then add the GitHub URL of EyesXCUI:
https://github.com/applitools/eyes-xcui-swift-package.git
Using CocoaPods
Add EyesXCUI
to your podfile:
target ‘YOUR_APPLICATION_TARGET_NAME’ do
target ‘YOUR_UNIT_TESTING_TARGET_NAME’ do
pod 'EyesXCUI'
end
end
Getting started
To get started with this SDK, you need to set the following:
- Applitools API key
- Eyes server URL - Required only if the Eyes server is not deployed on the Eyes public server.
Entering the Applitools API key
To authenticate via the Applitools server and run tests, you need to assign the API key provided from Applitools Eyes to the XCUI Eyes instance. For details how to retrieve your API key, see the Applitools documentation.
let eyes = Eyes()
eyes.apiKey = <API_key>
Eyes server URL
If the Eyes server is not deployed in https://eyes.applitools.com
, you need to assigb the Server URL to the XCUI Eyes instance before running tests.
The server URL of your Applitools Eyes dashboard is in the format https://<MY_COMPANY>.applitools.com
eyes.serverURL = <YOUR_SERVER_URL>
Recommended practice for using the SDK
A test in Applitools Eyes always starts with an eyes.open()
call and ends with eyes.close()
. The steps in the test are calls to eyes.check()
between the eyes.open()
and eyes.close()
calls.
A test is structured as follows:
eyes.open(...)
[step 1]
[step 2]
...
eyes.close()