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

[Feature Request] Device rotation #1221

Open
mdethlefs opened this issue Jul 5, 2023 · 9 comments
Open

[Feature Request] Device rotation #1221

mdethlefs opened this issue Jul 5, 2023 · 9 comments
Labels
enhancement New feature request or improvement of an existing feature

Comments

@mdethlefs
Copy link

We would like to have a way to change the device rotation for our flows

@mdethlefs mdethlefs added the enhancement New feature request or improvement of an existing feature label Jul 5, 2023
@axelniklasson
Copy link
Contributor

Somewhat related to #565

@dinisnunes1
Copy link

This would be key for us, since most of our app is running on landscape mode.

@bartekpacia
Copy link
Contributor

bartekpacia commented Jul 19, 2024

Hey! could you please clarify this feature request?

  • Do you want a Maestro command rotate that would rotate the device? Caveat: it would not work on physical devices. I know it's easy to do on Android emulator, using emulator console:

    rotating AVD from shell
    $ telnet localhost 5554
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    Android Console: Authentication required
    Android Console: type 'auth <auth_token>' to authenticate
    Android Console: you can find your <auth_token> in
    '/Users/bartek/.emulator_console_auth_token'
    OK
    auth uHnk/fBaIEhkA6jx
    Android Console: type 'help' for a list of commands
    OK
    rotate 90
    OK
    rotate -90
    OK
    rotate -90
    OK
    rotate 90
    OK
    

    Docs: https://developer.android.com/studio/run/emulator-console

  • Or maybe you want Maestro Cloud to support this feature? E.g:

    $ maestro cloud \
      --android-api-level 33 \
      --orientation landscape-left `# new hypothetical option` \
      build/app/outputs/apk/debug/app-debug.apk \
      .maestro
    

@bartekpacia bartekpacia added the waiting for customer response More information is needed from the customer before we can progress on the issue label Jul 19, 2024
@mdethlefs
Copy link
Author

mdethlefs commented Jul 19, 2024

Hey @bartekpacia
We want to change orientation inside a flow. We don't want to start a flow with a certain orientation.

For example our app has a videoplayer and when you rotate your phone to landscape the fullscreen automatically activates and the player has some additional UI. When changing the orientation back the fullscreen player closes.

So we basically need something like:
- rotateHorizontal
and
- rotateVertical

@github-actions github-actions bot removed the waiting for customer response More information is needed from the customer before we can progress on the issue label Jul 19, 2024
@bartekpacia
Copy link
Contributor

Thank you for a very quick response. I see your use case now.

I did some more googling and maybe we can also change rotation of physical Android devices with adb. StackOverflow link

As for iOS, it seems much more restricted in this area. Couldn't find anything.

Would you OK with this feature being Android only?

@mdethlefs
Copy link
Author

I mean it would be awesome if you could do it with iOS too. But we are happy for anything in this direction - so only Android would be cool already

@TheAlmightyBob
Copy link

FWIW, in XCUITest it's possible to set the orientation with something like XCUIDevice.shared.orientation = .landscapeLeft. But I've only used that for setting initial orientation, not changing it mid-test, and I don't know how complex that would be to integrate that with Maestro.

(I would be happy with even being able to set initial orientation)

Of course, none of that really matters unless #565 is fixed...

@bartekpacia
Copy link
Contributor

hey @TheAlmightyBob, thanks for the pointer. I tried it out and it indeed works:

recording.mp4

(link to the example app and test)

As for #565 - fix is on the way

@johntmcintosh
Copy link

I'm in need of this as well, and started a draft: main...johntmcintosh:maestro:feature/set-orientation. I'll see if I can get this into a PR ready state next week, but posting the diff here in case anyone has initial feedback on the direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request or improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

6 participants