Driver.deviceInfo()
is being called too many times
#2031
Labels
maestro cli
Related to the command-line Maestro tool
P3
Issues that are less important
tech debt
Corners cut, candidates for refactoring, etc.
Problem
Current state
The
Driver.deviceInfo()
is sometimes being called too many times (too many=more than once) when executing a single Maestro command.This is caused by lack of clear responsibility separation between
Orchestra
,Maestro
, andDriver
when mapping screen size values (width and height) for use by commands.Expected state
The
Driver.deviceInfo()
is called at most once for each Maestro command.Possible solutions
Option 1
Change function of the
Driver
to accept callbacks that provide the caller with most up-to-date device info (or just screen size) and return Point, e.g. we'd go from:to:
Then the callers would do:
Sample implementation in a platform-specific driver:
Pros
Cons
Option 2
Don't use/depend on device's width/height in
Orchestra
andMaestro
classes. Instead, theDriver
interface accomodates for the use cases that currently require callingDriver.deviceInfo()
inOrchestra
andMaestro
.Orchestra
andMaestro
are not concerned with screen sizes at all.Pros
Cons
swipe
command is implemented both in bothMaestro.swipe()
and platform-specificDriver.swipe()
.Option 3
Be okay with a single command ending up calling the /deviceInfo endpoint multiple times.
This is what we have now (since PR #1974 has been merged).
Pros
Cons
The text was updated successfully, but these errors were encountered: