Skip to content

Commit e6e8959

Browse files
authored
feat: add maps navigation example for android yaml (#41)
* feat: add maps navigation example for android yaml * refactor: android folder
1 parent e77279b commit e6e8959

18 files changed

+96
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

android/yaml-scripts-demo/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
output/
2+
package-lock.json
3+
.env
4+
5+
# Midscene.js dump files
6+
midscene_run/report
7+
midscene_run/dump
8+
midscene_run/tmp

android/yaml-scripts-demo/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Yaml Scripts
2+
3+
4+
## Preparation
5+
6+
create `.env` file
7+
8+
```shell
9+
# replace by your gpt-4o own
10+
OPENAI_API_KEY="YOUR_TOKEN"
11+
```
12+
13+
Refer to this document if your want to use other models like Qwen: https://midscenejs.com/choose-a-model
14+
15+
## Install
16+
17+
Ensure that Node.js is installed. Install the `@midscene/cli` globally
18+
19+
```shell
20+
npm i -g @midscene/cli
21+
```
22+
23+
## Run
24+
25+
Run all scripts
26+
27+
> For windows, you need to replace `./` with `.\`, like `midscene .\midscene-scripts\`.
28+
29+
```shell
30+
midscene ./midscene-scripts/
31+
```
32+
33+
Maps navigation demo
34+
35+
```shell
36+
midscene ./midscene-scripts/maps-navigation.yaml
37+
```
38+
39+
Twitter auto-like demo
40+
41+
```shell
42+
midscene ./midscene-scripts/twitter-auto-like.yaml
43+
```
44+
45+
Perform a search on ebay.com
46+
47+
```shell
48+
midscene ./midscene-scripts/search-headphone-on-ebay.yaml
49+
```
50+
51+
# Reference
52+
53+
https://midscenejs.com/automate-with-scripts-in-yaml.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Midscene.js dump files
3+
midscene_run/report
4+
midscene_run/dump
5+
midscene_run/tmp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# search headphone on ebay, extract the items info into a json file, and assert the shopping cart icon
2+
3+
android:
4+
# launch: https://www.ebay.com
5+
deviceId: s4ey59ytbitot4yp
6+
7+
tasks:
8+
- name: travel
9+
flow:
10+
- aiAction: open Maps app
11+
- aiAction: input 'attractions' in the search bar, and click the search button
12+
- aiAction: click the first search result, enter the attraction details page
13+
- aiAction: click "Directions" button, enter the route planning page
14+
- aiAction: click "Start" button to start navigation
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "yaml-scripts-demo",
3+
"private": true,
4+
"version": "1.0.0",
5+
"description": "> quick start",
6+
"main": "index.js",
7+
"type": "module",
8+
"scripts": {
9+
"test": "midscene ./midscene-scripts"
10+
},
11+
"author": "",
12+
"license": "MIT",
13+
"devDependencies": {
14+
"@midscene/cli": "latest"
15+
}
16+
}

0 commit comments

Comments
 (0)