forked from dsutanto/bChot-android
First Commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
# Maestro
|
||||
|
||||
Maestro is a framework that we are using to test navigation across the application.
|
||||
To setup, please refer at [https://maestro.mobile.dev](https://maestro.mobile.dev)
|
||||
|
||||
<!--- TOC -->
|
||||
|
||||
* [Run test](#run-test)
|
||||
* [Output](#output)
|
||||
* [Write test](#write-test)
|
||||
* [CI](#ci)
|
||||
* [iOS](#ios)
|
||||
* [Future](#future)
|
||||
|
||||
<!--- END -->
|
||||
|
||||
## Run test
|
||||
|
||||
From root dir of the project
|
||||
|
||||
*Note: Since Element X does not allow account creation, we have to use an existing account to run maestro test suite. So to run locally, please replace `user` and `123` with your test matrix.org account credentials, and `my room` with one of a room this account has joined. Note that the test will send messages to this room.*
|
||||
|
||||
```shell
|
||||
maestro test \
|
||||
-e MAESTRO_APP_ID=io.element.android.x.debug \
|
||||
-e MAESTRO_USERNAME=user1 \
|
||||
-e MAESTRO_PASSWORD=123 \
|
||||
-e MAESTRO_RECOVERY_KEY=ABC \
|
||||
-e MAESTRO_ROOM_NAME="MyRoom" \
|
||||
-e MAESTRO_INVITEE1_MXID=user2 \
|
||||
-e MAESTRO_INVITEE2_MXID=user3 \
|
||||
.maestro/allTests.yaml
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
Test result will be printed on the console, and screenshots will be generated at `./build/maestro`
|
||||
|
||||
## Write test
|
||||
|
||||
Tests are yaml files. Generally each yaml file should leave the app in the same screen than at the beginning.
|
||||
|
||||
Start the Element X app and run this command to help writing test.
|
||||
|
||||
```shell
|
||||
maestro studio
|
||||
```
|
||||
|
||||
Note that sometimes, this prevent running the test. So kill the `maestro studio` process to be able to run the test again.
|
||||
|
||||
Also, if updating the application code, do not forget to deploy again the application before running the maestro tests.
|
||||
|
||||
## CI
|
||||
|
||||
The CI is running maestro using the workflow `.github/worflow/maestro.yaml` and [maestro cloud](https://cloud.mobile.dev/). For now we are limited to 100 runs a month.
|
||||
Some GitHub secrets are used to be able to do that: `MAESTRO_CLOUD_API_KEY`, for now api key from `benoitm@element.io` maestro cloud account, and `MATRIX_MAESTRO_ACCOUNT_PASSWORD` which is the password of the account `@maestroelement:matrix.org`. This account contains a room `MyRoom` to be able to run the maestro test suite.
|
||||
|
||||
## iOS
|
||||
|
||||
Need to install `idb-companion` first
|
||||
|
||||
```shell
|
||||
brew install idb-companion
|
||||
```
|
||||
|
||||
Also:
|
||||
https://github.com/mobile-dev-inc/maestro/issues/146
|
||||
https://github.com/mobile-dev-inc/maestro/issues/107
|
||||
So you have to change your input keyboard to QWERTY for it to work properly.
|
||||
|
||||
## Future
|
||||
|
||||
- run on Element X iOS. This is already working but it need some change on the test to make it works. Could pass a PLATFORM parameter to have unique test and use conditional test.
|
||||
- run specific test on both iOS and Android devices to make them communicate together. Could be possible to test room invite and join, verification, call, etc. To be done when Element X will be able to create account and create room. A main script would be able to detect the Android device and the iOS device, and run several maestro tests sequentially, using `--device` parameter to perform a global test.
|
||||
@@ -0,0 +1,10 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
androidWebViewHierarchy: devtools
|
||||
---
|
||||
## Check that all env variables required in the whole test suite are declared (to fail faster)
|
||||
- runScript: ./scripts/checkEnv.js
|
||||
- runFlow: tests/init.yaml
|
||||
- runFlow: tests/account/login.yaml
|
||||
- runFlow: tests/settings/settings.yaml
|
||||
- runFlow: tests/roomList/roomList.yaml
|
||||
- runFlow: tests/account/logout.yaml
|
||||
@@ -0,0 +1,10 @@
|
||||
// This array contains all the required environment variable. When adding a variable, add it here also.
|
||||
// If a variable is missing, an error will occur.
|
||||
|
||||
if (MAESTRO_APP_ID == null) throw "Fatal: missing env variable MAESTRO_APP_ID"
|
||||
if (MAESTRO_USERNAME == null) throw "Fatal: missing env variable MAESTRO_USERNAME"
|
||||
if (MAESTRO_PASSWORD == null) throw "Fatal: missing env variable MAESTRO_PASSWORD"
|
||||
if (MAESTRO_RECOVERY_KEY == null) throw "Fatal: missing env variable MAESTRO_RECOVERY_KEY"
|
||||
if (MAESTRO_ROOM_NAME == null) throw "Fatal: missing env variable MAESTRO_ROOM_NAME"
|
||||
if (MAESTRO_INVITEE1_MXID == null) throw "Fatal: missing env variable MAESTRO_INVITEE1_MXID"
|
||||
if (MAESTRO_INVITEE2_MXID == null) throw "Fatal: missing env variable MAESTRO_INVITEE2_MXID"
|
||||
@@ -0,0 +1,21 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- tapOn:
|
||||
id: "login-change_server"
|
||||
- takeScreenshot: build/maestro/200-ChangeServer
|
||||
- tapOn: "matrix.org"
|
||||
- tapOn:
|
||||
id: "login-change_server"
|
||||
- tapOn: "Other"
|
||||
- tapOn:
|
||||
id: "change_server-server"
|
||||
- inputText: "element"
|
||||
- hideKeyboard
|
||||
- extendedWaitUntil:
|
||||
visible: "element.io"
|
||||
timeout: 10000
|
||||
- tapOn: "element.io"
|
||||
# Revert to matrix.org
|
||||
- tapOn:
|
||||
id: "login-change_server"
|
||||
- tapOn: "matrix.org"
|
||||
@@ -0,0 +1,47 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- tapOn: "Sign in manually"
|
||||
- runFlow: ../assertions/assertLoginDisplayed.yaml
|
||||
- takeScreenshot: build/maestro/100-SignIn
|
||||
- runFlow: changeServer.yaml
|
||||
- runFlow: ../assertions/assertLoginDisplayed.yaml
|
||||
- tapOn:
|
||||
id: "login-continue"
|
||||
## MAS page
|
||||
## Conditional workflow to pass the Chrome first launch welcome page.
|
||||
- runFlow:
|
||||
when:
|
||||
visible: 'Use without an account'
|
||||
commands:
|
||||
- tapOn: "Use without an account"
|
||||
## For older chrome versions
|
||||
- runFlow:
|
||||
when:
|
||||
visible: 'Accept & continue'
|
||||
commands:
|
||||
- tapOn: "Accept & continue"
|
||||
- runFlow:
|
||||
when:
|
||||
visible: 'No thanks'
|
||||
commands:
|
||||
- tapOn: "No thanks"
|
||||
## Working when running Maestro locally, but not on the CI yet.
|
||||
- extendedWaitUntil:
|
||||
visible:
|
||||
id: "form-1"
|
||||
timeout: 10000
|
||||
- tapOn:
|
||||
id: "form-1"
|
||||
- inputText: ${MAESTRO_USERNAME}
|
||||
- pressKey: Enter
|
||||
- tapOn:
|
||||
id: "form-3"
|
||||
- inputText: ${MAESTRO_PASSWORD}
|
||||
- pressKey: Enter
|
||||
- tapOn: "Continue"
|
||||
## Back to native world
|
||||
- runFlow: ../assertions/assertSessionVerificationDisplayed.yaml
|
||||
- runFlow: ./verifySession.yaml
|
||||
- runFlow: ../assertions/assertAnalyticsDisplayed.yaml
|
||||
- tapOn: "Not now"
|
||||
- runFlow: ../assertions/assertHomeDisplayed.yaml
|
||||
@@ -0,0 +1,15 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- tapOn:
|
||||
id: "home_screen-settings"
|
||||
- tapOn: "Sign out"
|
||||
- takeScreenshot: build/maestro/900-SignOutScreen
|
||||
- back
|
||||
- tapOn: "Sign out"
|
||||
# Ensure cancel cancels
|
||||
- tapOn:
|
||||
id: "dialog-negative"
|
||||
- tapOn: "Sign out"
|
||||
- tapOn:
|
||||
id: "dialog-positive"
|
||||
- runFlow: ../assertions/assertInitDisplayed.yaml
|
||||
@@ -0,0 +1,13 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- takeScreenshot: build/maestro/150-Verify
|
||||
- tapOn: "Enter recovery key"
|
||||
- tapOn:
|
||||
id: "verification-recovery_key"
|
||||
- inputText: ${MAESTRO_RECOVERY_KEY}
|
||||
- hideKeyboard
|
||||
- tapOn: "Continue"
|
||||
- extendedWaitUntil:
|
||||
visible: "Device verified"
|
||||
timeout: 30000
|
||||
- tapOn: "Continue"
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: "Help improve Element X dbg"
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: "Chats"
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: "Be in your element"
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: "Change account provider"
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: ${MAESTRO_ROOM_NAME}
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,5 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- extendedWaitUntil:
|
||||
visible: "Confirm your identity"
|
||||
timeout: 20000
|
||||
@@ -0,0 +1,7 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- clearState
|
||||
- launchApp:
|
||||
clearKeychain: true
|
||||
- runFlow: ./assertions/assertInitDisplayed.yaml
|
||||
- takeScreenshot: build/maestro/000-FirstScreen
|
||||
@@ -0,0 +1,15 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
# Purpose: Test the creation and deletion of a DM room.
|
||||
- tapOn: "Create a new conversation or room"
|
||||
- tapOn: "Search for someone"
|
||||
- inputText: ${MAESTRO_INVITEE1_MXID}
|
||||
- tapOn:
|
||||
text: ${MAESTRO_INVITEE1_MXID}
|
||||
index: 1
|
||||
- tapOn: "Send invite"
|
||||
- takeScreenshot: build/maestro/330-createAndDeleteDM
|
||||
- tapOn: "maestroelement2"
|
||||
- scroll
|
||||
- tapOn: "Leave room"
|
||||
- tapOn: "Leave"
|
||||
@@ -0,0 +1,39 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
# Purpose: Test the creation and deletion of a room
|
||||
- tapOn: "Create a new conversation or room"
|
||||
- tapOn: "New room"
|
||||
- tapOn: "e.g. your project name"
|
||||
- inputText: "aRoomName"
|
||||
- tapOn: "What is this room about?"
|
||||
- inputText: "aRoomTopic"
|
||||
- tapOn: "Create"
|
||||
- takeScreenshot: build/maestro/320-createAndDeleteRoom
|
||||
- tapOn: "Search for someone"
|
||||
- inputText: ${MAESTRO_INVITEE1_MXID}
|
||||
- tapOn:
|
||||
text: ${MAESTRO_INVITEE1_MXID}
|
||||
index: 1
|
||||
- tapOn: "Finish"
|
||||
- tapOn: "aRoomName"
|
||||
- tapOn: "Invite"
|
||||
# assert there's 1 member and 1 invitee
|
||||
- tapOn: "Search for someone"
|
||||
- inputText: ${MAESTRO_INVITEE2_MXID}
|
||||
- tapOn:
|
||||
text: ${MAESTRO_INVITEE2_MXID}
|
||||
index: 1
|
||||
- tapOn: "Invite"
|
||||
- tapOn: "Back"
|
||||
- tapOn: "aRoomName"
|
||||
- scrollUntilVisible:
|
||||
direction: DOWN
|
||||
element:
|
||||
text: "People"
|
||||
- tapOn: "People"
|
||||
# assert there's 1 member and 2 invitees
|
||||
- tapOn: "Back"
|
||||
- scroll
|
||||
- scroll
|
||||
- tapOn: "Leave room"
|
||||
- tapOn: "Leave"
|
||||
@@ -0,0 +1,14 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
# Purpose: Test the context menu of a room in the room list
|
||||
- longPressOn: ${MAESTRO_ROOM_NAME}
|
||||
- takeScreenshot: build/maestro/310-RoomList-ContextMenu
|
||||
- tapOn:
|
||||
text: "Settings"
|
||||
index: 0
|
||||
- tapOn: "Back"
|
||||
- longPressOn: ${MAESTRO_ROOM_NAME}
|
||||
- tapOn:
|
||||
text: "Leave room"
|
||||
index: 0
|
||||
- tapOn: "Cancel"
|
||||
@@ -0,0 +1,8 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- runFlow: searchRoomList.yaml
|
||||
- takeScreenshot: build/maestro/300-RoomList
|
||||
- runFlow: timeline/timeline.yaml
|
||||
- runFlow: roomContextMenu.yaml
|
||||
- runFlow: createAndDeleteRoom.yaml
|
||||
- runFlow: createAndDeleteDM.yaml
|
||||
@@ -0,0 +1,18 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- runFlow: ../assertions/assertRoomListSynced.yaml
|
||||
- tapOn: "search"
|
||||
- inputText: ${MAESTRO_ROOM_NAME.substring(0, 3)}
|
||||
- takeScreenshot: build/maestro/400-SearchRoom
|
||||
- tapOn: ${MAESTRO_ROOM_NAME}
|
||||
# Back from timeline to search
|
||||
- back
|
||||
- extendedWaitUntil:
|
||||
visible: ${MAESTRO_ROOM_NAME.substring(0, 3)}
|
||||
timeout: 10000
|
||||
# Back to close the keyboard
|
||||
- back
|
||||
- waitForAnimationToEnd
|
||||
# Back to close the home screen
|
||||
- back
|
||||
- runFlow: ../assertions/assertHomeDisplayed.yaml
|
||||
@@ -0,0 +1,13 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- tapOn: "Start a call"
|
||||
- takeScreenshot: build/maestro/700-Call
|
||||
- extendedWaitUntil:
|
||||
visible: "maestroelement"
|
||||
timeout: 10000
|
||||
- takeScreenshot: build/maestro/710-Call
|
||||
# Hangup
|
||||
- tapOn: "End call"
|
||||
- extendedWaitUntil:
|
||||
visible: "MyRoom"
|
||||
timeout: 10000
|
||||
@@ -0,0 +1,7 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- takeScreenshot: build/maestro/520-Timeline
|
||||
- tapOn: "Add attachment"
|
||||
- tapOn: "Location"
|
||||
- tapOn: "Share my location"
|
||||
- takeScreenshot: build/maestro/521-Timeline
|
||||
@@ -0,0 +1,13 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- takeScreenshot: build/maestro/530-Timeline
|
||||
- tapOn: "Add attachment"
|
||||
- tapOn: "Poll"
|
||||
- tapOn: "What is the poll about?"
|
||||
- inputText: "I am a poll"
|
||||
- tapOn: "Option 1"
|
||||
- inputText: "Answer 1"
|
||||
- tapOn: "Option 2"
|
||||
- inputText: "Answer 2"
|
||||
- tapOn: "Create"
|
||||
- takeScreenshot: build/maestro/531-Timeline
|
||||
@@ -0,0 +1,9 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- takeScreenshot: build/maestro/510-Timeline
|
||||
- tapOn:
|
||||
id: "text_editor"
|
||||
- inputText: "Hello world!"
|
||||
- tapOn: "Send message"
|
||||
- hideKeyboard
|
||||
- takeScreenshot: build/maestro/511-Timeline
|
||||
@@ -0,0 +1,14 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
# This is the name of one room
|
||||
- tapOn: ${MAESTRO_ROOM_NAME}
|
||||
- takeScreenshot: build/maestro/500-Timeline
|
||||
- runFlow: messages/text.yaml
|
||||
- runFlow: messages/location.yaml
|
||||
- runFlow: messages/poll.yaml
|
||||
|
||||
# Restore once the call flow is fixed
|
||||
#- runFlow: call/call.yaml
|
||||
|
||||
- back
|
||||
- runFlow: ../../assertions/assertHomeDisplayed.yaml
|
||||
@@ -0,0 +1,46 @@
|
||||
appId: ${MAESTRO_APP_ID}
|
||||
---
|
||||
- tapOn:
|
||||
id: "home_screen-settings"
|
||||
- assertVisible: "Settings"
|
||||
- takeScreenshot: build/maestro/600-Settings
|
||||
- tapOn:
|
||||
text: "Analytics"
|
||||
- assertVisible: "Share analytics data"
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "Notifications"
|
||||
- assertVisible: "Enable notifications on this device"
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "Report a problem"
|
||||
- assertVisible: "Report a problem"
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "About"
|
||||
- assertVisible: "Copyright"
|
||||
- assertVisible: "Acceptable use policy"
|
||||
- assertVisible: "Privacy policy"
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "Screen lock"
|
||||
- assertVisible: "Choose PIN"
|
||||
- hideKeyboard
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "Advanced settings"
|
||||
- assertVisible: "View source"
|
||||
- back
|
||||
|
||||
- tapOn:
|
||||
text: "Developer options"
|
||||
- assertVisible: "Feature flags"
|
||||
- back
|
||||
|
||||
- back
|
||||
- runFlow: ../assertions/assertHomeDisplayed.yaml
|
||||
Reference in New Issue
Block a user