I have pulled so many automation tricks out of my butt, I should have started writing them down years ago. Maybe someone should make a repository of them. Anyway, I was trying to verify that our client's logo exists on particular pages of their mobile app. I reluctantly started going down the dumb path of
Get all the android.widget.ImageView elements and see if size is in the array of possible sizes:
[{'width': 145, 'height': 43}, # tab 4
{'width': 217, 'height': 64}, # galaxy s3
{'width': 217, 'height': 64}, # nexus 4
{'width': 217, 'height': 64}, # nexus 7
{'width': 298, 'height': 88}, # galaxy s5
{'width': 298, 'height': 88}, # note 3
{'width': 298, 'height': 88}, # nexus 5
{'width': 298, 'height': 88}, # htc One
{'width': 348, 'height': 103}, # note 5
{'width': 348, 'height': 103} # nexus 6
]
and then I realized that the height/width ratio should be the same. If it's not, we have an even bigger problem of their logo being stretched in a way that their brand manager is going to have a real problem with...
All these ratios are between 0.2949 .. 0.2965, so I'll just round a little (for future devices) to 0.2945 .. 0.297 which is a .25% margin and hope that no other image falls in this ratio. Should do the trick.
Automated testing, automation tools, and other engineering and communication concepts
Subscribe to:
Posts (Atom)
Email: How to Handle Unplanned Absences & Missing Deadlines
Motivation Life happens, no one is perfect. Someone on my team got Covid and had to miss work. She prepared the best she could, looped i...
-
Summary As our Selenium automation team grew, it began to feel like we might be fighting with each other over element locators and librar...
-
Motivation Most simple text editors will open any file and try to display it as text. This phenomenon is where this post came from... a ...
-
In my first post on Flow vs Page Objects , it became clear that as we move up in layers of abstraction, our tests get shorter, but the data ...