-
Notifications
You must be signed in to change notification settings - Fork 27
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
Need some HowTo examples #11
Comments
Hi, you are the first person outside of our company who checked out this project (wow). This project is designed to be open source and highly customizable without forking, however, it really lacks docs, demos and examples. The demo now just shows how to link Mixbox to your project with very few examples of usage of the framework. 1. How to set permissions You can add (The code from Tests project, which is now a better demo than Demo:
Factory:
What is Fake Settings App and how to setup it: https://github.com/avito-tech/Mixbox/tree/master/Frameworks/FakeSettingsAppMain If you do not want to set up notification permissions (but want to setup every other permission), you can pass 2. How to set Geolocation Use
Then in your tests it will be easy (assuming you have your own
3. How to set timeouts for waits\polling Every check and action contains default timeout (which is not configurable globally yet and equals 15 seconds). You can override timeout with
4. How to cleanup app (keychain and other data) Unfortunately, we didn't open-source this feature yet. For example, clearing keychain is tricky and we use our proxy in our code, which was hard to open-source (in a hurry at that moment), but not impossible. I'll do it soon (because you asked about that). 5. How to assert different elements states (visibile, not visible, exist, not exist) and the same action but with wait (waitForVisibility) If I understood you correctly, you asked "how to wait for visibility before each check" - it is done by default, but can be turned off. All actions:
Deprecated actions:
All checks (syntactic sugar):
Basic:
Getters (will be replaced soon with more generic syntax):
Example of generic check (very complex example):
In this check you can pass matcher. Matchers are highly costomizable, it this example the matcher is built by a builder, but you can use classes instead:
I described matchers in the next answer: 6. Element selection, is it only id, label, value and visibleText based ? There are currently those fields in every element that can be used in matcher:
Matchers don't simply check fields, they are also provide reports, so we use But in most of the cases you should use builders, they are much more convenient and the code is much more readable with them. Example of using builder when writing a locator for page object element (very complex example):
All properties and functions of matcher builder is listed here: Mixbox/Frameworks/UiTestsFoundation/PageObjectElement/Locator/Builder/ElementMatcherBuilder.swift Line 25 in a6ceb38
Note that you can always write extensions to the builder and/or use your custom Matcher subclasses. 7. What the difference between: element in element.id == "label" and $0.id == "button" ? It's swifts syntax. No difference. This: Hope this helps. I'll make more docs and a better demo, but don't want to name any deadlines on that. |
No |
Thank you for answers. I already tried other iOS frameworks (like KIF and EarlGrey) and now want to try this one, but due to lack of time and documentation it's not so easy as i thought.
Now it looks like this:
Now from test i can call: So test itself (i moved
As for 2,3,5,6,7 - Nice, thanks, will try to use this.
|
What should happen? I do not see code in your test that would check that geolocation permissions were set. It works silently. Also there might be problems on Mojave with permissions, our testing farm uses High Sierra.
Our approach is fast (milliseconds fast), however we don't have blackbox alternative (using UI of iOS) as a fallback.
Mixbox can not interact with anything hidden (as a real person). Autoscrolling is enabled by default for every action or check (can be manually disabled). It is not tested with UITableView (we use UICollectionView). If scrolling is not working, there is a workaround -
It is a workaround, it is not reliable, because it doesn't know where the element is. It tries to scroll view randomly until desired element appears. |
What should happen? I do not see code in your test that would check that geolocation permissions were set. It works silently. Also there might be problems on Mojave with permissions, our testing farm uses High Sierra.
Our approach is fast (milliseconds fast), however we don't have blackbox alternative (using UI of iOS) as a fallback.
Mixbox can not interact with anything hidden (as a real person). Autoscrolling is enabled by default for every action or check (can be manually disabled). It is not tested with UITableView (we use UICollectionView). If scrolling is not working, there is a workaround -
It is a workaround, it is not reliable, because it doesn't know where the element is. It tries to scroll view randomly until desired element appears. |
Thanks, got it.
Hm, Mojave could be an issue. Currently after calling
This field is actually on screen. It's some custom field implementation with facade like dots and underlines (like typical pin screen). And XCUITest can sendkeys to it, but Mixbox tries to scroll and find it and fails. Actual element tree looks like:
And it is not actually hidden, but also not visible as classic field due to facade I also have a question about network stubbing. You use |
I understood your UI. But didn't understand the point of usage of hidden UITextField from tests. It should not be accessible from a test. It is a private implementation, not a user interface. There is an option to "type" into a field that is not text view. But it should be visible. For example, you can type in first Also, if setText doesn't work (it works via cmd+A + cmd+V), try typeText, it enters characters one by one. It may be slow, because it waits until element gains focus, which will not happen. Or it might even fail, I don't remember.
Facade is not open sourced. You can use raw SBTUITestTunnel interfaces. We plan to get rid of SBTUITestTunnel in a month or two and open source mocking interfaces for Black Box and Gray Box tests (Gray Box tests are in development and do not work). Interface of the facade looks like this now:
Interfaces will also be changed. SBTUITestTunnel functionality is tool limited for us. For example, it doesn't support proxying and modification of real responses. |
First of all, thank you for this project. I want to try it in our app and need some "howto" examples.
I already add
Demo
to our UI target and it's work. (or it should be in Unit Test?)Now i have a couple of questions:
element in element.id == "label"
and$0.id == "button"
?I will be grateful for the help.
The text was updated successfully, but these errors were encountered: