Open hormesiel opened 1 month ago
This doesn't work either 😔:
# _utils/edit-text-clear-text.yaml
- copyTextFrom: ${EDIT_TEXT_LABEL}
- repeat:
while:
true: ${output.editTextIsNotEmpty} # <-- changed this
commands:
- tapOn: ${EDIT_TEXT_LABEL}
- eraseText
- copyTextFrom: ${EDIT_TEXT_LABEL}
- evalScript: ${output.editTextIsNotEmpty = maestro.copiedText != ''} # <-- added this
neither do this:
# _utils/edit-text-clear-text.yaml
- copyTextFrom: ${EDIT_TEXT_LABEL}
- repeat:
while:
true: ${output.copiedTextIsNotEmpty} # <-- changed this
commands:
- tapOn: ${EDIT_TEXT_LABEL}
- eraseText
- copyTextFrom: ${EDIT_TEXT_LABEL}
- runScript: # <-- added this
file: copied-text-is-not-empty.js
env:
copiedText: ${maestro.copiedText}
// _utils/copied-text-is-not-empty.js
//output.copiedTextIsNotEmpty = maestro.copiedText.length > 0
output.copiedTextIsNotEmpty = copiedText.length > 0
Have you attempted to log these values?
For true: ${output.copiedTextIsNotEmpty}
I was wondering if they were being interpolated as strings, and so "false" is truthy. But then I'd definitely expect true: ${maestro.copiedText.length > 0}
to work.
...Unless CopyTextFrom only sets the value when there's text to use? Does this work as a workaround? That'd prove this suspicion.
- copyTextFrom: ${EDIT_TEXT_LABEL}
- repeat:
while:
true: ${maestro.copiedText != ''}
commands:
- tapOn: ${EDIT_TEXT_LABEL}
- eraseText
- evalScript: ${maestro.copiedText = ''}
- copyTextFrom: ${EDIT_TEXT_LABEL}
Is there an existing issue for this?
Steps to reproduce
I'm trying to find a "bullet-proof" workaround to issues #495 and #1777 by using
repeat
andmaestro.copiedText
to clear edit texts on Android no matter their content's length, and to keep my code DRY. Unfortunately this doesn't work ; for some reason thewhile
condition never evaluates totrue
which causes an infinite loop.Actual results
Maestro never gets out of the
repeat
loop, even after the edit text has been entirely cleared.Expected results
Maestro should get out of the
repeat
loop once the edit text's value is empty.About app
Closed source app and I can't share any binary sorry.
About environment
Logs
No response
Maestro version
1.38.1
How did you install Maestro?
install script (https://get.maestro.mobile.dev)
Anything else?
No response