Skip to content

Commit

Permalink
update README.md and doc/*.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Розов Арсений Николаевич committed Oct 13, 2016
1 parent 30487ee commit 5d2c03e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Python utilities for [STF](https://github.com/openstf/stf).

### Features:
* [Connect Android devices](doc/CONNECTOR.md) from your STF instance with one simple command. Useful if you want to use STF with some automation tools (like Appium).
* [Record videos](doc/RECORDER.md) of your automated tests passing.
* [Connect Android devices](doc/STF-CONNECT.md) from your STF instance with one simple command. Useful if you want to use STF with some automation tools (like Appium).
* [Record videos](doc/STF-RECORD.md) of your automated tests passing.
* [Write your own](doc/API.md) python apps using STF API client implementation.

### Prerequisites:
Expand Down
4 changes: 2 additions & 2 deletions doc/API.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## STF API client

[common/stfapi.py](../common/stfapi.py) - Python API for [STF API](https://github.com/openstf/stf/blob/master/doc/API.md)
[stf_utils/common/stfapi.py](../stf_utils/common/stfapi.py) - Python API for [STF API](https://github.com/openstf/stf/blob/master/doc/API.md)

[stf_connect/client.py](../stf_connect/client.py) - Python client for [STF API](https://github.com/openstf/stf/blob/master/doc/API.md)
[stf_utils/stf_connect/client.py](../stf_utils/stf_connect/client.py) - Python client for [STF API](https://github.com/openstf/stf/blob/master/doc/API.md)

Sorry, no documentation here, yet.
28 changes: 18 additions & 10 deletions doc/CONNECTOR.md → doc/STF-CONNECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@
* adb

## Quick start:
1. Install stf-utils:
```shell
pip install git+https://github.com/2gis/stf-utils.git
```
1. Generate OAuth token in web-interface as described [here](https://github.com/openstf/stf/blob/master/doc/API.md#authentication).
2. Edit [config.ini](../config.ini) - fill `OAUTH_TOKEN` and `host` values
2. Specify devices you want to connect by editing `spec.json` (examples below)
2. Run `python connector.py`
2. Create config file `stf-utils.ini`:
```
host = http://<your.stf.domain>
oauth_token = <your OAuth token>
```
2. Specify devices you want to connect by creating `device-spec.json` file (examples below)
2. Run `stf-connect`

`connector.py` will connect and bind devices from your STF instance specified in `spec.json` file.
`stf-connect` will connect and bind devices from your STF instance specified in `device-spec.json` file.

If some device for some reason will disconnect, `connector.py` will try to reconnect it again.
If some device for some reason will disconnect, `stf-connect` will try to reconnect it again.

To release devices binded by `connector.py`, type CTRL+C or kill `connector.py` process.
To release devices binded by `stf-connect`, type CTRL+C or kill `stf-connect` process.

## Examples of `spec.json` file:
## Examples of `device-spec.json` file:
##### Connect all available devices
```json
[
Expand All @@ -26,7 +34,7 @@ To release devices binded by `connector.py`, type CTRL+C or kill `connector.py`
}
]
```
##### Connect one specific device by its serialno (spec.json example)
##### Connect one specific device by its serialno (device-spec.json example)
```json
[
{
Expand Down Expand Up @@ -54,7 +62,7 @@ To release devices binded by `connector.py`, type CTRL+C or kill `connector.py`


### Advanced usage: Use one spec.json for different cases
You can specify several groups in your `spec.json` file and control which groups to connect with `-groups` argument for `connector.py`.
You can specify several groups in your `device-spec.json` file and control which groups to connect with `--groups` argument for `stf-connect`.

For example, you `spec.json` looks like:
```json
Expand Down Expand Up @@ -89,5 +97,5 @@ For example, you `spec.json` looks like:
```
then, if you want only last two groups, you should run:
```shell
python connector.py -groups the_magnificent_armeabi-v7a_seven,unit_test_devices
stf-connect --groups the_magnificent_armeabi-v7a_seven,unit_test_devices
```
19 changes: 9 additions & 10 deletions doc/RECORDER.md → doc/STF-RECORD.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
Connect to "screen streaming service", provided by STF, save screenshots of your Android device, and create a video.

## Save screenshots
- install requirements
- run:
```
pip3 install -r requirements.txt
stf-record --serial="emulator-5555" --dir='test_dir'
```
- run:
or
```
python3 recorder.py -serial="emulator-5555" -dir='test_dir'
python3 recorder.py -ws="127.0.0.1:9000" -dir='test_dir'
stf-record --ws="127.0.0.1:9000" --dir='test_dir'
```
- options:
```
-serial - Device serial for automatic getting websocket url for saving screenshots
-ws - WebSocket URL <host:port> with ws:// or not (required!)
-dir - custom directory for saving screenshots from device (default: ./images )
-log-level - change log level for utility (default: INFO)
-resolution - change resolution of images from device (default: as is)
--serial - Device serial for automatic getting websocket url for saving screenshots
--ws - WebSocket URL <host:port> with ws:// or not (required!)
--dir - custom directory for saving screenshots from device (default: ./images )
--log-level - change log level for utility (default: INFO)
--resolution - change resolution of images from device (default: as is)
```

## Create video
Expand Down

0 comments on commit 5d2c03e

Please sign in to comment.