Appium
We also provide appium web server implementation for your tests.
All what you need is access to our API and a few additional settings in your tests.
Common settings#
APPIUM_PORT = 80
APPIUM_HOST = 'http://emcee.cloud/api/v1/wd/hub'
Authorization#
As far as we use cookie with API token for authorization, you need to put this cookie in every request from your Appium client.
Here is an examples of how this can be done with different official appium clients:
Step 1. Implement custom AppiumConnection:
class CustomAppiumConnection(AppiumConnection):
@classmethod
def get_remote_connection_headers(cls, parsed_url: ParseResult, keep_alive: bool = True) -> Dict[str, Any]:
headers = {'cookie': 'emcee_token={YOUR_EMCEE_API_TOKEN}'}
headers.update(super().get_remote_connection_headers(parsed_url, keep_alive))
return headers
Step 2. Pass this connection as executor to your driver
Step 1. Implement custom Client filter
import org.openqa.selenium.remote.http.Filter;
import org.openqa.selenium.remote.http.HttpHandler;
public class AddEmceeCookie implements Filter {
private final String cookie;
public AddEmceeCookie(String cookie) {
this.cookie = cookie;
}
public HttpHandler apply(HttpHandler next) {
return (req) -> {
req.setHeader("Cookie", "emcee_token=" + cookie);
return next.execute(req);
};
}
}
Step 2. Pass this filter to your driver using ClientConfig
Timeouts and Retries#
Session start timeout#
We have global 5 minute timeout
on session creation (including waiting for available resources).
For the best experience, we recommend using Appium clients built-in retries mechanism.
Here is an examples of how this can be done with different official appium clients:
Simply pass additional poll manager parameters
command_executor = CustomAppiumConnection(
f'https://emcee.cloud/api/v1/wd/hub',
keep_alive=True,
init_args_for_pool_manager={
'retries': urllib3.Retry(total=5, status_forcelist=[408, 503, 504], allowed_methods=['POST'])
}
)
driver = webdriver.Remote(command_executor, options=options, direct_connection=False)
You can use built-in retries by adding withRetries
to ClientConfig
ClientConfig config = ClientConfig.defaultConfig()
.baseUrl(new URL("https://emcee.cloud/api/v1/wd/hub"))
.withFilter(
new AddEmceeCookie("{YOUR_EMCEE_API_TOKEN}")
)
.withRetries();
AppiumDriver driver = new AndroidDriver(config, capabilities);
withFilter
IDLE aka newCommandTimeout#
By default, this timeout is set to 2 minutes.
You can increase it by setting appium:newCommandTimeout
capability, but the maximum value cannot exceed 10 minutes.
Application binary#
The path to the application is configured via appium:app
capability.
ex: 'appium:app': 'https://emcee.cloud/api/v1/file/download/123'
The application file must be available for download via a link from a remote service.
For simplicity, we recommend that you upload files to our service and use the links you receive.
But you can also use any other service that meets the requirements: the file is available by direct link and GET method without authorization.
Android#
We use devices with 1080х1920 resolution and 420dpi. Keep this in mind when writing tests.
We currently support:
os | |
---|---|
API 31 (12.0) | |
API 33 (13.0) | |
API 34 (14.0) (default) |
If you need other versions please contact us.
Capabilities:
{
"appium:app": "{URL_TO_YOUR_APP_BINARY}",
"browserName": "android",
"emcee:buildId": "My build ID"
}
If you want to set API version, override following capabilities:
iOS#
We currently support:
device/os | 18.0 | 17.2 |
---|---|---|
iPhone 16 | (default) | |
iPhone 15 | ||
iPhone 14 |
If you need other versions or devices please contact us.
Capabilities:
{
"appium:app": "{URL_TO_YOUR_APP_BINARY}",
"browserName": "iPhone 16",
"emcee:buildId": "My build ID"
}
If you want to set iOS version, override following capabilities (keep in mind table of compatibility above):
Special capabilities#
emcee:buildId
#
When you run tests in multiple threads we automatically group them into 1 run using a number of params such as User-Agent, App URL, IP and so on.
Since automatic grouping may not always work correctly we recommend using a special capability emcee:buildId
.
All sessions with the same emcee:buildId
will be combined in 1 run.
emcee:options
#
This capability allows you to set additional parameters to your test environment.
Currently available parameters:
proxy
(string)
Logs and history#
After the session is completed, all logs as long as capabilities, duration and other useful data are available in the corresponding run. See Special capabilities for more details about how we are grouping sessions into runs.
List of all runs you can find on Test Run History page
Proxy/VPN and your Internal Network#
Warning
Currently, this technology is only available for Android
iOS support will be added soon
Sometimes we need to run tests with non-public resources like staging/non-prod/testing environment which not available from the Internet.
In this case, we provide several solutions:
Appium tariffication#
For billing purposes, we use the time elapsed from the moment Appium session is created to the moment session is deleted.
By default, we use a 2 minutes timeout after which the session will be terminated.
But since this timeout can be controlled client-side, we strongly recommend setting it carefully and correctly terminating the session by calling driver.quit()
or a similar command.
Warning
Note that it may take up to 10 minutes for the session to automatically end after timeout