Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync fork 3 #6

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cb57c18
change install script to rasyid7
rasyid7 Sep 26, 2024
bdb4f84
update README
rasyid7 Sep 26, 2024
b7db551
Adding sleep feature
rasyid7 Sep 26, 2024
3e3acef
change version checker to own repo
rasyid7 Sep 26, 2024
fb9db9f
fix tags include from OR to AND
rasyid7 Sep 26, 2024
d58f351
ignore .idea
rasyid7 Sep 26, 2024
ed6a793
Prepare release 1.38.2
rasyid7 Sep 26, 2024
928eae6
Merge pull request #4 from rasyid7/myChanges
rasyid7 Sep 26, 2024
69c8c76
Fix sleep and tag test
rasyid7 Sep 26, 2024
4623c99
android waitToSettleTimeoutMs not wait for settle for faster commands
rasyid7 Oct 18, 2024
bd28797
Prepare release 1.38.3
rasyid7 Oct 18, 2024
f8abc33
fix: install debug reporter in maestro cloud command (#2069)
amanjeetsingh150 Sep 26, 2024
5693092
fix: optional commands in subFlow (#2071)
amanjeetsingh150 Sep 30, 2024
197a482
fix: add stopped status for maestro flows (#2070)
amanjeetsingh150 Oct 1, 2024
fdf02c0
fix: stopped in upload status (#2072)
amanjeetsingh150 Oct 1, 2024
37ac5f9
fix: use own fork of scripts in e2e test (#2074)
axelniklasson Oct 3, 2024
da9d6df
fix: don't allow negative swipe duration (#2073)
axelniklasson Oct 3, 2024
4824e52
fix: bring back removed optional for backward compatibility (#2079)
amanjeetsingh150 Oct 7, 2024
447f6e2
fix: description for optional elements
amanjeetsingh150 Oct 7, 2024
cf9cfd5
Revert "Fix android open link verify (#1999)" (#2085)
amanjeetsingh150 Oct 9, 2024
620a791
chore: update e2e tests to relaunch the app with clear state (#2077)
axelniklasson Oct 10, 2024
d397c89
removing gpt deprecated versions (#2075)
felipeduartea Oct 14, 2024
155b018
fix: don't break tests (#2090)
amanjeetsingh150 Oct 15, 2024
0c5c040
chore: upgrade to 1.39.0 (#2092)
amanjeetsingh150 Oct 15, 2024
79f4c39
Adding unit tests to maestro-utils module (#2081)
Matheeusb Oct 15, 2024
fc41890
fix: exclude duplicates (#2093)
amanjeetsingh150 Oct 15, 2024
3cafcb1
fix: not jar use source jar for exclusions
amanjeetsingh150 Oct 15, 2024
2491aad
fix: robin upload url / app binary id (#2094)
axelniklasson Oct 16, 2024
61fc4eb
fix: reinstall ios app to clear state reliably (#2118)
axelniklasson Nov 4, 2024
ac35653
Prepare for release 1.39.1 (#2125)
igorsmotto Nov 5, 2024
8ca0830
Fix timeout unit in ScrollUntilVisibleCommand (#2112)
vibin Nov 9, 2024
1ea7419
fix: use noop insights by default on maestro (#2131)
amanjeetsingh150 Nov 14, 2024
690c4b0
fix: added installing and preparing status for uploads (#2145)
proksh Nov 19, 2024
a97d757
Prepare for release 1.39.2 (#2146)
amanjeetsingh150 Nov 19, 2024
271e3e9
Removed new status for upload - New status should only be on runs (#2…
proksh Nov 20, 2024
6e118bb
rightsizing connections to speed up xctest process (#2143)
herval Nov 21, 2024
6725047
More e2e tests (#2124)
Fishbowler Nov 24, 2024
f5e2f5a
Ensure only one xcodebuild process, cleanup unwanted retries (#2097)
amanjeetsingh150 Nov 26, 2024
7ed317c
[RFC] measurement for device commands (#2144)
herval Nov 27, 2024
b95f70d
fix: add waitToSettleTimeOut on swipe commands (#2153)
amanjeetsingh150 Nov 28, 2024
f4121e1
handle possible npe (#2162)
lucaswiechmann Dec 3, 2024
f4abd42
feat: add retry functionality (#2168)
amanjeetsingh150 Dec 4, 2024
74f6a5e
Add null check in childNafCheck to handle case when child node is nul…
Leland-Takamine Dec 4, 2024
e22dac1
feat: added element bounds to matadata, with interactive commands (#2…
proksh Dec 5, 2024
5947d5d
fix: adjust server timeout to longer duration (#2174)
amanjeetsingh150 Dec 5, 2024
da081aa
fix: switch off netty handler logs (#2170)
amanjeetsingh150 Dec 5, 2024
ff330bd
Fix environment variables for multi-flow runs (#2163)
Fishbowler Dec 5, 2024
67d7fc2
[MA-2561] Bad requests for inputText and eraseText if keyboard is not…
amanjeetsingh150 Dec 9, 2024
bba3806
Prepare for release 1.39.3 (#2177)
amanjeetsingh150 Dec 9, 2024
33fda27
fix new commands
rasyid7 Dec 9, 2024
6627954
Merge branch 'main' into syncFork-3
rasyid7 Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.idea/

# Ignore Gradle project-specific cache directory
.gradle
Expand Down
31 changes: 27 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ Fixes:
- Fix: not working when iOS simulator is in landscape orientation ([caveats apply](https://github.com/mobile-dev-inc/maestro/pull/1974#issuecomment-2346074593)) ([#1974](https://github.com/mobile-dev-inc/maestro/pull/1974))
- Fix: confusing error message "BlockingCoroutine is cancelling" ([#2036](https://github.com/mobile-dev-inc/maestro/pull/2036))
- Fix: AI-powered commands crashing when Anthropic is used ([#2033](https://github.com/mobile-dev-inc/maestro/pull/2033))
- Fix: display warnings generated by AI-powered commands in CLI output when `optional: true` ([#2026](https://github.com/mobile-dev-inc/maestro/pull/2026))
- Fix: visual bug with emojis having slightly different length in `maestro test`'s interactive CLI output ([#2016](https://github.com/mobile-dev-inc/maestro/pull/2016))
- Fix: display warnings generated by AI-powered commands in CLI output when `optional: true` ([#2026](https://github.com/mobile-dev-inc/maestro/pull/2026))
- Fix: visual bug with emojis having slightly different length in `maestro test`'s interactive CLI output ([#2016](https://github.com/mobile-dev-inc/maestro/pull/2016))
- Fix: no tests being run when flowsOrder specified all tests in the workspace ([#2003](https://github.com/mobile-dev-inc/maestro/pull/2003))
- Fix: using integers from JavaScript outputs causing a deserialization error ([#1788](https://github.com/mobile-dev-inc/maestro/pull/1788) by [Muhammed Furkan Boran](https://github.com/boranfrkn))
- Fix: using integers from JavaScript outputs causing a deserialization error ([#1788](https://github.com/mobile-dev-inc/maestro/pull/1788) by [Muhammed Furkan Boran](https://github.com/boranfrkn))
- Fix: delete temporary APKs after using them ([#1947](https://github.com/mobile-dev-inc/maestro/pull/1947) by [Tarek Belkahia](https://github.com/tokou))
- Fix: allow env vars in `setLocation` and `travel` commands ([#1988](https://github.com/mobile-dev-inc/maestro/pull/1988) by [Prasanta Biswas](https://github.com/prasanta-biswas))
- Fix: error message when specifying `--format` together with `--continuous` #1948 ([#1948](https://github.com/mobile-dev-inc/maestro/pull/1948) by [Tarek Belkahia](https://github.com/tokou))
Expand All @@ -68,6 +68,29 @@ Chores:
- Chore: make Maestro build & compile on Java 17 ([#2008](https://github.com/mobile-dev-inc/maestro/pull/2008))
- Chore: Migrate all Gradle buildscripts to Gradle Kotlin DSL ([#1994](https://github.com/mobile-dev-inc/maestro/pull/1994))

=== My Changes ===

## 1.38.3

Released on 2024-10-18

- android waitToSettleTimeoutMs not wait for settle for faster commands

=======
## 1.38.2

Released on 2024-09-26

- change install script to rasyid7
- update README
- change version checker to own repo
- [add sleep feature on maestro](https://github.com/rasyid7/maestro/commit/2a8575583af3aaf71de23c7def902db30041fa06)
- [fix tags include from OR to AND](https://github.com/rasyid7/maestro/commit/9949f1b204e86dedb3f2912ffdfa65cca2e6121f)

-- note: need to implement another [--parallel option](https://github.com/rasyid7/maestro/commit/3d291ee0145c9e925a3fa1702a26e49230b6ec03)

=======

## 1.38.1

Released on 2024-08-30
Expand Down Expand Up @@ -120,7 +143,7 @@ Released on 2024-07-29

### Bug fixes

- Fix `FileNotFoundException: ~.maestro/sessions` ([#1843](https://github.com/mobile-dev-inc/maestro/pull/1843))
- Fix `FileNotFoundException: ~.maestro/sessions` ([#1843](https://github.com/mobile-dev-inc/maestro/pull/1843))

## 1.37.2 - 2024-07-29

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Maestro is the easiest way to automate UI testing for your mobile app.

> [!NOTE]
>
> **Full documentation for Maestro can be found at [maestro.mobile.dev](https://maestro.mobile.dev)**
>
> Since this is forked REPO, to install this maestro, please use
>
> `curl -Ls "https://raw.githubusercontent.com/rasyid7/maestro/main/scripts/install.sh" | bash`

<img src="https://user-images.githubusercontent.com/847683/187275009-ddbdf963-ce1d-4e07-ac08-b10f145e8894.gif" />

## Why Maestro?
Expand Down
14 changes: 4 additions & 10 deletions maestro-cli/src/main/java/maestro/cli/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,10 @@ fun main(args: Array<String>) {
if (newVersion != null) {
Updates.fetchChangelogAsync()
System.err.println()
val changelog = Updates.getChangelog()
val anchor = newVersion.toString().replace(".", "")
System.err.println(listOf(
"A new version of the Maestro CLI is available ($newVersion).\n",
"See what's new:",
"https://github.com/mobile-dev-inc/maestro/blob/main/CHANGELOG.md#$anchor",
ChangeLogUtils.print(changelog),
"Upgrade command:",
"curl -Ls \"https://get.maestro.mobile.dev\" | bash",
).joinToString("\n").box())
System.err.println(
("A new version of the Maestro CLI is available ($newVersion). Upgrade command:\n" +
"curl -Ls \"https://raw.githubusercontent.com/rasyid7/maestro/main/scripts/install.sh\" | bash").box()
)
}

if (commandLine.isVersionHelpRequested) {
Expand Down
2 changes: 1 addition & 1 deletion maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ApiClient(
fun getLatestCliVersion(): CliVersion {
val request = Request.Builder()
.header("X-FRESH-INSTALL", if (!Analytics.hasRunBefore) "true" else "false")
.url("$baseUrl/maestro/version")
.url("https://raw.githubusercontent.com/rasyid7/maestro/main/version")
.get()
.build()

Expand Down
14 changes: 13 additions & 1 deletion maestro-client/src/main/java/maestro/Maestro.kt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Maestro(
) {
LOGGER.info("Tapping on element: ${tapRepeat ?: ""} $element")

val hierarchyBeforeTap = waitForAppToSettle(initialHierarchy, appId, waitToSettleTimeoutMs) ?: initialHierarchy
val hierarchyBeforeTap = initialHierarchy

val center = (
hierarchyBeforeTap
Expand Down Expand Up @@ -354,6 +354,12 @@ class Maestro(
} else {
driver.tap(Point(x, y))
}

if (waitToSettleTimeoutMs != null && waitToSettleTimeoutMs < 150) {
LOGGER.info("waitToSettleTimeoutMs is less than 150, skip get hierarchy")
return
}

val hierarchyAfterTap = waitForAppToSettle(waitToSettleTimeoutMs = waitToSettleTimeoutMs)

if (hierarchyBeforeTap != hierarchyAfterTap) {
Expand Down Expand Up @@ -582,6 +588,12 @@ class Maestro(
ScreenshotUtils.waitUntilScreenIsStatic(timeout, SCREENSHOT_DIFF_THRESHOLD, driver)
}

fun sleep(time: Long?) {
val time = time ?: ANIMATION_TIMEOUT_MS
LOGGER.info("Sleep for $time ms")
Thread.sleep(time)
}

fun setProxy(
host: String = SocketUtils.localIp(),
port: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sealed interface Command {
fun visible(): Boolean = true

val label: String?

val optional: Boolean
}

Expand Down Expand Up @@ -903,6 +903,21 @@ data class WaitForAnimationToEndCommand(
}
}

data class SleepCommand(
val time: Long?,
override val label: String? = null,
override val optional: Boolean = false,
) : Command {

override fun description(): String {
return label ?: "Sleep for $time ms"
}

override fun evaluateScripts(jsEngine: JsEngine): Command {
return this
}
}

data class EvalScriptCommand(
val scriptString: String,
override val label: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ data class MaestroCommand(
val setAirplaneModeCommand: SetAirplaneModeCommand? = null,
val toggleAirplaneModeCommand: ToggleAirplaneModeCommand? = null,
val retryCommand: RetryCommand? = null,
val sleepCommand: SleepCommand? = null,
) {

constructor(command: Command) : this(
Expand Down Expand Up @@ -111,7 +112,8 @@ data class MaestroCommand(
addMediaCommand = command as? AddMediaCommand,
setAirplaneModeCommand = command as? SetAirplaneModeCommand,
toggleAirplaneModeCommand = command as? ToggleAirplaneModeCommand,
retryCommand = command as? RetryCommand
retryCommand = command as? RetryCommand,
sleepCommand = command as? SleepCommand,
)

fun asCommand(): Command? = when {
Expand Down Expand Up @@ -155,6 +157,7 @@ data class MaestroCommand(
setAirplaneModeCommand != null -> setAirplaneModeCommand
toggleAirplaneModeCommand != null -> toggleAirplaneModeCommand
retryCommand != null -> retryCommand
sleepCommand != null -> sleepCommand
else -> null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class Orchestra(
is SetAirplaneModeCommand -> setAirplaneMode(command)
is ToggleAirplaneModeCommand -> toggleAirplaneMode()
is RetryCommand -> retryCommand(command, config)
is SleepCommand -> sleepCommand(command)
else -> true
}.also { mutating ->
if (mutating) {
Expand Down Expand Up @@ -442,6 +443,11 @@ class Orchestra(
return true
}

private fun sleepCommand(command: SleepCommand): Boolean {
maestro.sleep(command.time)
return true
}

private fun defineVariablesCommand(command: DefineVariablesCommand): Boolean {
command.env.forEach { (name, value) ->
jsEngine.putEnv(name, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,17 @@ object WorkspaceExecutionPlanner {
val config = configPerFlowFile[it]
val tags = config?.tags ?: emptyList()

(allIncludeTags.isEmpty() || tags.any(allIncludeTags::contains))
(allIncludeTags.isEmpty() || allIncludeTags.all { includeTag -> tags.contains(includeTag) })
&& (allExcludeTags.isEmpty() || !tags.any(allExcludeTags::contains))
}

println("")
println("Number flows to run: ${allFlows.size}")
println("Flows to run:")
for (flow in allFlows) {
println(" * ${flow.fileName.toString().substringBeforeLast(".")}")
}

if (allFlows.isEmpty()) {
val message = """
|Include / Exclude tags did not match any Flows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ data class YamlFluentCommand(
val setAirplaneMode: YamlSetAirplaneMode? = null,
val toggleAirplaneMode: YamlToggleAirplaneMode? = null,
val retry: YamlRetryCommand? = null,
val sleep: YamlSleepCommand? = null,
) {

@SuppressWarnings("ComplexMethod")
Expand Down Expand Up @@ -255,8 +256,16 @@ data class YamlFluentCommand(
val tapRepeat = TapRepeat(2, delay)
listOf(tapCommand(doubleTapOn, tapRepeat = tapRepeat))
}
setAirplaneMode != null -> listOf(MaestroCommand(SetAirplaneModeCommand(setAirplaneMode.value, setAirplaneMode.label, setAirplaneMode.optional)))
toggleAirplaneMode != null -> listOf(MaestroCommand(ToggleAirplaneModeCommand(toggleAirplaneMode.label, toggleAirplaneMode.optional)))
setAirplaneMode != null -> listOf(MaestroCommand(SetAirplaneModeCommand(setAirplaneMode.value, setAirplaneMode.label)))
toggleAirplaneMode != null -> listOf(MaestroCommand(ToggleAirplaneModeCommand(toggleAirplaneMode.label)))
sleep != null -> listOf(
MaestroCommand(
SleepCommand(
time = sleep.time,
label = sleep.label
)
)
)
else -> throw SyntaxError("Invalid command: No mapping provided for $this")
}
}
Expand Down Expand Up @@ -777,6 +786,10 @@ data class YamlFluentCommand(
assertNoDefectsWithAI = YamlAssertNoDefectsWithAI()
)

"sleep" -> YamlFluentCommand(
sleep = YamlSleepCommand(time = null)
)

else -> throw SyntaxError("Invalid command: \"$stringCommand\"")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package maestro.orchestra.yaml

import com.fasterxml.jackson.annotation.JsonCreator

data class YamlSleepCommand(
val time: Long?,
val label: String? = null,
) {
companion object {
@JvmStatic
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
fun create(time: Long): YamlSleepCommand {
return YamlSleepCommand(time = time)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,33 @@ internal class MaestroCommandSerializationTest {
.isEqualTo(command)
}

@Test
fun `serialize SleepCommand`() {
// given
val command = MaestroCommand(
SleepCommand(time = 1000)
)

// when
val serializedCommandJson = command.toJson()
val deserializedCommand = objectMapper.readValue(serializedCommandJson, MaestroCommand::class.java)

// then
@Language("json")
val expectedJson = """
{
"sleepCommand" : {
"time" : 1000,
"optional" : false
}
}
""".trimIndent()
assertThat(serializedCommandJson)
.isEqualTo(expectedJson)
assertThat(deserializedCommand)
.isEqualTo(command)
}

private fun MaestroCommand.toJson(): String =
objectMapper
.writerWithDefaultPrettyPrinter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ internal class WorkspaceExecutionPlannerTest {
// When
val plan = WorkspaceExecutionPlanner.plan(
input = paths("/workspaces/010_global_include_tags"),
includeTags = listOf("featureB"),
includeTags = listOf("featureA"),
excludeTags = listOf(),
config = null,
)
Expand All @@ -258,7 +258,6 @@ internal class WorkspaceExecutionPlannerTest {
assertThat(plan.flowsToRun).containsExactly(
path("/workspaces/010_global_include_tags/flowA.yaml"),
path("/workspaces/010_global_include_tags/flowA_subflow.yaml"),
path("/workspaces/010_global_include_tags/flowB.yaml"),
)
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ mkdir -p "$maestro_tmp_folder"


if [ -z "$MAESTRO_VERSION" ]; then
download_url="https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip"
download_url="https://github.com/rasyid7/maestro/releases/latest/download/maestro.zip"
else
download_url="https://github.com/mobile-dev-inc/maestro/releases/download/cli-$MAESTRO_VERSION/maestro.zip"
download_url="https://github.com/rasyid7/maestro/releases/download/cli-$MAESTRO_VERSION/maestro.zip"
fi

maestro_zip_file="${maestro_tmp_folder}/maestro.zip"
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"major":1,"minor":38,"patch":3}
Loading