I am using xcode 8.3.3, swift, and XCTest. I am wondering what the best approach to handle scrolling is when you plan to run your tests against multiple simulators and have a list displayed. Since the screen size may change based on the simulator being used, the element you want to select to scroll up on may or may not be displayed.
If I have a list with x # of elements, how do I best approach which element to use to scroll the list up to have the next set of elements displayed on the screen so that the tests will run on multiple simulators of different screen sizes?
When we do "po XCUIApplication()" we see all the elements in the list, so in order to know which one is the last one displayed on the screen, we would have to look through each element and do a checked like isDisplayed or something to find the last element currently displayed ... but I was hoping there is a better approach?
If the element you want to use is displayed when you do po XCUIApplication() then you should just be able to tap() it without having to scroll it into view. The framework will handle the scrolling automatically if it can find the element.
Here is an article I wrote discussing how to use SBTUITestTunnel for scrolling:
https://rlukasik.medium.com/using-sbtuitesttunnel-for-scrolling-in-xcuitests-2e166440ca73
Related
I'm new to flutter and I'm looking for a way to implement a simple feature. A draggable container.
I have two groups of UI elements wrapped in a Container widget. I want to be able to go from one group to another by dragging or swiping in different directions.
How would I go about doing this?
Here are sample images of my UI design to help you understand what I want to achieve:
Image #1
Image #2
As you can see, Image #1 and Image #2 are only different in the bottom part of my design. I have already created all the necessary UI elements and wrapped them in the Container widget. Now the only thing I need is the ability to go from one group to another. It would also be nice if there was a callback method that could update the buttons above upon transitioning from one group to another.
Thanks in advance!
There are many possibilities to achieve this, depends on your exact wishes, here are 3 ideas:
Using a TabBarView to swipe the entire screen, Tab1 will be the first screen you showed, and Tab2 will be second screen - only the contents. (you probably did not want that, but just putting it out there).
Dividing the container into 2 pieces (vertically), and placing the TabBarView on the bottom part, having 2 tabs: 1 with the Today part and one with the Weekly part. (there are a few examples out there, for instance: divide screen into two equal parts in flutter).
You can also customize the build method to change anything (for example the top indicator) based on the current tab index (as asked and answered here: How to get current tab index in Flutter)
For a more custom solution you can use:
GestureDetector wrapped around your container, and handle OnHorizontalDragX (where X is Start, End etc.) to do any custom stuff - maybe changing the state and trigger a rebuild with the new image
What type of control is this? Some sort of Segment control but without borders? It works like a menu in that you can mouse down and drag... it will highlight as you drag and pick the one you release on.
How can I do something similar?
The big difference I need is to allow multiple selection which will show different sets of details in the area below it. I can do this with a series of NSButtons, but don't get the drag-over "menu" effect.
Ideas?
In the past, I have come across two example of implementation of Xcode-like inspector views:
https://github.com/malcommac/DMTabBar
https://github.com/smic/InspectorTabBar
Some time has passed, so they seem to me more the style of Xcode 4, but they should be ready to adapt to the new appearance.
I am developing a testing algorithm for our iOS apps using Appium. To fully implement this algorithm i need to identify wither i have moved onto different screen or am still on the same screen after performing some action. I need to know, what makes every screen unique/different from other in terms of Appium?
Going through the pageSource of every screen, i found that most screens have xpath attribute in window element. Can i use value of xpath of window element to mark the screen as unique from others, or do i need to do a trivial string comparison between screen's pageSources to mark them different? Or is there any other better solution?
Not sure if xpath would be the best solution for this. Normally the UIAWindow would remain the same, and developers might use different containers within this UIAWindow to render different screens.
So to verify different screens, you might need to figure out what this container is and see if the container's properties change when you move to a new screen (ie a new container)
If you app user a different header for every new screen, then you can use this header to see if the screen is changed. Example: in WhatsApp, you would see a different persons at the top. So in this case, the person's name can be assumed as the header.
If this doesn't work then you can verify some of the other controls, or say list of all the UIAStaticText on the screen. During screen change the entire list of UIAStaticText might change. So this can indicate a screen change.
For our automation suite at work I've implemented a series of screen check steps. Every time we switch screens I do a find_element command for an element on that screen that is unique to that screen. That way if a button or option takes me to a new screen that is incorrect my test will fail as expected. If it does find the element we're expecting it adds minimal time to the test suite.
Anish Pillai made a good suggestion of using the header text if there is any. Otherwise a particular tab, menu text, resource_id, or whatever is unique about the page would suffice. All you would need to do is a find_element call and a failure message if it fails.
I am using List Peel animation as described here. Its working as expected but now I want to add the similar effect on onItemSelectionChanged event of the list box. The only difference is that this time, I want the selected item to leave the page at the very last. How can that be achieved?
Regards
I think that Clarity's turnstile with feather transition might be what you are looking for:
http://blogs.claritycon.com/blog/2010/10/13/wp7-page-transitions-sample/
I can't quite remember how it works... but I remember it did act on individual elements - it tried to work like the start menu.
On the IPhone, the map control allows you to switch between a list mode and map mode easily. I've been trying to find examples of this for WP7 but am at a loss.
Is there a best practice for implementing a list of objects on a map?
If not, do we just do it manually, I.E. Save the dataset and display it as a listbox or something?
If you do it manually, where is the best place to put a button to switch you between the 2 screen styles? I feel like that app bar isn't right.
I don't want to copy the IPhone UI standard and have a button in the title bar, although I'm running out of options.
For one "best practice" I'd take a look at how the default Bing Maps app works - it provides a "results list" text menu item accessible from the ApplicationBar - and this is displayed via a full screen dialog (at least I think that's what it is).
However, that is only one "best practice" - I don't think their UI is perfect for all apps.
Application bar is fine, just make sure the buttons are in the same positions for each bar and that toggling views 10 times does not require pressing Back 10 times to go to the previous page, maybe use a different page transition so it doesn't feel like every other transition on the app.