{"id":15018829,"url":"https://github.com/opentmi/stf-appium-python-client","last_synced_at":"2025-10-24T00:31:23.594Z","repository":{"id":46146395,"uuid":"349657904","full_name":"OpenTMI/stf-appium-python-client","owner":"OpenTMI","description":"OpenSTF client with appium for test automation","archived":false,"fork":false,"pushed_at":"2024-03-25T08:56:15.000Z","size":76,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-26T13:46:45.245Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenTMI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-20T07:33:16.000Z","updated_at":"2024-08-01T11:57:22.039Z","dependencies_parsed_at":"2024-03-23T08:33:22.390Z","dependency_job_id":"0b72e97a-9ed2-4916-8a4f-b29aa62b7b60","html_url":"https://github.com/OpenTMI/stf-appium-python-client","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.4137931034482759,"last_synced_commit":"de68a8ace389a08b1a4eeef8f409e450e7946962"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTMI%2Fstf-appium-python-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTMI%2Fstf-appium-python-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTMI%2Fstf-appium-python-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTMI%2Fstf-appium-python-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenTMI","download_url":"https://codeload.github.com/OpenTMI/stf-appium-python-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867315,"owners_count":16555821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:52:30.727Z","updated_at":"2025-10-24T00:31:23.589Z","avatar_url":"https://github.com/OpenTMI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## OpenSTF+Appium Client for test automation\n\n[![Unit tests](https://github.com/OpenTMI/stf-appium-python-client/actions/workflows/test.yml/badge.svg)](https://github.com/OpenTMI/stf-appium-python-client/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/OpenTMI/stf-appium-python-client/badge.svg?branch=main\u0026t=CQV17G)](https://coveralls.io/github/OpenTMI/stf-appium-python-client?branch=main)\n[![PyPI version](https://badge.fury.io/py/stf-appium-client.svg)](https://badge.fury.io/py/stf-appium-client)\n\nLibrary provides basic functionality for test automation which allows allocating\nphone from [STF](https://github.com/DeviceFarmer/stf) server using [python stf-client](https://pypi.org/project/stf-client/), initialise adb connection to it and \nstart [appium][https://github.com/appium/python-client] server for it.\n\nBasic idea is to run tests against remote openstf device farm with minimum\nrequirements.\n\n\n### Flow\n```mermaid\nsequenceDiagram\n    participant C as User\n    participant A as stf-appium-client\n    participant B as STF(device)\n    C-\u003e\u003eA: allocation_context(requirements, wait_timeout, timeout, shuffle)\n    A-\u003e\u003eB: Find suitable device\n    A-\u003e\u003eB: allocate device\n    A-\u003e\u003eB: remoteConnect\n    A-\u003e\u003eB: ADB Connection\n    A-\u003e\u003eA: Start AppiumServer(ADB)\n    A-\u003e\u003eA: Start AppiumClient(AppiumServer)\n    A-\u003e\u003eC: AppiumClient(AppiumServer(ADB))\n    C-\u003e\u003eA: Run Appium Tests\n```\n\n\n### Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.\n\n### Prerequisites\n* openstf server and access token \n* python \u003e=3.9\n* adb\n* appium (`npm install appium`)\n  Library expects that appium is located to PATH\n  * appium 2 (`npm install appium@next`)\n    * remember to install appium drivers, e.g. `appium driver install uiautomator2`\n  * appium 1\n  * note that appium server and client need to be compatible with each other!\n    * see compatibility matrix from [python-client readme](https://github.com/appium/python-client?tab=readme-ov-file#compatibility-matrix)\n  \n### Installing\n\n* `pip install stf-appium-client`\n  \nor for development purpose:\n\n* `pip install -e .`\n\n### Running the tests\n\n`make test`\n\nCI runs tests against following environments:\n\n|      | ubuntu-latest | macos-latest | windows-latest |\n|------| ------------- | ------------- | ------------- |\n| 3.7  | ✓  | ✓  | ✓  |\n| 3.8  | ✓  | ✓  | ✓  |\n| 3.9  | ✓  | ✓  | ✓  |\n| 3.10 | ✓  | ✓  | ✓  |\n| 3.11 | ✓  | ✓  | ✓  |\n\n### Deployment\n\nThis pip package could be installed together with test framework\nand utilise using CLI interface or via python interface. \nSee more usage examples below.\n\n### usage\n\n#### Python Library\n\n```\nclient = StfClient(host=environ.get('STF_HOST'))\nclient.connect(token=environ.get('STF_TOKEN'))\n\nwith client.allocation_context(\n        requirements=dict(version='10')) as device:\n    print('phone is now allocated and remote connected')\n    with AdbServer(device['remote_adb_url']) as adb_port:\n        print('adb server started with port: {adb_port}')\n            with AppiumServer() as appium:\n                print(\"Phone is ready for test automation..\")\n                # appium is running and ready for usage\n                with AppiumClient() as driver:\n                   print(driver)\n```\n\nSee examples from [examples](examples) -folder.\n\n##### Logging\n\nLibrary utilise python native logging module. Logger name is `StfAppiumClient`. \nBy default it configure default console handler for logger with `INFO` level.\n`STF_APPIUM_LOGGING` env variable can be used to use `DEBUG` logging level.\nIf any handlers for this logger is configured before `StfClient` instance \ncreation no default handlers are added.\n\n#### CLI\n\n```shell script\nstf --token 123456 --requirements \"{\\\"version\\\": \\\"9\\\"}\" \"echo $DEV1_SERIAL\"\n```\n\nCall robot framework\n```shell script\nstf --token 123456 --requirements \"{\\\"version\\\": \\\"9\\\"}\" \"robot phone/suite\" \n```\n\n\n```shell script\n$ stf --help\nusage: stf [-h] --token TOKEN [--host HOST] [--requirements R] [--list]\n           [command [command ...]]\n\nSTF client with appium.\n\nTool allocate phone, create adb and appium server and \ncall user given command with generated env variables:\nDEV1_ADB_PORT      ADB PORT that appium utilize.\nDEV1_APPIUM_HOST   appium host where user given command can connect, e.g. robot framework\nDEV1_SERIAL        device details..\nDEV1_VERSION\nDEV1_REQUIREMENTS  user given requirements\nDEV1_INFO          phone details\n\nExample: stf --token 123 -- echo \\$DEV1_SERIAL\n\n\npositional arguments:\n  command           Command to be execute during device allocation\n\noptional arguments:\n  -h, --help          show this help message and exit\n  --token TOKEN       openstf access token\n  --host HOST         openstf host\n  --list              list only requirements, filtered on given requirements\n  --requirements R    requirements as json string\n  --timeout t         allocation timeout\n  --wait_timeout w    max wait time for suitable device allocation\n  --verbose           appium logs to console. WARNING: this mix console prints\n  --appium-logs file  appium logs to file\n\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentmi%2Fstf-appium-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentmi%2Fstf-appium-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentmi%2Fstf-appium-python-client/lists"}