Skip to content

Commit 75ac4d2

Browse files
test: Restructure Maestro tests for easy config management (#6613)
Co-authored-by: Rohit Bansal <[email protected]>
1 parent 982a7bc commit 75ac4d2

20 files changed

+100
-90
lines changed

.maestro/README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,41 @@
33
## Overview and Folder Structure
44

55
```
6-
|-- .maestro
7-
|-- helpers
8-
| |-- setup.yaml
9-
| |-- launch-app.yaml
10-
| |-- navigate-to-login.yaml
11-
|-- onboarding
12-
| |-- login.yaml
13-
| |-- register.yaml
14-
| |-- workspace.yaml
15-
|-- more-tests
16-
| |-- test-1.yaml
17-
| |-- test-2.yaml
18-
| |-- test-3.yaml
19-
└── scripts
20-
├── data-setup.js
21-
├── data.js
22-
├── e2e_account.js
23-
└── random.js
6+
/.maestro
7+
├── helpers
8+
│ └── <global utility subflows>
9+
├── scripts
10+
│ └── <javascript test helpers>
11+
├── tests
12+
│ ├── onboarding
13+
│ │ ├── login
14+
│ │ │ ├── login.yaml
15+
│ │ │ └── <other tests>
16+
│ │ └── other subfeature
17+
│ │ └── <other tests>
18+
│ ├── teams
19+
│ │ ├── utils
20+
│ │ │ └── <utility subflows>
21+
│ │ └── <teams tests>
22+
│ └── other feature
23+
│ ├── feature-test-1.yaml
24+
│ └── feature-test-2.yaml
25+
└── config.yaml
2426
```
2527

2628
## Folders
2729

2830
### `helpers`
31+
2932
- Contains shared functions, YAML templates, or parameterized actions that can be reused across multiple flows
3033
- Use this to avoid repeating common UI navigation or setup steps in different test files
3134

3235
### `scripts`
36+
3337
Contains the scripts that are going to be executed by the flows before running the tests:
3438

3539
#### `data.js`
40+
3641
- Contains seeds to common test data, like server url, public channels, etc
3742
- Currently we point to https://mobile.rocket.chat as main server
3843
- Pointing to a local server is not recommended yet, as you would need to create a few public channels and change some permissions
@@ -41,31 +46,40 @@ Contains the scripts that are going to be executed by the flows before running t
4146
- It's hard to keep track of where each value is used
4247

4348
#### `e2e_account.js`
49+
4450
- Contains user and password with correct permissions on main server
4551
- Check `e2e_account.example.js` for structure
4652
- It needs to be added manually on local (it's already set on CI)
4753

54+
### `tests`
55+
56+
Contains anything Maestro should actually run and treat as "a test".
57+
4858
## Prerequisites
4959

5060
Before running Maestro tests, you need to have your app running. You have two options:
5161

5262
### Option 1: Use Release Build (Recommended)
63+
5364
Create a release version APK or IPA file and install it on your device/simulator.
5465

5566
**Note**: It's good practice to use the release version for E2E testing as it closely matches the production environment.
5667

5768
#### Android Production Build
69+
5870
```bash
5971
./gradlew bundleOfficialRelease
6072
```
6173

6274
#### iOS Production Build (Simulator)
75+
6376
Build Experimental app for Simulator:
6477
```bash
6578
bundle exec fastlane build_experimental_simulator
6679
```
6780

6881
### Option 2: Development Build
82+
6983
Start the app in development mode:
7084
```bash
7185
yarn android # for Android
@@ -83,4 +97,4 @@ maestro test .maestro
8397

8498
# Test a specific file
8599
maestro test .maestro/tests-folder-1/login.yaml
86-
```
100+
```

.maestro/config.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
appId: chat.rocket.reactnative
22
flows:
3-
- onboarding/*
4-
- onboarding/login/*
5-
- onboarding/register/*
6-
- onboarding/workspace/*
7-
- teams/*
3+
- tests/**
84
excludeTags:
95
- 'util'

.maestro/onboarding/change-password.yaml renamed to .maestro/tests/onboarding/change-password.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
appId: chat.rocket.reactnative
22
name: Required Password Change
33
onFlowStart:
4-
- runFlow: '../helpers/setup.yaml'
4+
- runFlow: '../../helpers/setup.yaml'
55
- evalScript: ${output.createdUser = output.utils.createUserWithPasswordChange()}
66
onFlowEnd:
77
- evalScript: ${output.utils.deleteCreatedUsers()}
88

99
---
10-
- runFlow: ../helpers/launch-app.yaml
10+
- runFlow: ../../helpers/launch-app.yaml
1111
- runFlow:
12-
file: ../helpers/login.yaml
12+
file: ../../helpers/login.yaml
1313
env:
1414
USERNAME: ${output.createdUser.username}
1515
PASSWORD: ${output.createdUser.password}
@@ -38,9 +38,9 @@ onFlowEnd:
3838
id: change-password-view-set-new-password-button
3939
- assertVisible:
4040
id: rooms-list-view
41-
- runFlow: ../helpers/logout.yaml
41+
- runFlow: ../../helpers/logout.yaml
4242
- runFlow:
43-
file: ../helpers/login.yaml
43+
file: ../../helpers/login.yaml
4444
env:
4545
USERNAME: ${output.createdUser.username}
4646
PASSWORD: 123456

.maestro/onboarding/forgot-password.yaml renamed to .maestro/tests/onboarding/forgot-password.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
appId: chat.rocket.reactnative
22
name: Forgot Password
33
onFlowStart:
4-
- runFlow: '../helpers/setup.yaml'
4+
- runFlow: '../../helpers/setup.yaml'
55
- evalScript: ${output.createdUser = output.utils.createUser()}
66

77
---
8-
- runFlow: ../helpers/launch-app.yaml
9-
- runFlow: ../helpers/navigate-to-login.yaml
8+
- runFlow: ../../helpers/launch-app.yaml
9+
- runFlow: ../../helpers/navigate-to-login.yaml
1010
- tapOn:
1111
id: 'login-view-forgot-password'
1212
- extendedWaitUntil:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
appId: chat.rocket.reactnative
22
name: Legal
33
onFlowStart:
4-
- runFlow: '../helpers/setup.yaml'
4+
- runFlow: '../../helpers/setup.yaml'
55

66
---
7-
- runFlow: '../helpers/launch-app.yaml'
8-
- runFlow: '../helpers/navigate-to-workspace.yaml'
7+
- runFlow: '../../helpers/launch-app.yaml'
8+
- runFlow: '../../helpers/navigate-to-workspace.yaml'
99
- assertVisible:
1010
id: 'login-view-more'
1111
- tapOn:
1212
id: 'login-view-more'
1313
- assertVisible:
1414
id: 'legal-view'
15-
- runFlow: ../helpers/go-back.yaml
15+
- runFlow: ../../helpers/go-back.yaml
1616
- scrollUntilVisible:
1717
element:
1818
text: 'Create an account'

.maestro/onboarding/login/invalid-credentials.yaml renamed to .maestro/tests/onboarding/login/invalid-credentials.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
appId: chat.rocket.reactnative
22
name: Login (Invalid Credentials)
33
onFlowStart:
4-
- runFlow: '../../helpers/setup.yaml'
4+
- runFlow: '../../../helpers/setup.yaml'
55
onFlowEnd:
66
- evalScript: ${output.utils.deleteCreatedUsers()}
77

88
---
9-
- runFlow: ../../helpers/launch-app.yaml
10-
- runFlow: ../../helpers/navigate-to-login.yaml
9+
- runFlow: ../../../helpers/launch-app.yaml
10+
- runFlow: ../../../helpers/navigate-to-login.yaml
1111
- tapOn:
1212
id: 'login-view-email'
1313
- inputText: 'someusername'

.maestro/onboarding/login/login.yaml renamed to .maestro/tests/onboarding/login/login.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
appId: chat.rocket.reactnative
22
name: Login
33
onFlowStart:
4-
- runFlow: ../../helpers/setup.yaml
4+
- runFlow: ../../../helpers/setup.yaml
55
- evalScript: ${output.createdUser = output.utils.createUser()}
66
onFlowComplete:
77
- evalScript: ${output.utils.deleteCreatedUsers()}
88

99
---
10-
- runFlow: ../../helpers/launch-app.yaml
11-
- runFlow: ../../helpers/navigate-to-login.yaml
10+
- runFlow: ../../../helpers/launch-app.yaml
11+
- runFlow: ../../../helpers/navigate-to-login.yaml
1212
- tapOn:
1313
id: 'login-view-email'
1414
- inputText: ${output.createdUser.email}

.maestro/onboarding/register/create-account.yaml renamed to .maestro/tests/onboarding/register/create-account.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
appId: chat.rocket.reactnative
22
name: Create Account
33
onFlowStart:
4-
- runFlow: '../../helpers/setup.yaml'
4+
- runFlow: '../../../helpers/setup.yaml'
55
- evalScript: ${output.user = output.randomUser()}
66

77
---
8-
- runFlow: ../../helpers/launch-app.yaml
9-
- runFlow: ../../helpers/navigate-to-register.yaml
8+
- runFlow: ../../../helpers/launch-app.yaml
9+
- runFlow: ../../../helpers/navigate-to-register.yaml
1010
- tapOn:
1111
id: register-view-name
1212
- inputText: ${output.user.name}

.maestro/onboarding/register/email-used.yaml renamed to .maestro/tests/onboarding/register/email-used.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
appId: chat.rocket.reactnative
22
name: Create Account (Email Already Used)
33
onFlowStart:
4-
- runFlow: '../../helpers/setup.yaml'
4+
- runFlow: '../../../helpers/setup.yaml'
55
- evalScript: ${output.user = output.utils.createUser()}
66

77
---
8-
- runFlow: ../../helpers/launch-app.yaml
9-
- runFlow: ../../helpers/navigate-to-register.yaml
8+
- runFlow: ../../../helpers/launch-app.yaml
9+
- runFlow: ../../../helpers/navigate-to-register.yaml
1010
- tapOn:
1111
id: register-view-name
1212
- inputText: ${output.user.name}

.maestro/onboarding/register/username-used.yaml renamed to .maestro/tests/onboarding/register/username-used.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
appId: chat.rocket.reactnative
22
name: Create Account (Username Already Used)
33
onFlowStart:
4-
- runFlow: '../../helpers/setup.yaml'
4+
- runFlow: '../../../helpers/setup.yaml'
55
- evalScript: ${output.user = output.utils.createUser()}
66

77
---
8-
- runFlow: ../../helpers/launch-app.yaml
9-
- runFlow: ../../helpers/navigate-to-register.yaml
8+
- runFlow: ../../../helpers/launch-app.yaml
9+
- runFlow: ../../../helpers/navigate-to-register.yaml
1010
- tapOn:
1111
id: register-view-name
1212
- inputText: ${output.user.name}

0 commit comments

Comments
 (0)