From cc63c8fff5a2d47c64aa2187bf73754a1fe0125f Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Tue, 6 Feb 2024 23:29:35 +0530 Subject: [PATCH] init: maestro dev automation (#18712) The purpose of this commit is to allow running `maestro` automations to enhance productivity by **automating** mundane tasks. Other flows like - send contact request - sync devices - join a community etc will be a part of follow ups. In this commit we provide a `make` command to run a very common task like creating account & login : `make auto-login` We also allow another `make` command to run any other custom flow : `make auto-custom FLOW="maestro/create-account-or-login.yaml"` A `maestro` folder has been added with 3 `yaml` files which are very easy to understand ref : https://maestro.mobile.dev/api-reference/commands --- Makefile | 15 ++++++++++++++ maestro/create-account-or-login.yaml | 11 +++++++++++ maestro/login.yaml | 5 +++++ maestro/onboarding.yaml | 15 ++++++++++++++ nix/overlay.nix | 1 + nix/pkgs/idb-companion/default.nix | 29 ++++++++++++++++++++++++++++ nix/shell.nix | 4 ++-- 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 maestro/create-account-or-login.yaml create mode 100644 maestro/login.yaml create mode 100644 maestro/onboarding.yaml create mode 100644 nix/pkgs/idb-companion/default.nix diff --git a/Makefile b/Makefile index bccfc93e19..beae50b12f 100644 --- a/Makefile +++ b/Makefile @@ -457,3 +457,18 @@ repl-clojure: ##@repl Start Clojure repl for mobile App yarn shadow-cljs cljs-repl mobile repl-nix: nix-repl ##@repl Start an interactive Nix REPL + +#-------------- +# Dev Automation Flows +#-------------- + +auto-login: export TARGET := default +auto-login: ##@auto runs flow for login or onboarding app on simulator/emulator + maestro test "maestro/create-account-or-login.yaml" + +auto-custom: export TARGET := default +auto-custom: ##@auto runs any custom maestro automation flow on simulator/emulator +ifndef FLOW + $(error Usage: make automate FLOW=your-maestro-flow-file.yaml) +endif + maestro test "$(FLOW)" diff --git a/maestro/create-account-or-login.yaml b/maestro/create-account-or-login.yaml new file mode 100644 index 0000000000..8a24ec95d1 --- /dev/null +++ b/maestro/create-account-or-login.yaml @@ -0,0 +1,11 @@ +appId: im.status.ethereum.debug +--- +- runFlow: # to run onboarding flow only when device is in onboarding state + when: + visible: "I’m new to Status" + file: onboarding.yaml + +- runFlow: # to run login flow only when device is on login screen + when: + visible: "Profile password" + file: login.yaml diff --git a/maestro/login.yaml b/maestro/login.yaml new file mode 100644 index 0000000000..48a0ad2a00 --- /dev/null +++ b/maestro/login.yaml @@ -0,0 +1,5 @@ +appId: im.status.ethereum.debug +--- +- tapOn: "password-input" +- inputText: "password123" # update your account password here +- tapOn: login-button diff --git a/maestro/onboarding.yaml b/maestro/onboarding.yaml new file mode 100644 index 0000000000..d6d78f282d --- /dev/null +++ b/maestro/onboarding.yaml @@ -0,0 +1,15 @@ +appId: im.status.ethereum.debug +--- +- tapOn: "I’m new to Status" +- tapOn: "small-option-card" +- tapOn: "Your name" +- inputText: "DeviceA" +- tapOn: "submit-create-profile-button" +- inputText: "password123" +- tapOn: "Repeat password" +- inputText: "password123" +- tapOn: "disclaimer-touchable-opacity" +- tapOn: "Confirm password" +- tapOn: "skip-identifiers" +- tapOn: "enable-notifications-later-button" +- tapOn: "welcome-button" diff --git a/nix/overlay.nix b/nix/overlay.nix index c6d581dca4..63875026fd 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -97,4 +97,5 @@ in { patchMavenSources = callPackage ./pkgs/patch-maven-srcs { }; goMavenResolver = callPackage ./pkgs/go-maven-resolver { }; xcbeautify = callPackage ./pkgs/xcbeautify { }; + idb-companion = callPackage ./pkgs/idb-companion { }; } diff --git a/nix/pkgs/idb-companion/default.nix b/nix/pkgs/idb-companion/default.nix new file mode 100644 index 0000000000..6d65f00b72 --- /dev/null +++ b/nix/pkgs/idb-companion/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + pname = "idb-companion"; + version = "1.1.8"; + + src = fetchurl { + url = "https://github.com/facebook/idb/releases/download/v${version}/idb-companion.universal.tar.gz"; + sha256 = "sha256-O3LMappbGiKhiCBahAkNOilDR6hGGA79dVzxo8hI4+c="; + }; + + buildInputs = [ ]; + + unpackPhase = '' + tar -xzf $src + ''; + + installPhase = '' + mkdir -p $out/bin + cp -r ./* $out/bin/ + ''; + + meta = with lib; { + description = "A powerful command line tool for automating iOS simulators and devices"; + homepage = "https://github.com/facebook/idb"; + license = licenses.mit; + platforms = platforms.darwin; + }; +} diff --git a/nix/shell.nix b/nix/shell.nix index 77147310a3..9601a79c1b 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -23,9 +23,9 @@ in mkShell { # build specific utilities clojure maven watchman # other nice to have stuff - yarn nodejs python310 + yarn nodejs python310 maestro ] # and some special cases - ++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl ] ++ appleSDKFrameworks) + ++ lib.optionals stdenv.isDarwin ([ cocoapods clang tcl idb-companion ] ++ appleSDKFrameworks) ++ lib.optionals (!stdenv.isDarwin) [ gcc8 ] );