Skip to content

Commit 65ef785

Browse files
authored
Merge pull request #19 from a-know/codex/add-maestro-e2e
Add Maestro E2E tests
2 parents a26ea3e + 10a6586 commit 65ef785

26 files changed

Lines changed: 560 additions & 97 deletions

.maestro/README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Maestro E2E tests
2+
3+
These flows exercise Pixela Buttons through the native UI with
4+
[Maestro](https://maestro.mobile.dev/).
5+
6+
## Prerequisites
7+
8+
- Install Maestro: `curl -fsSL "https://get.maestro.mobile.dev" | bash`
9+
- Start one iOS simulator or Android emulator.
10+
- Install and launch the app once with Flutter, or keep `flutter run` attached
11+
while running Maestro.
12+
- Set the simulator/emulator language to Japanese. The flows intentionally use
13+
the Japanese UI text.
14+
15+
## Environment variables
16+
17+
The tests use real Pixela API calls. Do not commit credentials.
18+
19+
The default suite creates one disposable Pixela user, reuses that user through
20+
the login, graph, card, recording, and settings flows, then deletes the user in
21+
the final flow.
22+
23+
User defaults:
24+
25+
- `PIXELA_E2E_USERNAME`: disposable user name for the full suite. If you use
26+
`scripts/maestro_test.sh`, a unique default is generated.
27+
- `PIXELA_E2E_TOKEN`: token for the disposable user. If you use
28+
`scripts/maestro_test.sh`, a unique default is generated.
29+
30+
Legacy aliases:
31+
32+
- `PIXELA_E2E_NEW_USERNAME` and `PIXELA_E2E_NEW_TOKEN` are still accepted by
33+
`scripts/maestro_test.sh` when `PIXELA_E2E_USERNAME` and
34+
`PIXELA_E2E_TOKEN` are not set.
35+
36+
Optional defaults:
37+
38+
- `PIXELA_E2E_BAD_USERNAME`: defaults to `pixela-buttons-invalid-user`
39+
- `PIXELA_E2E_BAD_TOKEN`: defaults to `invalid-token-for-maestro`
40+
- `PIXELA_E2E_GRAPH_ID`: defaults to a unique `mb<timestamp>` value in
41+
`scripts/maestro_test.sh`
42+
- `PIXELA_E2E_GRAPH_NAME`: defaults to `Maestro Graph`
43+
- `PIXELA_E2E_GRAPH_UNIT`: defaults to `count`
44+
- `PIXELA_E2E_CARD_NAME`: defaults to `Maestro Card`
45+
- `PIXELA_E2E_FLOW_DELAY_SECONDS`: seconds to wait between flows in the default
46+
local suite. Defaults to `5` to reduce accidental Pixela rate limiting.
47+
48+
## Run
49+
50+
```bash
51+
scripts/maestro_test.sh
52+
```
53+
54+
To run a single flow:
55+
56+
```bash
57+
scripts/maestro_test.sh .maestro/flows/03_login_success.yaml
58+
```
59+
60+
## Local CI helper
61+
62+
GitHub Actions does not run the full Maestro suite because iOS simulator and
63+
XCTest driver behavior on hosted runners has been unstable for these flows.
64+
Run the suite locally before releases or when touching registration, login,
65+
graph, card, reminder, settings, or account-deletion behavior.
66+
67+
For local iOS verification, build the simulator app and run:
68+
69+
```bash
70+
scripts/maestro_ci.sh
71+
```
72+
73+
The local suite creates a disposable Pixela user and deletes it in the final
74+
flow. If the run is cancelled before the final flow, the temporary Pixela user
75+
may remain and should be cleaned up manually.
76+
77+
## Notes
78+
79+
- The default `scripts/maestro_test.sh` run executes the numbered flows in
80+
order. The suite is intentionally order-dependent.
81+
- `01_register_new_user.yaml` creates `PIXELA_E2E_USERNAME`.
82+
- `04_create_graph.yaml` creates a real Pixela graph for that user. Use a fresh
83+
`PIXELA_E2E_GRAPH_ID` for each full run.
84+
- `11_delete_account.yaml` deletes `PIXELA_E2E_USERNAME`, then verifies the
85+
deleted user cannot log in.
86+
- If the suite stops before `11_delete_account.yaml`, the disposable Pixela user
87+
and graph may remain and should be cleaned up manually.
88+
- Notification permission text is OS-controlled. The reminder flow verifies
89+
the app reaches the reminder creation path and looks for a Japanese
90+
notification permission dialog.

.maestro/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flows:
2+
- flows/*.yaml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "01 - Register a new Pixela user"
3+
---
4+
- launchApp:
5+
clearState: true
6+
- tapOn: "アカウントをお持ちでない方はこちら"
7+
- assertVisible: "新規登録"
8+
- tapOn: "username"
9+
- inputText:
10+
text: ${PIXELA_E2E_USERNAME}
11+
waitToSettleTimeoutMs: 1000
12+
- tapOn: "token"
13+
- inputText:
14+
text: ${PIXELA_E2E_TOKEN}
15+
waitToSettleTimeoutMs: 1000
16+
- tapOn:
17+
id: "agree_terms_checkbox"
18+
- tapOn:
19+
id: "not_minor_checkbox"
20+
- tapOn: "登録する"
21+
- extendedWaitUntil:
22+
visible: "Pixela Buttons"
23+
timeout: 20000
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "02 - Reject invalid login credentials"
3+
---
4+
- launchApp:
5+
clearState: true
6+
- tapOn: "username"
7+
- inputText:
8+
text: ${PIXELA_E2E_BAD_USERNAME}
9+
waitToSettleTimeoutMs: 1000
10+
- tapOn: "はじめる"
11+
- assertVisible: "入力してください"
12+
- assertVisible: "username"
13+
- assertNotVisible: "ボタンを追加"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "03 - Login with valid credentials"
3+
---
4+
- runFlow: _helpers/login_registered_user.yaml
5+
- assertVisible: "ボタンを追加"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "04 - Create a graph from the graph list"
3+
---
4+
- tapOn:
5+
text: "戻る"
6+
optional: true
7+
- tapOn: "グラフ\nタブ: 2/3"
8+
- tapOn:
9+
id: create_graph_button
10+
- assertVisible: "グラフを作成"
11+
- tapOn: "グラフID *"
12+
- inputText:
13+
text: ${PIXELA_E2E_GRAPH_ID}
14+
waitToSettleTimeoutMs: 1000
15+
- tapOn: "グラフ名 *"
16+
- inputText:
17+
text: ${PIXELA_E2E_GRAPH_NAME}
18+
waitToSettleTimeoutMs: 1000
19+
- tapOn: "単位 *"
20+
- inputText:
21+
text: ${PIXELA_E2E_GRAPH_UNIT}
22+
waitToSettleTimeoutMs: 1000
23+
- tapOn: "作成"
24+
- extendedWaitUntil:
25+
visible: ".*${PIXELA_E2E_GRAPH_NAME}.*"
26+
timeout: 20000

.maestro/flows/05_graph_list.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "05 - Show graphs belonging to the logged-in user"
3+
---
4+
- runFlow: _helpers/login_registered_user.yaml
5+
- tapOn: "グラフ\nタブ: 2/3"
6+
- extendedWaitUntil:
7+
visible: ".*${PIXELA_E2E_GRAPH_NAME}.*"
8+
timeout: 15000
9+
- assertVisible: ".*${PIXELA_E2E_GRAPH_ID}.*"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "06 - Add a new button card from the home screen"
3+
---
4+
- tapOn:
5+
text: "戻る"
6+
optional: true
7+
- tapOn:
8+
text: "戻る"
9+
optional: true
10+
- tapOn: "ホーム\nタブ: 1/3"
11+
- runFlow: _helpers/create_card_for_registered_graph.yaml
12+
- assertVisible: ".*${PIXELA_E2E_CARD_NAME}.*"
13+
- assertVisible: "カスタム"
14+
- assertVisible: "+1"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "07 - Record a custom value from a card"
3+
---
4+
- runFlow: _helpers/create_card_for_registered_graph.yaml
5+
- tapOn: "カスタム"
6+
- assertVisible: "カスタム値を入力"
7+
- tapOn: ${PIXELA_E2E_GRAPH_UNIT}
8+
- inputText:
9+
text: "2"
10+
waitToSettleTimeoutMs: 1000
11+
- tapOn: "記録"
12+
- extendedWaitUntil:
13+
visible: "記録しました"
14+
timeout: 20000
15+
- tapOn:
16+
text: "OK"
17+
optional: true

.maestro/flows/08_logout.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
appId: ${MAESTRO_APP_ID}
2+
name: "08 - Logout from settings"
3+
---
4+
- runFlow: _helpers/login_registered_user.yaml
5+
- tapOn: "設定\nタブ: 3/3"
6+
- tapOn: "ログアウト"
7+
- assertVisible: "ログアウト"
8+
- tapOn:
9+
text: "ログアウト"
10+
index: 1
11+
- extendedWaitUntil:
12+
visible: "アカウントをお持ちでない方はこちら"
13+
timeout: 10000

0 commit comments

Comments
 (0)