maestro icon indicating copy to clipboard operation
maestro copied to clipboard

[Question] Contexts, Dynamics, And Test Reports

Open likeSo opened this issue 3 years ago • 5 comments

Hi there! I have a few questions:

  • How can I read info from the current context? For example:
    • Read text from label A, pass the text to text field B
    • I need some data from the network
  • How can I scroll or swipe specify component? such as swipe on an image view? Or double-tap it?
  • How can I customize the timeout for waiting for a component to be visible?
    • My app took a long time to launch, the maestro just assert failed. I need the maestro to wait for a few seconds more time
  • How can I find a component by class or type? Not all buttons have text
  • Where can I find the test report?

Thank you!

likeSo avatar Sep 07 '22 02:09 likeSo

  • An element is already visible on the screen, why is the tapOn command still waiting for it?
  • If there is a rich text component that contains a button with text, how can I tap on it?
  • Why I can't tap a tab bar item by its label?
    • There is a UITabBarItem with the title "Homepage", I can not tap it by tapOn: "Homepage", either assetVisible
    • UIBarButtonItems are the same. On iOS, the back command does not work, and tapOn: "Back" does not work too.
  • If there are so many same texts on the screen, how can I specify the index of tapOn?

likeSo avatar Sep 07 '22 04:09 likeSo

How can I read info from the current context?

This is not possible yet, but we have plans to add such support. Also mentioned in #106

How can I scroll or swipe specify component? such as swipe on an image view? Or double-tap it?

Not available yet, but will be added. Also mentioned in #55

How can I customize the timeout for waiting for a component to be visible?

At the moment, this is intentionally not customizeable as timeout is already very high (~10 seconds). I would like to better understand your use case - why is loading taking so much time?

How can I find a component by class or type? Not all buttons have text

By design, Maestro is a black box testing framework and does not know about internals of the app. Think of it as a user with an impaired vision - Maestro sees the screen the same way such a user would through accessibility hints.

Where can I find the test report?

Maestro does not generate test reports on its own yet. Would like to hear your feedback, do you see a need for such functionality?

dmitry-zaitsev avatar Sep 07 '22 09:09 dmitry-zaitsev

An element is already visible on the screen, why is the tapOn command still waiting for it?

There is a bit of a buffer between element taps to make sure the view hierarchy is stable and not going to suddenly change again.

If there is a rich text component that contains a button with text, how can I tap on it?

A question to ask - how would a visually impaired user discover and tap on such elements? If the view is not showing up in maestro hierarchy, it will also not be easily accessibly to such a suer. Hence there are 2 options:

  • Make the text view clickable as a whole
  • Use dedicated button component instead of a rich text

Why I can't tap a tab bar item by its label?

Could you share the output of maestro hierarchy command? Does any text related to tab bar show up there?

If there are so many same texts on the screen, how can I specify the index of tapOn?

We have updated our documentation with an example on how to do that: https://maestro.mobile.dev/reference/tap-on-view#selecting-one-view-among-many-similar

dmitry-zaitsev avatar Sep 07 '22 09:09 dmitry-zaitsev

Thank you for your patient reply! Please let me explain something:

How can I customize the timeout for waiting for a component to be visible?

My case: My app needs to read the launch screen ad from the network, after networking, it shows a countdown button with an image. This may take some time and the maestro often failed my test case... In other words, the networking duration is not a problem of app~

How can I find a component by class or type? Not all buttons have text

Not all buttons have text, it may contain an icon, a shape, or rich text

Where can I find the test report?

The test report is necessary, but not a high priority. The testers need test reports to finish their work.

If there is a rich text component that contains a button with text, how can I tap on it?

Imagine this scene:

Showing results for XXX, search instead for XXX

The XXX may be a NSAttributedString or a UIButton, How can I locate the "XXX"?

Why I can't tap a tab bar item by its label?

My screen shot: image

In the hierarchy, no tab bar buttons found:

{
  "attributes" : { },
  "children" : [ {
    "attributes" : {
      "text" : "My App Name",
      "bounds" : "[0,0][390,844]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "text" : "Cart",
      "bounds" : "[177,58][211,78]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "text" : "ic messgae orange",
      "resource-id" : "Message",
      "bounds" : "[342,57][374,81]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "text" : "空列表",
      "bounds" : "[0,91][390,761]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "text" : "标签页栏",
      "bounds" : "[0,761][390,844]"
    },
    "children" : [ ],
    "clickable" : null
  } ],
  "clickable" : null
}

likeSo avatar Sep 08 '22 02:09 likeSo

Screenshot: image

In the hierarchy, no Back button, and right buttons found:

{
  "attributes" : { },
  "children" : [ {
    "attributes" : {
      "text" : "My App Name",
      "bounds" : "[0,0][390,844]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "resource-id" : "Earn point method",
      "bounds" : "[0,47][390,91]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "bounds" : "[12,107][82,137]"
    },
    "children" : [ ],
    "clickable" : null
  }, {
    "attributes" : {
      "bounds" : "[6,137][221,158]"
    },
    "children" : [ ],
    "clickable" : null
  } ],
  "clickable" : null
}

likeSo avatar Sep 08 '22 03:09 likeSo

Maestro does not generate test reports on its own yet. Would like to hear your feedback, do you see a need for such functionality?

Reports would be great for CI integration. #348 also asks for this and I described why I think it would be helpful in https://github.com/mobile-dev-inc/maestro/issues/348#issuecomment-1303380750.

jonekdahl avatar Nov 04 '22 12:11 jonekdahl

Closing this out as part of the request has been resolved with the following option:

maestro test --format junit flows/

For other issues, please open up separate GitHub issues per requests if still relevant :)

Leland-Takamine avatar Nov 28 '22 19:11 Leland-Takamine

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!

github-actions[bot] avatar Jul 11 '24 17:07 github-actions[bot]