I'm running some of my UI test cases in XCode and it's perfectly working fine. I'm building for test and making zip file to run same test cases on the firebase test lab.
So, there are my test cases are failed to run and showing following errors.
Case 1:
Failure at <PathToUITest>/Elements/Element.swift:53 - Assertion Failure at Element.swift:53: Failed to multiple matching elements found for <XCUIElementQuery: 0x281d80370>.
Sparse tree of matches:
→Application, pid: 1542, label: 'App Name'
↳Window (Main)
↳Other
↳Other
↳Table, identifier: 'profile_edit_table_view'
↳Cell
↳Button, identifier: 'camera_icon', label: 'Tap to change your picture'
↳Other, label: 'profile.image'
↳Button, identifier: 'camera_icon', label: 'Tap to change your picture'
Possibly caused by runtime issues:
Automation type mismatch: computed Button from legacy attributes vs Image from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 43;
"XC_kAXXCAttributeElementBaseType" = UIImageView;
"XC_kAXXCAttributeElementType" = UIImageView;
"XC_kAXXCAttributeTraits" = 8589934593;
}
Automation type mismatch: computed Button from legacy attributes vs Image from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 43;
"XC_kAXXCAttributeElementBaseType" = UIAccessibilityElement;
"XC_kAXXCAttributeElementType" = UIImageView;
"XC_kAXXCAttributeTraits" = 8589934593;
}
In above test case, I have added UIImageView with TapGesture and when click on it, open alert to capture photo or open gallery then select image.
Case 2:
Failure at <PathToUITest>/Elements/Element.swift:1072 - Assertion Failure at Element.swift:1072: Failed to tap Button (First Match): No matches found for first query match sequence: `Descendants matching type DatePicker` -> `Descendants matching type Button` -> `Elements matching predicate 'label CONTAINS " 1 April"'`, given input App element pid: 1643 (no attribute values faulted in)
Possibly caused by runtime issues:
Automation type mismatch: computed Button from legacy attributes vs Cell from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 75;
"XC_kAXXCAttributeElementBaseType" = "_UIDatePickerCalendarDayCell";
"XC_kAXXCAttributeElementType" = "_UIDatePickerCalendarDayCell";
"XC_kAXXCAttributeTraits" = 8589934593;
}
Automation type mismatch: computed Button from legacy attributes vs Cell from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 75;
"XC_kAXXCAttributeElementBaseType" = "_UIDatePickerCalendarDayCell";
"XC_kAXXCAttributeElementType" = "_UIDatePickerCalendarDayCell";
"XC_kAXXCAttributeTraits" = 8589934601;
}
Automation type mismatch: computed Button from legacy attributes vs Image from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 43;
"XC_kAXXCAttributeElementBaseType" = UIAccessibilityElement;
"XC_kAXXCAttributeElementType" = UIImageView;
"XC_kAXXCAttributeTraits" = 8589934593;
}
Automation type mismatch: computed Button from legacy attributes vs Image from modern attribute. Input attributes and values: {
"XC_kAXXCAttributeAutomationType" = 43;
"XC_kAXXCAttributeElementBaseType" = UIImageView;
"XC_kAXXCAttributeElementType" = UIImageView;
"XC_kAXXCAttributeTraits" = 8589934593;
}
In above case I have UIDatePicker where I'm selecting custom date with NSPredicate and based on that selecting Year & Month, then date. Year and Month selection working fine, but when date going to select date then my test case failed and display above error.
Below is the code that how I select date from the string.
func updateDatePicker(value: String) {
application.datePickers.buttons.matching(identifier: "Month").firstMatch.tap()
let values = value.split(separator: " ") // March 7 2020
application.pickerWheels.element(boundBy: 0).adjust(toPickerWheelValue: String(values.first ?? ""))
sleep(2)
application.pickerWheels.element(boundBy: 1).adjust(toPickerWheelValue: String(values.last ?? ""))
sleep(2)
application.datePickers.buttons.matching(identifier: "Month").firstMatch.tap()
sleep(2)
let dateMonth = " \(values[1]) \(values[0])"
if application.datePickers.collectionViews.buttons.matching(NSPredicate(format: "label CONTAINS '\(dateMonth)'")).firstMatch.exists {
application.datePickers.collectionViews.element(boundBy: 0).buttons.matching(NSPredicate(format: "label CONTAINS '\(dateMonth)'")).element(boundBy: 0).tap()
}
sleep(2)
}
Here is all details I have provided, Let me know If you need more information.