From 2ed1ec3962dcccfd6d9e0397f8438c968b0b580b Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Tue, 22 Oct 2024 01:43:26 +0600 Subject: [PATCH 1/5] test: added app install test with maestro --- maestro-apps-install.yaml | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 maestro-apps-install.yaml diff --git a/maestro-apps-install.yaml b/maestro-apps-install.yaml new file mode 100644 index 000000000..eae851d84 --- /dev/null +++ b/maestro-apps-install.yaml @@ -0,0 +1,52 @@ +appId: ${APP_ID} +--- +- launchApp: + clearState: false +- runFlow: + when: + visible: + id: "${APP_ID}:id/agreeBT" + commands: + - tapOn: + id: "${APP_ID}:id/agreeBT" +#- tapOn: +# id: ${APP_ID}:id/anonymousBT +- runFlow: + when: + visible: + id: "${APP_ID}:id/errorMessagePanel" + commands: + - tapOn: + id: "${APP_ID}:id/ignoreSessionButton" +- tapOn: + id: "${APP_ID}:id/navigation_bar_item_icon_view" + index: 1 +- evalScript: ${output.category_index = 0; output.app_install = 1;} +- repeat: + while: + true: ${output.app_install < 60} + commands: + - tapOn: + id: "${APP_ID}:id/category_title" + index: ${output.category_index} + - evalScript: ${output.app_index = 0} + - repeat: + while: + true: ${output.app_index < 10} + commands: + - tapOn: + text: INSTALL + id: "${APP_ID}:id/installButton" + optional: true + - evalScript: ${output.app_install++, output.app_index++} + - runFlow: + when: + notVisible: INSTALL + commands: + - scroll + + - evalScript: ${output.category_index = output.category_index + 1} + - back +- tapOn: + text: Search +- inputText: "notes" -- GitLab From 106e258b8984cdd7f3ae89675b2633e70e481ff2 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Tue, 22 Oct 2024 14:33:21 +0600 Subject: [PATCH 2/5] test: install apps from search page through maestro --- apps-install-flow.yaml | 17 +++++++++++++++++ maestro-apps-install.yaml | 31 +++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 apps-install-flow.yaml diff --git a/apps-install-flow.yaml b/apps-install-flow.yaml new file mode 100644 index 000000000..5d1e1f4c5 --- /dev/null +++ b/apps-install-flow.yaml @@ -0,0 +1,17 @@ +appId: foundation.e.apps.debug +--- +- evalScript: ${output.app_index = 0} +- repeat: + while: + true: ${output.app_index < 10} + commands: + - tapOn: + text: INSTALL + id: "${APP_ID}:id/installButton" + optional: true + - evalScript: ${output.app_install++, output.app_index++} + - runFlow: + when: + notVisible: INSTALL + commands: + - scroll \ No newline at end of file diff --git a/maestro-apps-install.yaml b/maestro-apps-install.yaml index eae851d84..cece80241 100644 --- a/maestro-apps-install.yaml +++ b/maestro-apps-install.yaml @@ -21,15 +21,15 @@ appId: ${APP_ID} - tapOn: id: "${APP_ID}:id/navigation_bar_item_icon_view" index: 1 -- evalScript: ${output.category_index = 0; output.app_install = 1;} +- evalScript: ${output.app_install = 0; output.category_index = 0} - repeat: while: - true: ${output.app_install < 60} + true: ${output.app_install < 80} commands: - tapOn: id: "${APP_ID}:id/category_title" index: ${output.category_index} - - evalScript: ${output.app_index = 0} + - evalScript: ${output.app_index = 0;} - repeat: while: true: ${output.app_index < 10} @@ -38,15 +38,34 @@ appId: ${APP_ID} text: INSTALL id: "${APP_ID}:id/installButton" optional: true - - evalScript: ${output.app_install++, output.app_index++} + - evalScript: ${output.app_install++; output.app_index++;} - runFlow: when: notVisible: INSTALL commands: - scroll - - - evalScript: ${output.category_index = output.category_index + 1} + - evalScript: ${output.category_index++} - back - tapOn: text: Search - inputText: "notes" +- tapOn: + text: notes app +- runFlow: + commands: + - evalScript: ${output.app_install = 0; output.app_index = 0;} + - repeat: + while: + true: ${output.app_index < 20;} + commands: + - tapOn: + text: INSTALL + id: "${APP_ID}:id/installButton" + optional: true + - evalScript: ${output.app_install++; output.app_index++;} + - runFlow: + when: + notVisible: INSTALL + commands: + - scroll + -- GitLab From 8e0ee6e0cf3894ec537e149ec451b65998858765 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Tue, 22 Oct 2024 19:30:11 +0600 Subject: [PATCH 3/5] refactor: maestro scripts --- maestro-apps-install.yaml | 71 ------------------- .../apps-install-flow.yaml | 6 +- maestro/maestro-apps-install.yaml | 60 ++++++++++++++++ 3 files changed, 63 insertions(+), 74 deletions(-) delete mode 100644 maestro-apps-install.yaml rename apps-install-flow.yaml => maestro/apps-install-flow.yaml (68%) create mode 100644 maestro/maestro-apps-install.yaml diff --git a/maestro-apps-install.yaml b/maestro-apps-install.yaml deleted file mode 100644 index cece80241..000000000 --- a/maestro-apps-install.yaml +++ /dev/null @@ -1,71 +0,0 @@ -appId: ${APP_ID} ---- -- launchApp: - clearState: false -- runFlow: - when: - visible: - id: "${APP_ID}:id/agreeBT" - commands: - - tapOn: - id: "${APP_ID}:id/agreeBT" -#- tapOn: -# id: ${APP_ID}:id/anonymousBT -- runFlow: - when: - visible: - id: "${APP_ID}:id/errorMessagePanel" - commands: - - tapOn: - id: "${APP_ID}:id/ignoreSessionButton" -- tapOn: - id: "${APP_ID}:id/navigation_bar_item_icon_view" - index: 1 -- evalScript: ${output.app_install = 0; output.category_index = 0} -- repeat: - while: - true: ${output.app_install < 80} - commands: - - tapOn: - id: "${APP_ID}:id/category_title" - index: ${output.category_index} - - evalScript: ${output.app_index = 0;} - - repeat: - while: - true: ${output.app_index < 10} - commands: - - tapOn: - text: INSTALL - id: "${APP_ID}:id/installButton" - optional: true - - evalScript: ${output.app_install++; output.app_index++;} - - runFlow: - when: - notVisible: INSTALL - commands: - - scroll - - evalScript: ${output.category_index++} - - back -- tapOn: - text: Search -- inputText: "notes" -- tapOn: - text: notes app -- runFlow: - commands: - - evalScript: ${output.app_install = 0; output.app_index = 0;} - - repeat: - while: - true: ${output.app_index < 20;} - commands: - - tapOn: - text: INSTALL - id: "${APP_ID}:id/installButton" - optional: true - - evalScript: ${output.app_install++; output.app_index++;} - - runFlow: - when: - notVisible: INSTALL - commands: - - scroll - diff --git a/apps-install-flow.yaml b/maestro/apps-install-flow.yaml similarity index 68% rename from apps-install-flow.yaml rename to maestro/apps-install-flow.yaml index 5d1e1f4c5..9c9529c4a 100644 --- a/apps-install-flow.yaml +++ b/maestro/apps-install-flow.yaml @@ -1,15 +1,15 @@ -appId: foundation.e.apps.debug +appId: ${APP_ID} --- - evalScript: ${output.app_index = 0} - repeat: while: - true: ${output.app_index < 10} + true: ${output.app_index < NUMBER_OF_INSTALL} commands: - tapOn: text: INSTALL id: "${APP_ID}:id/installButton" optional: true - - evalScript: ${output.app_install++, output.app_index++} + - evalScript: ${output.app_install++; output.app_index++;} - runFlow: when: notVisible: INSTALL diff --git a/maestro/maestro-apps-install.yaml b/maestro/maestro-apps-install.yaml new file mode 100644 index 000000000..c1bab11b2 --- /dev/null +++ b/maestro/maestro-apps-install.yaml @@ -0,0 +1,60 @@ +appId: ${APP_ID} +env: + SEARCH_STRING: "notes" + SEARCH_SUGGESTION_STRING: "notes app" + APP_INSTALL_CATEGORY_PAGE: 80 + APP_INSTALL_PER_CATEGORY: 10 + APP_INSTALL_SEARCH_PAGE: 20 +--- + +- launchApp: + clearState: false +- runFlow: + when: + visible: + id: "${APP_ID}:id/agreeBT" + commands: + - tapOn: + id: "${APP_ID}:id/agreeBT" +- tapOn: + id: ${APP_ID}:id/anonymousBT + optional: true +- runFlow: + when: + visible: + id: "${APP_ID}:id/errorMessagePanel" + commands: + - tapOn: + id: "${APP_ID}:id/ignoreSessionButton" + +# Go to category page +- tapOn: + id: "${APP_ID}:id/navigation_bar_item_icon_view" + index: 1 +- evalScript: ${output.app_install = 0; output.category_index = 0} +- repeat: + while: + true: ${output.app_install < APP_INSTALL_CATEGORY_PAGE} + commands: + - tapOn: + id: "${APP_ID}:id/category_title" + index: ${output.category_index} + - runFlow: + file: apps-install-flow.yaml + env: + NUMBER_OF_INSTALL: ${APP_INSTALL_PER_CATEGORY} + - evalScript: ${output.category_index++} + - back + +# Go to search page +- tapOn: + text: Search +- inputText: ${SEARCH_STRING} +- tapOn: + text: ${SEARCH_SUGGESTION_STRING} +- evalScript: ${output.app_install = 0; output.app_index = 0;} +- runFlow: + file: apps-install-flow.yaml + env: + NUMBER_OF_INSTALL: ${APP_INSTALL_SEARCH_PAGE} + -- GitLab From 622bf4918830d94f8a37fdc16b6233bbe544084d Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Tue, 22 Oct 2024 21:01:07 +0600 Subject: [PATCH 4/5] docs: README is added for Maestro --- maestro/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 maestro/README.md diff --git a/maestro/README.md b/maestro/README.md new file mode 100644 index 000000000..184df9f13 --- /dev/null +++ b/maestro/README.md @@ -0,0 +1,16 @@ +## How to install Maestro +Please follow the instructions at: https://maestro.mobile.dev/getting-started/installing-maestro + +## How to test + +Run this command from the **maestro** directory of the project. + +Debug: +```shell +maestro test -e APP_ID=foundation.e.apps.debug maestro-apps-install.yaml +``` + +Release: +```shell +maestro test -e APP_ID=foundation.e.apps maestro-apps-install.yaml +``` \ No newline at end of file -- GitLab From 534d871fd75284de9b292a68818430daaaaebbca Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Wed, 23 Oct 2024 11:53:00 +0600 Subject: [PATCH 5/5] test: improved the logic of script --- maestro/apps-install-flow.yaml | 9 ++++++--- maestro/maestro-apps-install.yaml | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/maestro/apps-install-flow.yaml b/maestro/apps-install-flow.yaml index 9c9529c4a..d9ddba5d5 100644 --- a/maestro/apps-install-flow.yaml +++ b/maestro/apps-install-flow.yaml @@ -1,9 +1,11 @@ appId: ${APP_ID} +env: + NUMBER_OF_MAX_SCROLL: 5 --- -- evalScript: ${output.app_index = 0} +- evalScript: ${output.app_index = 0, output.number_of_scroll = 0} - repeat: while: - true: ${output.app_index < NUMBER_OF_INSTALL} + true: ${output.app_index < NUMBER_OF_INSTALL && output.number_of_scroll < NUMBER_OF_MAX_SCROLL} commands: - tapOn: text: INSTALL @@ -14,4 +16,5 @@ appId: ${APP_ID} when: notVisible: INSTALL commands: - - scroll \ No newline at end of file + - evalScript: ${output.number_of_scroll++} + - scroll diff --git a/maestro/maestro-apps-install.yaml b/maestro/maestro-apps-install.yaml index c1bab11b2..32e7fa8f0 100644 --- a/maestro/maestro-apps-install.yaml +++ b/maestro/maestro-apps-install.yaml @@ -2,6 +2,7 @@ appId: ${APP_ID} env: SEARCH_STRING: "notes" SEARCH_SUGGESTION_STRING: "notes app" + NUMBER_OF_MAX_CATEGORY: 8 APP_INSTALL_CATEGORY_PAGE: 80 APP_INSTALL_PER_CATEGORY: 10 APP_INSTALL_SEARCH_PAGE: 20 @@ -34,7 +35,7 @@ env: - evalScript: ${output.app_install = 0; output.category_index = 0} - repeat: while: - true: ${output.app_install < APP_INSTALL_CATEGORY_PAGE} + true: ${output.app_install < APP_INSTALL_CATEGORY_PAGE && output.category_index < NUMBER_OF_MAX_CATEGORY} commands: - tapOn: id: "${APP_ID}:id/category_title" @@ -52,7 +53,7 @@ env: - inputText: ${SEARCH_STRING} - tapOn: text: ${SEARCH_SUGGESTION_STRING} -- evalScript: ${output.app_install = 0; output.app_index = 0;} +- evalScript: ${output.app_install = 0;} - runFlow: file: apps-install-flow.yaml env: -- GitLab