Skip to content

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

ex = CustomAppiumConnection(
    'https://emcee.cloud/api/v1/wd/hub',
)
driver = webdriver.Remote(ex, options=options, direct_connection=False)

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

ClientConfig config = ClientConfig.defaultConfig()
            .baseUrl(new URL("https://emcee.cloud/api/v1/wd/hub"))
            .withFilter(
                    new AddEmceeCookie("{YOUR_EMCEE_API_TOKEN}")
            );

AppiumDriver driver = new AndroidDriver(config, capabilities);

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);
Or implement your own retries as Filter and pass it using 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) ✅

If you need other versions please contact us.

Capabilities:

{
  "appium:app": "{URL_TO_YOUR_APP_BINARY}",
  "browserName": "android",
  "browserVersion": "12.0"
}

iOS#

We currently support:

device/os 16.4 17.2
iPhone 12 ✅
iPhone 14 ✅ ✅

If you need other versions or devices please contact us.

Capabilities:

{
  "appium:app": "{URL_TO_YOUR_APP_BINARY}",
  "browserName": "iPhone 14",
  "browserVersion": "16.2"
}

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.