maestro icon indicating copy to clipboard operation
maestro copied to clipboard

[Maestro 1.31.0] iOS - not able to select specific row on UIPickerView

Open AlexandraTS opened this issue 10 months ago • 1 comments

Describe the bug I want to select the second row in the UIPickerView, which reads "Pay with frequently used credit card". I have assigned the accessibilityIdentifier to both the UIPickerView and each of its rows.

To Reproduce Steps to reproduce the behavior, e.g.:

  1. Start the simulator with Xcode

  2. Run maestro test test-uipicker.yaml

  3. launchApp

  4. tap on navigation_bar_btn_cart

  5. tap on cart_checkout_btn

  6. swipe up

  7. tap on payment_methods_spinner

  8. I tried four commands, for each, the Flow fails at

    - tapOn: "Pay with frequently used credit card"
    
    - scrollUntilVisible:
        element:
            text: "Pay with frequently used credit card"
    
    - tapOn:
       id: "action_sheet_picker" #container id
          index: 1
    
     - scrollUntilVisible:
        element:
            id: "Pay with frequently used credit card"
    

✅ it does work with the following commands, but the text is not what we display on the UI ⁉️

- tapOn: "Buy with Apple\_Pay"

Expected behavior I expect to select the second row ("Pay with frequently used credit card").

Screenshots

Environment information (please complete the following information):

  • Maestro version 1.31.0
  • Platform: iOS 16.4
  • Framework: Native iOS
  • Device model and OS version: iPhone14
  • Simulator
  • Host Mac M2

Bugreport output (if applicable) Archive.zip

More video records can be seen on the thread of the Slack channel

Additional context I also attempted to use the swipe command to see if I can swipe and stop at the second row. However, when I used the command as follows, the picker swiped to the bottom of the list:

- swipe:
    from:
      id: "action_sheet_picker"
    direction: "UP"

I thought it might work by specifying a specific percentage, but it turned out that it did not work. With the following command, the UIPickerView did not swipe at all:

- swipe:
    from:
      id: "action_sheet_picker"
    start: "50%, 50%"
    end: "50%, 10%"

AlexandraTS avatar Sep 01 '23 03:09 AlexandraTS

I'm having the same issue with a list picker. Using direction: UP swipes way too far, because it swipes 40% of the view's height. It selects the last element:

# Scrolls too far:
swipe:
  from:
    id: myListPicker
  direction: UP  # 40% of view's height: From (50% of width, 50% of height) to (50% of width, 10% of height)

Allowing us to specify the relative percentages to swipe would give us much more flexbility in a lot of situations. For example to swipe up 10% of the view's height:

swipe:
  from:
    id: myListPicker
    start: 50%, 50% # From (50% of width, 50% of height)
    end: 50%, 40% # To (50% of width, 40% of height)

So basically, instead of using the hardcoded relative percentages of the directions UP,DOWN, LEFT, RIGHT, it would allow us to manually provide the relative percentages.

rob4226 avatar Mar 22 '24 12:03 rob4226